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

lightningd: fix crash on fixup scan if block unavailable.

Public commit record

What the developer wrote

Authored by Rusty Russell

83/100 · Strong
lightningd: fix crash on fixup scan if block unavailable.

```
lightningd: FATAL SIGNAL 11 (version v25.12rc3-1-g498c5b6)
0x5cc2f620ce4c send_backtrace
common/daemon.c:38
0x5cc2f620cee8 crashdump
common/daemon.c:83
0x7e3ac1e4532f ???
./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
0x5cc2f615f186 fixup_scan_block
lightningd/chaintopology.c:1531
0x5cc2f615c22c getrawblockbyheight_callback
lightningd/bitcoind.c:484
0x5cc2f61aee87 plugin_response_handle
lightningd/plugin.c:701
0x5cc2f61b4043 plugin_read_json
lightningd/plugin.c:790
0x5cc2f6248d8b next_plan
ccan/ccan/io/io.c:60
0x5cc2f624925c do_plan
ccan/ccan/io/io.c:422
0x5cc2f6249319 io_ready
ccan/ccan/io/io.c:439
0x5cc2f624ad24 io_loop
ccan/ccan/io/poll.c:470
0x5cc2f618381a io_loop_with_timers
lightningd/io_loop_with_timers.c:22
0x5cc2f61892ff main
```

This happens intermittantly on in a few tests:

tests/test_invoices.py::test_invoice_botched_migration
tests/test_pay.py::test_pay_bolt11_metadata
tests/test_runes.py::test_id_migration

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Fixed: lightningd: potential crash on startup if bitcoind isn't up-to-date.
✓ 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 commit fixes a bug where Core Lightning could crash with a segmentation fault (FATAL SIGNAL 11) during startup if the connected Bitcoin node could not provide a requested block. The crash occurred because a function tried to use a block that was not actually loaded. The fix adds a simple check: if the block is missing, log a warning and try again on the next restart instead of crashing.

Recommended action

Apply the patch. It is a small, safe defensive fix. Operators should also ensure their bitcoind is fully synced before starting lightningd to avoid the retry-on-restart loop.

Security signals we found

01

NULL pointer dereference (SIGSEGV) in startup code path

02

Crash triggered by missing block data from external Bitcoin backend

03

Fix adds defensive NULL check in asynchronous callback

04

Changelog labels this as a fixed potential crash on startup

Risk score

Why this scored 54/100

Our methodology →
Potential impact 18/30
Exploitability 8/25
Stealth signal 6/15
Affected reach 10/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.