What changed, and why it matters
This commit fixes a flaky automated test in Electrum's Lightning regtest suite. It replaces a hard-coded 5-second wait with a polling helper that waits up to 30 seconds for a test condition to become true. There is no change to production wallet or Lightning code, and no security issue is present.
No security action needed. This is a test reliability improvement only.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change is confined to tests/regtest/regtest.sh in the fw_fail_htlc test case. It removes a fixed sleep(5) and direct jq check of local_unsettled_sent, substituting the existing wait_until_htlcs_settled helper with a 30-second timeout. This makes the test more robust on slow CI runners but does not alter Electrum’s runtime behavior, consensus logic, or protocol handling.
Changed components
tests/regtest/regtest.shInspect captured patch +2 / −7
diff --git a/tests/regtest/regtest.sh b/tests/regtest/regtest.sh
index e51af80..9bd5a9e 100755
--- a/tests/regtest/regtest.sh
+++ b/tests/regtest/regtest.sh
@@ -758,13 +758,8 @@ if [[ $1 == "fw_fail_htlc" ]]; then
wait_until_spent $ctx_id $output_index
new_blocks 1 # confirm 2nd stage.
sleep 1
- new_blocks 100 # deep
- sleep 5 # give bob time to fail incoming htlc
- unsettled=$($alice list_channels | jq '.[] | .local_unsettled_sent')
- if [[ "$unsettled" != "0" ]]; then
- echo 'alice htlc was not failed'
- exit 1
- fi
+ new_blocks 100 # deep enough for is_deeply_mined (>20 confs)
+ wait_until_htlcs_settled alice # bob propagates the failure back once the HTLC-timeout tx is deeply mined
fi
if [[ $1 == "just_in_time" ]]; then
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.