Skip to content

bcli: recognise "already in the chain" from sendrawtransaction - #9712

Open
nepet wants to merge 1 commit into
ElementsProject:masterfrom
nepet:bcli-already-in-chain
Open

nepet wants to merge 1 commit into
ElementsProject:masterfrom
nepet:bcli-already-in-chain

Conversation

@nepet

@nepet nepet commented Nov 7, 2026

Copy link
Copy Markdown
Member

Checklist

Before submitting the PR, ensure the following tasks are completed. If an item is not applicable to your PR, please mark it as checked:

  • The changelog has been updated in the relevant commit(s) according to the guidelines.
  • Tests have been added or modified to reflect the changes.
  • Documentation has been reviewed and updated as needed.
  • Related issues have been listed and linked, including any that this PR closes.
  • Important All PRs must consider how to reverse any persistent changes for tools/lightning-downgrade

sendrawtransaction means to take bitcoind's "already in the chain" error (-27, RPC_VERIFY_ALREADY_IN_UTXO_SET) as success, but it compares bitcoin-cli's exit status with -27. bitcoin-cli exits with the absolute value of the RPC error code, so the check never matched, and sending a transaction that is already confirmed reported a failure. #9091 was one place this showed up.

This compares the exit status with 27. The test sends a confirmed transaction to bcli's sendrawtransaction and expects "success": true.

sendrawtransaction means to take bitcoind's "transaction already in the
chain" error (-27, RPC_VERIFY_ALREADY_IN_UTXO_SET) as success, but it
compares bitcoin-cli's exit status with -27. An exit status is never
negative: bitcoin-cli exits with the absolute value of the RPC error
code, here 27. So the check never matched since it was added in
910e79d, and sending a transaction that is already confirmed reported
a failure, e.g. "Failed to re-transmit funding tx: error code: -27" in
ElementsProject#9091.

Compare the exit status with 27.

Changelog-Fixed: bcli: `sendrawtransaction` of a transaction that is already in the chain now reports success, as intended.

This branch has not been deployed

No deployments
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