Skip to content

CI: fix sweep and compat flakes#10828

Open
yyforyongyu wants to merge 2 commits into
lightningnetwork:masterfrom
yyforyongyu:fix-bwcompat-route-wait
Open

CI: fix sweep and compat flakes#10828
yyforyongyu wants to merge 2 commits into
lightningnetwork:masterfrom
yyforyongyu:fix-bwcompat-route-wait

Conversation

@yyforyongyu
Copy link
Copy Markdown
Member

@yyforyongyu yyforyongyu commented May 21, 2026

Found in #10827

Fix the itest failure

--- FAIL: TestLightningNetworkDaemon/tranche02/48-of-345/bitcoind/sweep_cpfp_anchor_incoming_timeout (54.74s)
        harness_node.go:395: Starting node (name=Alice) with PID=19244
        harness_node.go:395: Starting node (name=Bob) with PID=19286
        harness_node.go:395: Starting node (name=Carol) with PID=19317
        lnd_sweep_test.go:608: Bob(position=6): txWeight=722 wu, expected: [fee=5166, feerate=7155 sat/kw], got: [fee=5172, feerate=7163] in tx 334fc9a54af7c630c879b5b6f445d37e347eea3ca3afdb169770a72b6b54fdd1
        lnd_sweep_test.go:608: Bob(position=5): txWeight=722 wu, expected: [fee=8527, feerate=11810 sat/kw], got: [fee=8531, feerate=11799] in tx 1860f4ee1463a88ad4ee44966cfd539f80a788fa506a0a76eee2e5a842153b38
        lnd_sweep_test.go:608: Bob(position=4): txWeight=722 wu, expected: [fee=11888, feerate=16465 sat/kw], got: [fee=11891, feerate=16470] in tx 311b990f7a6fe09d6687f863e273a6b0ba9f8ff2163f5d01aa38a2778e5f1689
        lnd_sweep_test.go:608: Bob(position=3): txWeight=722 wu, expected: [fee=15249, feerate=21120 sat/kw], got: [fee=15251, feerate=21094] in tx 61475cf939f4690c34691583dc3ed22e99c9d377290d89c9638925c64e3a64e6
        lnd_sweep_test.go:608: Bob(position=2): txWeight=722 wu, expected: [fee=18610, feerate=25776 sat/kw], got: [fee=18610, feerate=25776] in tx b40ec707488e2449f0b26e87a52cc5f062d2ec85b0dd483200f46f9fff9c1db0
        lnd_sweep_test.go:608: Bob(position=1): txWeight=722 wu, expected: [fee=21971, feerate=30431 sat/kw], got: [fee=21970, feerate=30387] in tx 3e2a02e011a257a0dd0bf4b8f425a8dd10136b5978d97152e353c5c15fe38d5d
        miner.go:353: 
            	Error Trace:	/home/runner/work/lnd/lnd/lntest/miner/miner.go:353
            	            				/home/runner/work/lnd/lnd/lntest/harness_miner.go:111
            	            				/home/runner/work/lnd/lnd/itest/lnd_sweep_test.go:693
            	            				/home/runner/work/lnd/lnd/lntest/harness.go:320
            	            				/home/runner/work/lnd/lnd/itest/lnd_test.go:144
            	            				/opt/hostedtoolcache/go/1.25.5/x64/src/runtime/asm_amd64.s:1693
            	Error:      	tx was not included in block
            	Test:       	TestLightningNetworkDaemon/tranche02/48-of-345/bitcoind/sweep_cpfp_anchor_incoming_timeout
            	Messages:   	tx:ffb0ce83a0b5d0360efabd772773a84efbaebc83b26958e6451f1f45b206979c, block has:[168d21329b1edd5b33e5cf0ec2f7c23046a27e2374378db80f35828d1bcdf8c0 ac1344f64107108372c2a61154ed75a8b8afba1ce8acf451e63d47bbf2ce4c95]
        harness.go:398: finished test: sweep_cpfp_anchor_incoming_timeout, start height=461, end height=514, mined blocks=53
        harness.go:420: !============================================!

What happened:

  • The test observed sweep tx ffb0...979c in the mempool before mining.
  • Bob RBFed that sweep before the block was mined.
  • The block correctly included the replacement tx ac13...4c95.
  • The test failed because it asserted the old txid instead of the sweep outpoint.
  • This PR asserts that the mined tx spends the pending sweep outpoint, which stays stable across RBF.

and fix the compatibility test

❌ Error: Payment failed from alice to dave
📜 Details: +------------+--------------+--------------+--------------+-----+----------+----------+-------+
| HTLC_STATE | ATTEMPT_TIME | RESOLVE_TIME | RECEIVER_AMT | FEE | TIMELOCK | CHAN_OUT | ROUTE |
+------------+--------------+--------------+--------------+-----+----------+----------+-------+
+------------+--------------+--------------+--------------+-----+----------+----------+-------+
Amount + fee:   0 + 0 sat
...

What happened:

  • The compat test waited for graph channel counts to sync.
  • Channel count sync does not guarantee edge policies are ready for routing.
  • Alice knew the channels, but could not build a route to Dave yet.
  • The payment failed with no route.
  • This PR waits for queryroutes to succeed before sending each test payment.

@yyforyongyu yyforyongyu requested a review from Copilot May 21, 2026 12:59
@yyforyongyu yyforyongyu self-assigned this May 21, 2026
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses two sources of flakiness in the test suite. First, it improves the robustness of sweep tests by accounting for potential RBF replacements during block mining. Second, it enhances the reliability of cross-version compatibility tests by ensuring routing information is fully synchronized between nodes before payment attempts are initiated.

Highlights

  • Sweep Test Stability: Updated the sweep CPFP anchor test to assert that the mined transaction spends the expected outpoint rather than matching a specific transaction ID, preventing failures caused by RBF (Replace-By-Fee) events.
  • Compatibility Test Reliability: Introduced a wait_for_route mechanism in the compatibility test suite to ensure that nodes have fully propagated edge policies before attempting payments, resolving intermittent routing failures.
New Features

🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request enhances the reliability of integration and backward compatibility tests. In the Go integration tests, a new helper MineBlockAndAssertOutpointSpent is introduced to correctly handle RBF-sensitive transactions by verifying that a specific outpoint is spent in a block, regardless of the transaction ID. The backward compatibility shell scripts are also updated with a wait_for_route utility to ensure the network graph is sufficiently synced before attempting payments. I have no feedback to provide.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Fixes CI flakes in itest sweeps and bw compatibility by making assertions resilient to RBF and waiting for routable graph state before sending payments.

Changes:

  • Add a compatibility-test helper to wait until queryroutes succeeds before attempting payments.
  • Add a harness miner helper to assert a mined block spends a specific outpoint (RBF-stable) rather than relying on pre-mine txids.
  • Update the sweep itest to assert the mined sweep spends the pending sweep outpoint (stable across RBF).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
scripts/bw-compatibility-test/network.sh Adds wait_for_route and gates payments on route availability to avoid “no route” flakes.
lntest/harness_miner.go Adds block-mining helper that asserts an outpoint is spent in a mined block (RBF-safe).
itest/lnd_sweep_test.go Switches sweep assertion from txid-based to outpoint-spent-based to tolerate RBF replacements.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/bw-compatibility-test/network.sh Outdated
Comment thread scripts/bw-compatibility-test/network.sh
Comment thread lntest/harness_miner.go Outdated
Comment thread itest/lnd_sweep_test.go Outdated
@github-actions
Copy link
Copy Markdown

🟢 PR Severity: LOW

Automated classification | 3 files | 115 lines changed (51 lines in non-test files)

🟢 Low (3 files)
  • itest/lnd_sweep_test.go - integration test file (itest/*)
  • lntest/harness_miner.go - test harness utility (lntest/*)
  • scripts/bw-compatibility-test/network.sh - shell script in scripts/*

Analysis

All changed files fall into the LOW severity category:

  • Two files are test infrastructure changes (itest/ and lntest/), which are excluded from severity bump calculations.
  • One file is a shell script under scripts/, which is LOW severity.

No severity bump was triggered: only 1 non-test file changed (threshold: 20), and only 51 non-test lines changed (threshold: 500).

This PR only modifies test helpers and a compatibility test script, requiring best-effort review.


To override, add a severity-override-{critical,high,medium,low} label.
<!-- pr-severity-bot -->

@yyforyongyu yyforyongyu force-pushed the fix-bwcompat-route-wait branch from bf4d1b1 to b3c37a2 Compare May 21, 2026 13:26
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.

2 participants