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

pytest: allow pushed after onchain_fee in test_bookkeeping_missed_chans_pushed

Public commit record

What the developer wrote

Authored by Rusty Russell

83/100 · Strong
pytest: allow pushed after onchain_fee in test_bookkeeping_missed_chans_pushed

It can happen, and it's perfectly reasonable. If this happens in other places, we might need to allow
arbitrary reordering?

```
2026-01-29T05:55:58.5474967Z exp_events = [{'tag': 'channel_open', 'credit_msat': open_amt * 1000, 'debit_msat': 0},
2026-01-29T05:55:58.5475765Z {'tag': 'pushed', 'credit_msat': 0, 'debit_msat': push_amt},
2026-01-29T05:55:58.5476454Z {'tag': 'onchain_fee', 'credit_msat': 4927000, 'debit_msat': 0},
2026-01-29T05:55:58.5477168Z {'tag': 'invoice', 'credit_msat': 0, 'debit_msat': invoice_msat}]
2026-01-29T05:55:58.5477797Z > check_events(l1, channel_id, exp_events)
2026-01-29T05:55:58.5478120Z
2026-01-29T05:55:58.5478282Z tests/test_bookkeeper.py:402:
2026-01-29T05:55:58.5478777Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2026-01-29T05:55:58.5479162Z
2026-01-29T05:55:58.5479396Z node = <fixtures.LightningNode object at 0x7fa3660a6140>
2026-01-29T05:55:58.5480158Z channel_id = 'a4e913b2d143efc3d90cfa66a56aeed3eb9e1533b350c8e84124bdec37bcf74a'
2026-01-29T05:55:58.5481929Z exp_events = [{'credit_msat': 10000000000, 'debit_msat': 0, 'tag': 'channel_open'}, {'credit_msat': 0, 'debit_msat': 1000000000, 'tag': 'pushed'}, {'credit_msat': 4927000, 'debit_msat': 0, 'tag': 'onchain_fee'}, {'credit_msat': 0, 'debit_msat': 11000000, 'tag': 'invoice'}]
2026-01-29T05:55:58.5483442Z
2026-01-29T05:55:58.5483671Z def check_events(node, channel_id, exp_events):
2026-01-29T05:55:58.5484551Z chan_events = [ev for ev in node.rpc.bkpr_listaccountevents()['events'] if ev['account'] == channel_id]
2026-01-29T05:55:58.5485684Z stripped = [{k: d[k] for k in ('tag', 'credit_msat', 'debit_msat') if k in d} for d in chan_events]
2026-01-29T05:55:58.5486455Z > assert stripped == exp_events
2026-01-29T05:55:58.5489277Z E AssertionError: assert [{'tag': 'channel_open', 'credit_msat': 10000000000, 'debit_msat': 0}, {'tag': 'onchain_fee', 'credit_msat': 4927000, 'debit_msat': 0}, {'tag': 'pushed', 'credit_msat': 0, 'debit_msat': 1000000000}, {'tag': 'invoice', 'credit_msat': 0, 'debit_msat': 11000000}] == [{'tag': 'channel_open', 'credit_msat': 10000000000, 'debit_msat': 0}, {'tag': 'pushed', 'credit_msat': 0, 'debit_msat': 1000000000}, {'tag': 'onchain_fee', 'credit_msat': 4927000, 'debit_msat': 0}, {'tag': 'invoice', 'credit_msat': 0, 'debit_msat': 11000000}]
2026-01-29T05:55:58.5492021Z E
2026-01-29T05:55:58.5492767Z E At index 1 diff: {'tag': 'onchain_fee', 'credit_msat': 4927000, 'debit_msat': 0} != {'tag': 'pushed', 'credit_msat': 0, 'debit_msat': 1000000000}
2026-01-29T05:55:58.5493812Z E
2026-01-29T05:55:58.5494078Z E Full diff:
2026-01-29T05:55:58.5494373Z E [
2026-01-29T05:55:58.5494863Z E {
2026-01-29T05:55:58.5495166Z E 'credit_msat': 10000000000,
2026-01-29T05:55:58.5495565Z E 'debit_msat': 0,
2026-01-29T05:55:58.5495946Z E 'tag': 'channel_open',
2026-01-29T05:55:58.5496330Z E - },
2026-01-29T05:55:58.5496613Z E - {
2026-01-29T05:55:58.5496906Z E - 'credit_msat': 0,
2026-01-29T05:55:58.5497285Z E - 'debit_msat': 1000000000,
2026-01-29T05:55:58.5497900Z E - 'tag': 'pushed',
2026-01-29T05:55:58.5498264Z E },
2026-01-29T05:55:58.5498531Z E {
2026-01-29T05:55:58.5498818Z E 'credit_msat': 4927000,
2026-01-29T05:55:58.5499200Z E 'debit_msat': 0,
2026-01-29T05:55:58.5499563Z E 'tag': 'onchain_fee',
2026-01-29T05:55:58.5499925Z E },
2026-01-29T05:55:58.5500190Z E {
2026-01-29T05:55:58.5500477Z E 'credit_msat': 0,
2026-01-29T05:55:58.5500863Z E + 'debit_msat': 1000000000,
2026-01-29T05:55:58.5501255Z E + 'tag': 'pushed',
2026-01-29T05:55:58.5501592Z E + },
2026-01-29T05:55:58.5501853Z E + {
2026-01-29T05:55:58.5502141Z E + 'credit_msat': 0,
2026-01-29T05:55:58.5502511Z E 'debit_msat': 11000000,
2026-01-29T05:55:58.5502889Z E 'tag': 'invoice',
2026-01-29T05:55:58.5503424Z E },
2026-01-29T05:55:58.5503698Z E ]
2026-01-29T05:55:58.5503861Z
2026-01-29T05:55:58.5504027Z tests/test_bookkeeper.py:29: AssertionError
```

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

What changed, and why it matters

This is a test-only change that makes a bookkeeping test accept either of two possible event orderings. It does not change production code, network behavior, or security properties. There is no vulnerability or security fix here.

Recommended action

No security action needed. Treat as a routine test-maintenance commit.

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.