Skip to content

test: opt flaky functional tests into immediate tx relay - #36306

Closed
ronnakamoto wants to merge 1 commit into
bitcoin:masterfrom
ronnakamoto:test/noban-tx-relay
Closed

ronnakamoto wants to merge 1 commit into
bitcoin:masterfrom
ronnakamoto:test/noban-tx-relay

Conversation

@ronnakamoto

Copy link
Copy Markdown

Part of #19732.

Functional tests are intrinsically vulnerable to timeouts because transaction relay to inbound peers is delayed by a Poisson process. Tests that do not specifically exercise relay timing can therefore fail intermittently when they wait on transactions still inside the relay-delay window.

This PR opts the affected tests into immediate transaction relay by setting noban_tx_relay = True, which whitelists the local peer (-whitelist=noban,in,[email protected]) and bypasses the delayed relay:

  • mempool_accept_wtxid
  • mempool_limit
  • mempool_package_rbf
  • mempool_persist
  • wallet_change_address
  • wallet_conflicts
  • wallet_orphanedreward

Three tests also restart a node with a literal argument list (-disablewallet, -persistmempool=0), which silently dropped the whitelist and reintroduced the relay delay. Their restarts now inherit self.extra_args[i] so the immediate-relay whitelist survives:

  • mempool_persist
  • wallet_balance
  • rpc_psbt

Together this covers 8 of the 14 tests on the current flaky list in #19732, every non-timing test on it. wallet_balance and rpc_psbt already carried their opt-in but were still failing for the restart reason above; wallet_orphanedreward is not on the list but is subject to the same failure mode.

The remaining 6 tests on the list deliberately exercise relay timing and cannot opt into immediate relay; per the discussion in #19732 they need mocktime or a larger base timeout instead:

  • mempool_reorg
  • p2p_blocksonly
  • p2p_leak_tx
  • p2p_private_broadcast
  • p2p_tx_download
  • p2p_tx_privacy

Note that a timeout signature is not a reliable discriminator here, several of this fail with the same ~60 s timeout as the fixable ones, because their mocktime advance is calibrated to the real relay mean. The discriminator is what each test asserts. p2p_tx_privacy currently has no mocktime calls at all, so it needs mocktime added rather than adjusted.

Testing

All nine changed tests pass under the #19732 reproducer (forcing a 12-minute relay delay in NextInvToInbounds): e.g. wallet_change_address 62 s to 3 s, wallet_balance 66 s to 6 s, rpc_psbt 74 s to 14 s. The unchanged tests are unaffected.

Functional tests are intrinsically vulnerable to timeouts because
transaction relay to inbound peers is delayed by a Poisson process
(bitcoin#19732). Tests that do not specifically exercise relay timing can
therefore fail intermittently when they wait on transactions still
inside the relay-delay window.

Opt the affected tests into immediate transaction relay by setting the
noban_tx_relay attribute, which whitelists the local peer
(-whitelist=noban,in,[email protected]) and bypasses the delayed relay:

- mempool_accept_wtxid
- mempool_limit
- mempool_package_rbf
- mempool_persist
- wallet_change_address
- wallet_conflicts
- wallet_orphanedreward

Also preserve the immediate-relay whitelist across node restarts that
pass a literal argument list (-disablewallet, -persistmempool=0), which
previously dropped the whitelist and reintroduced the relay delay:

- mempool_persist
- wallet_balance
- rpc_psbt
@DrahtBot DrahtBot added the Tests label Sep 21, 2026
@DrahtBot

DrahtBot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Code Coverage & Benchmarks

For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/36306.

Reviews

See the guideline and AI policy for information on the review process.
A summary of reviews will appear here.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #36440 (test: speed up functional tests by removing avoidable waits by ViniciusCestarii)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@sedited

sedited commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

To preserve the time of reviewers, this project requires authors to understand the code they are submitting. Given that the description looks entirely LLM generated, I don't think that is the case, so I am closing this again.

@sedited sedited closed this Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants