Skip to content

Commit 22f7a62

Browse files
committed
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 <[email protected]> Changelog-Fixed: lightningd: potential crash on startup if bitcoind isn't up-to-date.
1 parent b270d91 commit 22f7a62

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lightningd/chaintopology.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1528,6 +1528,14 @@ static void fixup_scan_block(struct bitcoind *bitcoind,
15281528
struct bitcoin_block *blk,
15291529
struct chain_topology *topo)
15301530
{
1531+
/* Can't scan the block? We will try again next restart */
1532+
if (!blk) {
1533+
log_unusual(topo->ld->log,
1534+
"fixup_scan: could not load block %u, will retry next restart",
1535+
height);
1536+
return;
1537+
}
1538+
15311539
log_debug(topo->ld->log, "fixup_scan: block %u with %zu txs", height, tal_count(blk->tx));
15321540
topo_update_spends(topo, blk->tx, blk->txids, height);
15331541

0 commit comments

Comments
 (0)