From 38c5e56e34107c21b2e6e184ce78955890860ed0 Mon Sep 17 00:00:00 2001 From: Schnema1 Date: Sun, 29 Mar 2026 20:06:35 +0000 Subject: [PATCH] bitcoin/block.c: add null check after pull_bitcoin_tx_only Commit 40dd780ea switched from pull_bitcoin_tx to pull_bitcoin_tx_only but did not add a null check, causing a segfault (FATAL SIGNAL 11) if pull_bitcoin_tx_only returns NULL due to a malformed block response from bitcoind. Add null check consistent with existing patterns in the codebase and with pull_bitcoin_tx itself. Fixes: 40dd780ea bitcoin_block_from_hex: avoid creating PSBT wrappers for finalized block txs --- bitcoin/block.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bitcoin/block.c b/bitcoin/block.c index 5a36a7dfc890..50c6cdf69c23 100644 --- a/bitcoin/block.c +++ b/bitcoin/block.c @@ -210,6 +210,8 @@ bitcoin_block_from_hex(const tal_t *ctx, const struct chainparams *chainparams, b->txids = tal_arr(b, struct bitcoin_txid, num); for (i = 0; i < num; i++) { b->tx[i] = pull_bitcoin_tx_only(b->tx, &p, &len); + if (!b->tx[i]) + return tal_free(b); b->tx[i]->chainparams = chainparams; bitcoin_txid(b->tx[i], &b->txids[i]); }