Repository navigation
Conversation
… spent
getutxout answered {"amount": null, "script": null} both when bitcoind
said the output is spent or unknown (exit 0, no output) and when the
bitcoin-cli gettxout call failed, e.g. because bitcoind was unreachable
or still starting up. lightningd can't tell the two apart, and acts on a
"spent": gossip leaves the output out of the filtered block it stores,
so the channel announcement stays rejected, and fundchannel_cancel
forgets a channel whose funding tx another wallet has broadcast.
Retry a failed call every second until bitcoin-retry-timeout, as
getrawblockbyheight does for getblock, and then fail. lightningd still
aborts on that error, as it does for every bcli error, but it no longer
acts on a wrong "spent".
Fixes: ElementsProject#9714
Changelog-Fixed: bcli: `getutxout` retries a failed `gettxout` (e.g. while bitcoind starts up) until `bitcoin-retry-timeout`, instead of reporting the output as spent.
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.
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:
tools/lightning-downgradeFixes #9714.
getutxoutanswered{"amount": null, "script": null}both when bitcoind says the output is spent or unknown (gettxoutexits 0 with no output) and when thebitcoin-cli gettxoutcall fails, e.g. because bitcoind is unreachable or still starting up. lightningd takes a null answer as "spent", and some callers act on it: gossip leaves the output out of the filtered block it stores, so the channel announcement stays rejected, andfundchannel_cancelforgets a channel whose funding tx another wallet has broadcast.This retries a failed
gettxoutevery second untilbitcoin-retry-timeout, asgetrawblockbyheightalready does forgetblock, and then returns an error. Only an exit 0 with no output still answers null.After the timeout lightningd still aborts on that error, as it does on any bcli error (#9573). #9574 would let lightningd ride out transient backend errors, starting with
getchaininfo.getutxout's callers could follow. Until then this never turns a failed call into a wrong "spent". Like thegetblockretry, the loop holds up bcli's other calls while it runs, which only happens while bitcoind is failing anyway.The tests make the bitcoind proxy fail
gettxouttwice and then answer:getutxoutreturns the real output, andfundchannel_cancelrefuses to forget a channel whose funding tx bitcoind broadcast. Withgettxoutfailing for good,getutxoutfails afterbitcoin-retry-timeout. Both tests fail on master.