tests: fixe test_multichan_stress flake - #9401
Merged
daywalker90 merged 1 commit intoAug 11, 2026
Merged
Conversation
```
def send_many_payments():
passes = 0
fails = 0
# Make sure we try many times, and get at least one pass and fail.
while passes == 0 or fails == 0 or passes + fails < 30:
inv = l3.rpc.invoice(100, "label-" + str(passes + fails), "desc")
l1.rpc.sendpay(route, inv['payment_hash'], payment_secret=inv['payment_secret'])
time.sleep(0.05)
try:
l1.rpc.waitsendpay(inv['payment_hash'])
passes += 1
except RpcError:
fails += 1
pass
# Send a heap of payments, while reconnecting...
fut = executor.submit(send_many_payments)
for _ in range(30):
l3.rpc.disconnect(l2.info['id'], force=True)
time.sleep(0.1)
l3.rpc.connect(l2.info['id'], 'localhost', l2.port)
> fut.result(TIMEOUT)
```
The while loop would somtimes go infinitely long if no payments fail.
Changelog-None
Andezion
approved these changes
Aug 11, 2026
| # (reconnects are fast), so we can't rely on getting either. | ||
| # Send a bounded number while the reconnects run, and let the | ||
| # payments below verify the channels work afterwards. | ||
| for i in range(50): |
Collaborator
Author
There was a problem hiding this comment.
Before it was minimum 30 and the sleep is shorter in the payments loop so i added a bit for good measure. I have not measured it but the goal is for the payments loop and the reconnect loop to take roughly equally long.
daywalker90
enabled auto-merge (rebase)
August 11, 2026 14:53
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.
The while loop would somtimes go infinitely long if no payments fail.
Fixes: #9326