Repository navigation
Conversation
|
|
cdecker
left a comment
There was a problem hiding this comment.
Consider using bitcoin-cli -rpcwait=60 or something similar.
|
Switched to |
498f658 to
7077a40
Compare
|
CI is not passing the new test: |
… 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.
Call gettxout with -rpcwait, so that bitcoin-cli retries while bitcoind
is unreachable or warming up, until bitcoin-retry-timeout, and fail on
any non-zero exit. Errors that retrying can't fix, like a malformed
txid, come back at once. 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` waits for bitcoind (e.g. while it starts up) until `bitcoin-retry-timeout`, instead of reporting the output as spent when `gettxout` fails.
7077a40 to
a36cee7
Compare
|
Fixed: the test passed the v2 PSBT from |
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 calls gettxout with -rpcwait, so bitcoin-cli retries while bitcoind is unreachable or warming up, until bitcoin-retry-timeout, and then returns an error. Errors that retrying can't fix, like a malformed txid, come back at once. 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 the getblock retry, the wait 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-timeoutand a malformed txid fails at once. Both tests fail on master.