AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Informational 15 Bitcoin

pytest: fix flake in test_coinmoves_unilateral_htlc_fulfill / test_coinmoves_unilateral_htlc_timeout

Public commit record

What the developer wrote

Authored by Rusty Russell

73/100 · Adequate
pytest: fix flake in test_coinmoves_unilateral_htlc_fulfill / test_coinmoves_unilateral_htlc_timeout

DER sigs! Normally, the commitment weight is:

```
Anchorspend for local commit tx fee 9751sat (w=722), commit_tx fee 4866sat (w=1284): package feerate 7286 perkw
Creating anchor spend for local commit tx 6a0816ca60d499edc70bfb786ebd164fb7a55d234c84d926102f5bd35087fd45: we're paying fee 9751sat
```

But if we're "lucky" the commitment tx is shorter:

```
Anchorspend for local commit tx fee 9744sat (w=722), commit_tx fee 4866sat (w=1283): package feerate 7286 perkw
Creating anchor spend for local commit tx acf78532a9448dd62a4e6319a3d2712189a88b6e59abc637260067d60df70782: we're paying fee 9744sat
```

The resulting failure:

```
2025-08-21T02:30:34.1906751Z > assert moves == expected
...
...
2025-08-21T02:30:34.1965346Z E {
2025-08-21T02:30:34.1965529Z E 'account_id': 'wallet',
2025-08-21T02:30:34.1965767Z E 'blockheight': 104,
2025-08-21T02:30:34.1965997Z E 'created_index': 6,
2025-08-21T02:30:34.1966229Z E - 'credit_msat': 15579000,
2025-08-21T02:30:34.1966467Z E ? ^^
2025-08-21T02:30:34.1966698Z E + 'credit_msat': 15586000,
2025-08-21T02:30:34.1966927Z E ? ^^
2025-08-21T02:30:34.1967150Z E 'debit_msat': 0,
2025-08-21T02:30:34.1967376Z E 'extra_tags': [],
2025-08-21T02:30:34.1967599Z E - 'output_msat': 15579000,
2025-08-21T02:30:34.1967832Z E ? ^^
2025-08-21T02:30:34.1968061Z E + 'output_msat': 15586000,
2025-08-21T02:30:34.1968294Z E ? ^^
2025-08-21T02:30:34.1968540Z E 'primary_tag': 'deposit',
2025-08-21T02:30:34.1968908Z E 'utxo': 'acf78532a9448dd62a4e6319a3d2712189a88b6e59abc637260067d60df70782:0',
2025-08-21T02:30:34.1969366Z E },
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This commit fixes a flaky automated test in Core Lightning. The test sometimes failed because the size of a Bitcoin transaction signature can randomly vary by one byte, changing the transaction fee and the leftover change amount. The fix reads the actual change amount from the blockchain instead of hardcoding an expected value. It is not a security fix and does not affect production code.

Recommended action

No security action required. This is a test-only reliability improvement. Reviewers may verify the new assertion still validates the expected coin-move structure and that the value lookup uses the correct output index.

Security signals we found

No strong security signals were identified.

Risk score

Why this scored 15/100

Our methodology →
Potential impact 0/30
Exploitability 0/25
Stealth signal 0/15
Affected reach 0/15
Confidence 10/10
Evidence quality 5/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.