Skip to content

bitcoind: accept boolean verbosity on getblock/getrawtransaction#5

Open
echennells wants to merge 1 commit into
masterfrom
bitcoind-bool-verbosity
Open

bitcoind: accept boolean verbosity on getblock/getrawtransaction#5
echennells wants to merge 1 commit into
masterfrom
bitcoind-bool-verbosity

Conversation

@echennells

@echennells echennells commented Jun 13, 2026

Copy link
Copy Markdown
Owner

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/getblock verbosity 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) calls get_raw_transaction* at four sites in index.rs, so transaction fetching fails outright against bs.

Fix. The interface entries become optional<empty::value> (the dispatcher's any-typed optional), and a to_verbosity() helper coerces: missing -> default, bool -> 0/1, number -> passthrough, anything else -> an invalid_argument JSON-RPC error rather than a connection drop.

Testing. Unit suite bitcoind_to_verbosity_tests. Live on testnet3 (h~4.99M): getrawtransaction <txid> true|false and getblock <hash> true|false return correct verbose/hex; numeric forms unchanged; an out-of-range verbosity now returns a JSON-RPC error rather than dropping.

@echennells echennells force-pushed the bitcoind-bool-verbosity branch from 07b441c to 7a2ec96 Compare June 28, 2026 01:11
@echennells echennells changed the base branch from master-pr795 to master June 28, 2026 01:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant