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

bookkeeper: fix restoration of derived wallet blockheights on restart.

Public commit record

What the developer wrote

Authored by Rusty Russell

73/100 · Adequate
bookkeeper: fix restoration of derived wallet blockheights on restart.

We complain:
```
lightningd-1 2025-10-31T00:55:00.377Z **BROKEN** plugin-bookkeeper: Unparsable blockheight datastore entry: {"key":["bookkeeper","blockheights","756999f870a7a7c97f5c143f12b9096a50d1b1acd74aeb9ab2dc251a5c361494"],"generation":0,"hex":"00000067"}
```

And we don't have the blockheight:

```
{
'account': 'external',
- 'blockheight': 103,
? - -
+ 'blockheight': 0,
'credit_msat': 555555000,
'currency': 'bcrt',
'debit_msat': 0,
'origin': 'wallet',
'outpoint': '756999f870a7a7c97f5c143f12b9096a50d1b1acd74aeb9ab2dc251a5c361494:0',
'tag': 'deposit',
'timestamp': 1761872097,
'type': 'chain',
},
```

Reported-by: @michael1011
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Fixed: Plugins: `bookkeeper` now correctly restores chain event blockheights it has derived.
✓ 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 bookkeeping bug in Core Lightning's bookkeeper plugin. On restart, the plugin was reading the wrong part of a stored data key when trying to restore transaction block heights, causing it to log a 'BROKEN' error and set block heights to 0. The fix is a one-line change correcting an array index offset. It is a data-integrity/functional bug, not an exploitable security vulnerability.

Recommended action

Treat as a routine bug fix. Apply the patch to restore correct blockheight accounting on node restart. No emergency security response is warranted. Users relying on bookkeeper income reports should upgrade to avoid incorrect blockheight/time-based reporting.

Security signals we found

01

BROKEN log emitted due to malformed datastore parsing

02

Off-by-one index in JSON key parsing

03

Data integrity issue: derived blockheights reset to 0 on restart

04

No memory corruption, authentication bypass, or cryptographic weakness evident

Risk score

Why this scored 21/100

Our methodology →
Potential impact 4/30
Exploitability 0/25
Stealth signal 2/15
Affected reach 3/15
Confidence 8/10
Evidence quality 4/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.