Repository navigation
fix(rpc): read chunked responses from the bitcoind RPC server - #393
Open
eynhaender wants to merge 1 commit into
Open
eynhaender wants to merge 1 commit into
eynhaender wants to merge 1 commit into
Conversation
emma31-dev
reviewed
Nov 26, 2026
emma31-dev
left a comment
Contributor
There was a problem hiding this comment.
Approach ACK.
Thank you for working on this. Merge master into this branch and rebase to one commit that i can ACK.
| - Fixed `key generate` silently producing a 24-word mnemonic for any `--entropy` value other than 12; values other than 12 and 24 are now rejected | ||
| - Gated `full_scan`'s `--scan-stop-gap` to the Electrum and Esplora backends that use it; RPC and CBF wallets now reject the flag instead of silently ignoring it, while a `STOP_GAP` environment variable keeps working for supported backends and no longer breaks unsupported ones | ||
| - Changed `payjoin history` to return JSON instead of a rendered table | ||
| - Fixed the `rpc` backend failing against servers that send chunked responses ("The server replied with a chunked response which is not supported"); the RPC client now uses jsonrpc's `minreq_http` transport |
Contributor
There was a problem hiding this comment.
The changelog entry can be simplified to this:
Suggested change
| - Fixed the `rpc` backend failing against servers that send chunked responses ("The server replied with a chunked response which is not supported"); the RPC client now uses jsonrpc's `minreq_http` transport | |
| - Fixed the `rpc` backend failing against servers that send chunked responses |
|
|
||
| let rpc_error = | ||
| |e: jsonrpc::Error| Error::BitcoinCoreRpcError(bitcoincore_rpc::Error::JsonRpc(e)); | ||
| let (user, pass) = auth.get_user_pass().map_err(Error::BitcoinCoreRpcError)?; |
Contributor
There was a problem hiding this comment.
NIT: .map_err can be safely removed
Suggested change
| let (user, pass) = auth.get_user_pass().map_err(Error::BitcoinCoreRpcError)?; | |
| let (user, pass) = auth.get_user_pass()?; |
`bitcoincore_rpc::Client::new` always uses jsonrpc's `simple_http`
transport, which rejects responses sent with `Transfer-Encoding: chunked`
("The server replied with a chunked response which is not supported").
Servers that stream JSON-RPC responses chunked, such as libbitcoin-server,
cannot be used with `--client-type rpc`.
Build the RPC client over jsonrpc's `minreq_http` transport instead, which
reads chunked and content-length responses. bitcoincore-rpc 0.19 already
enables the `minreq_http` feature of jsonrpc, so no dependency changes.
minreq requires a URL scheme while simple_http defaulted to http, so
`http://` is prepended when the URL has none (e.g. `127.0.0.1:18443`).
eynhaender
force-pushed
the
fix/rpc-chunked-responses
branch
from
November 26, 2026 13:32
830780a to
0837bc1
Compare
Author
|
Rebased on master as a single commit and applied both suggestions. CI is waiting for workflow approval. Thanks for your quick response, let's keep on building. |
emma31-dev
approved these changes
Nov 26, 2026
emma31-dev
left a comment
Contributor
There was a problem hiding this comment.
ACK 0837bc1
Everything looks good and online commands still work as expected.
This branch has not been deployed
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.
Description
Fixes #392.
--client-type rpcbuilt its client withbitcoincore_rpc::Client::new, which always uses jsonrpc'ssimple_httptransport and fails on any response sent withTransfer-Encoding: chunked.This PR builds the client with
Client::from_jsonrpcover jsonrpc'sminreq_httptransport, which reads both chunked andContent-Lengthresponses. bitcoincore-rpc 0.19 already enablesminreq_http, soCargo.tomlandCargo.lockare unchanged.Notes to the reviewers
minreqrequires a URL scheme, whilesimple_httpassumedhttp.http://is therefore prepended when--urlhas none, so127.0.0.1:18443from the README keeps working.Basic auth (
--basic-auth, and the cookie file viaAuth::get_user_pass) is passed to theminreq_httpbuilder. Transport errors map to the existingError::BitcoinCoreRpcError(bitcoincore_rpc::Error::JsonRpc(..)).Tested manually on regtest with
wallet full_scanand the same wpkh wallet against Bitcoin Core 32.1 and libbitcoin-server masterd09a5c2a(bitcoind endpoint, which sends every response withTransfer-Encoding: chunked):http://)In every run that succeeded, the txid set and the balance were identical.
There is no automated regression test:
bdk_testenv's bitcoind only sendsContent-Lengthresponses. A test would need a mock HTTP server that sends chunked responses; I can add one if wanted.Checklists
All Submissions:
just pre-pushbefore pushingBugfixes: