Repository navigation
Show the node's reason when a Bitcoin broadcast is rejected - #1547
Merged
Merged
Conversation
) Blockbook rejects sendtx with HTTP 400 and a plain {"error":"..."} body. gem_client only reads the {"error":{"message":...}} shape, so it kept the 400 as ClientError::Http and every Bitcoin-family rejection reached the user as "HTTP error: status 400". The text in #1276 is dynode's normalized log line, not what the app showed. BitcoinClient::broadcast_transaction now decodes a rejected body with ClientError::decode_body and returns it as the broadcast result when it carries an error, so the existing mapper shows the node's reason (for #1276, "-26: insufficient fee, rejecting replacement ..."). Any other failure keeps the original ClientError, so the gateway still reads its HTTP status. A structured error body already arrives as ClientError::Response, whose text is the node's message. Checks: core just test gem_bitcoin; cargo clippy -p gem_bitcoin --all-features -D warnings.
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.
Part of #1276. Every Bitcoin-family broadcast rejection reached the user as "HTTP error: status 400", so the app never showed why a send failed.
Blockbook answers a rejected
sendtxwith HTTP 400 and a plain{"error":"..."}body. gem_client only parses the{"error":{"message":...}}shape, so it kept the 400 asClientError::Httpand the node's reason was dropped. The message quoted in #1276 is dynode's normalized broadcast log, not what users saw.BitcoinClient::broadcast_transactiondecodes the rejected body withClientError::decode_bodyand returns it as the broadcast result when it carries an error, so the existing mapper shows the node's reason, e.g.-26: insufficient fee, rejecting replacement ...ClientError, so the gateway still reads its HTTP status; a structured error body already arrives asClientError::Responsewith the node's messageThe root cause of #1276 and the options for preventing it are in the issue thread.