Skip to content

fix: inconsitencies on gettxoutproof#1113

Open
jaoleal wants to merge 5 commits into
getfloresta:masterfrom
jaoleal:fix/gettxoutproof_apiinconsistency_docs_tests
Open

fix: inconsitencies on gettxoutproof#1113
jaoleal wants to merge 5 commits into
getfloresta:masterfrom
jaoleal:fix/gettxoutproof_apiinconsistency_docs_tests

Conversation

@jaoleal
Copy link
Copy Markdown
Member

@jaoleal jaoleal commented Jun 2, 2026

Description and Notes

This pr fix some inconsistencies focusing on gettxoutproof;

Each of these is being fixed in a commit.

Depends on #831

@jaoleal
Copy link
Copy Markdown
Member Author

jaoleal commented Jun 2, 2026

cc @csgui #831 (comment)

@jaoleal jaoleal force-pushed the fix/gettxoutproof_apiinconsistency_docs_tests branch 2 times, most recently from 7ba095f to 1b3c8c8 Compare June 2, 2026 17:14
@Davidson-Souza Davidson-Souza added the reliability Related to runtime reliability, stability and production readiness label Jun 2, 2026
@github-project-automation github-project-automation Bot moved this to Backlog in Floresta Jun 2, 2026
@Davidson-Souza Davidson-Souza moved this from Backlog to In progress in Floresta Jun 2, 2026
@jaoleal jaoleal force-pushed the fix/gettxoutproof_apiinconsistency_docs_tests branch from 1b3c8c8 to ac6150e Compare June 3, 2026 15:44
@jaoleal jaoleal marked this pull request as ready for review June 3, 2026 15:44
@jaoleal jaoleal added this to the Q2/2026 milestone Jun 3, 2026
@jaoleal jaoleal moved this from In progress to Needs review in Floresta Jun 3, 2026
@Davidson-Souza
Copy link
Copy Markdown
Member

In 8f0d7a5:

[...] conversion from being accidentally again.

Accidentally what?

jaoleal added 2 commits June 3, 2026 15:02
Change GetTxOutProof to hold a String internally and hex-encode the
merkle proof bytes in blockchain.rs before constructing the type. This
ensures serde_json::to_value() naturally produces the correct hex string.
The FlorestaRPC trait defined get_txout_proof as the only method
returning Option<String> instead of Result<T>. The implementation used
.ok() to silently discard all errors from self.call() — connection
errors, RPC errors, TxNotFound, etc. — causing the CLI to always print
"null" instead of meaningful error messages.

Change the trait signature to Result<String>, remove the .ok() call, and
add ? to the CLI dispatch so errors propagate to the user.
@jaoleal jaoleal force-pushed the fix/gettxoutproof_apiinconsistency_docs_tests branch from ac6150e to e5d54a5 Compare June 3, 2026 18:03
@jaoleal
Copy link
Copy Markdown
Member Author

jaoleal commented Jun 3, 2026

Fixed @Davidson-Souza

@jaoleal jaoleal requested review from Davidson-Souza and csgui and removed request for Davidson-Souza June 3, 2026 18:04
Comment thread crates/floresta-node/src/json_rpc/res.rs
Comment thread bin/floresta-cli/src/parsers.rs Outdated
@jaoleal jaoleal force-pushed the fix/gettxoutproof_apiinconsistency_docs_tests branch from e5d54a5 to 48e97d3 Compare June 3, 2026 19:08
@jaoleal
Copy link
Copy Markdown
Member Author

jaoleal commented Jun 3, 2026

  • removed parsers.rs in order of a wrapper around serde_json::from_str

@jaoleal jaoleal requested a review from Davidson-Souza June 3, 2026 19:09
jaoleal added 3 commits June 3, 2026 16:14
Without the error-context clap flag, clap uses ErrorKind::as_str() as a static
fallback with no argument name, invalid value, or error detail from the
parser.

This commit also deletes the parsers.rs and in its place we use
a simple closure that allow us to use serde_json::from_str
Add a functional test that syncs a three-node network (florestad,
bitcoind, utreexod), then compares Merkle proofs returned by
gettxoutproof between Floresta and Bitcoin Core for each transaction
in blocks 2 through 9.

Also add get_txout_proof() helper to the BaseRPC test framework class.
@jaoleal jaoleal force-pushed the fix/gettxoutproof_apiinconsistency_docs_tests branch from 48e97d3 to 1cd9af7 Compare June 3, 2026 19:15
@jaoleal
Copy link
Copy Markdown
Member Author

jaoleal commented Jun 3, 2026

We can use a closure instead

   GetTxOutProof {
        /// The transaction IDs to prove
        #[arg(required = true, value_parser = |s: &str| serde_json::from_str::<Vec<Txid>>(s).map_err(|e| e.to_string()))]
        txids: std::vec::Vec<Txid>, // you need to specify the path of Vec https://github.com/clap-rs/clap/discussions/4695

"""
return self.perform_request("generatetoaddress", params=[nblocks, address])

def send_to_address(self, address: str, amount: float) -> str:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You didn't use this. It would be nice to have a few transactions inside a block to test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

reliability Related to runtime reliability, stability and production readiness

Projects

Status: Needs review

Development

Successfully merging this pull request may close these issues.

2 participants