Repository navigation
lnwallet/test: wait for the expected confirmation status - #11508
Open
litbot-9000 wants to merge 2 commits into
Open
litbot-9000 wants to merge 2 commits into
litbot-9000 wants to merge 2 commits into
Conversation
A wallet can report itself as synced to the chain tip before it has processed the transactions of the last block. With neutrino, the block's filter is matched and the confirmation recorded asynchronously, so assertTxInWallet, which read the transaction list exactly once, could still see a just mined transaction as unconfirmed. The first nightly run failed this way in get_transaction_details. Poll until the transaction shows up with the expected confirmation status instead, failing with the same error after 30 seconds.
🟢 PR Severity: LOW
🟢 Low (2 files)
AnalysisAlthough To override, add a |
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.
Fixes the
unit-race tags="test_db_sqlite"failure reported in #11507.Problem
The first nightly run (job 127023741626) failed with:
sendCoinsmines the transaction and then callswaitForWalletSyncon both wallets. That waits until the wallet's best block equals the miner's tip andIsSynced()returns true. With neutrino, though, the wallet's sync height can advance before the matching block filter has been processed and the transaction's confirmation recorded, because that happens asynchronously.assertTxInWalletthen reads the transaction list exactly once, and in that window it sees the transaction as still unconfirmed.Fix
assertTxInWalletnow polls withwait.NoErrorfor up to 30 seconds until the transaction appears with the expected confirmation status, instead of failing on the first read. The final check is the same. A wallet that never records the confirmation, or that records one that's wrong, still fails, with the same message. Every caller benefits, including the assertions that expect a transaction to stay unconfirmed: polling can't make those pass spuriously, because they already require the transaction to be found in the unconfirmed state.Verification
go vet ./lnwallet/test/...andgofmtare clean.transaction_details,transaction_details_offsetandget_transaction_detailssubtests locally against a btcd harness: pass.lnwallet/test/neutrinoandlnwallet/test/btcdsuites locally with-race: pass (neutrino 201s, btcd 108s).The race itself is timing dependent, so it doesn't reproduce on demand; the nightly run is the real check.
Not covered
The other failure in #11507,
Run windows itest(coop_close_exceeds_max_feeandwallet_import_pubkey/BIP-0049, both timeouts), is unrelated. Those are timeouts on slow Windows runners. The same job also failed in a merge-queue run on 2026-11-03. It's not a required check, and it isn't changed here.