bitcoind: accept boolean verbosity on getblock/getrawtransaction#5
Open
echennells wants to merge 1 commit into
Open
bitcoind: accept boolean verbosity on getblock/getrawtransaction#5echennells wants to merge 1 commit into
echennells wants to merge 1 commit into
Conversation
b42753f to
07b441c
Compare
07b441c to
7a2ec96
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the boolean-verbosity incompatibility on the new bitcoind JSON-RPC interface (libbitcoin#795).
Problem. bitcoind accepts a number or a boolean for the
getrawtransaction/getblockverbosity parameter (both were originally boolean). The interface types them number-only (optional<0.0>/optional<1.0>), so a boolean fails parameter matching: the request is unroutable and the channel is stopped — the client sees a dropped connection with no JSON-RPC error.Client impact (at the pinned versions). Both canonical Rust clients send booleans for getrawtransaction — rust-bitcoincore-rpc (
get_raw_transaction*->into_json(false/true)) and corepc (false.into()/true.into()). ord (bitcoincore-rpc 0.19.0) callsget_raw_transaction*at four sites inindex.rs, so transaction fetching fails outright against bs.Fix. The interface entries become
optional<empty::value>(the dispatcher's any-typed optional), and ato_verbosity()helper coerces: missing -> default, bool -> 0/1, number -> passthrough, anything else -> aninvalid_argumentJSON-RPC error rather than a connection drop.Testing. Unit suite
bitcoind_to_verbosity_tests. Live on testnet3 (h~4.99M):getrawtransaction <txid> true|falseandgetblock <hash> true|falsereturn correct verbose/hex; numeric forms unchanged; an out-of-range verbosity now returns a JSON-RPC error rather than dropping.