From 0578069a7ad2d5235a135b185920c09cda98d073 Mon Sep 17 00:00:00 2001 From: Jon Griffiths Date: Thu, 22 Feb 2024 10:02:04 +1300 Subject: [PATCH] Revert "core: Defer extracting the script until we're sure we'll use it" See the next commit for context on this revert. This reverts commit d185b0fa907c563276961f08e56994a87ed98614. Signed-off-by: Jon Griffiths --- lightningd/chaintopology.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lightningd/chaintopology.c b/lightningd/chaintopology.c index c71da1146..4b127999b 100644 --- a/lightningd/chaintopology.c +++ b/lightningd/chaintopology.c @@ -965,12 +965,11 @@ static void topo_add_utxos(struct chain_topology *topo, struct block *b) if (!amount_asset_is_main(&amt)) continue; /* Ignore non-policy asset outputs */ - if (!bitcoin_tx_output_script_is_p2wsh(tx, n)) + const u8 *script = bitcoin_tx_output_get_script(tmpctx, tx, n); + if (!is_p2wsh(script, NULL)) continue; /* We only care about p2wsh utxos */ struct bitcoin_outpoint outpoint = { b->txids[i], n }; - const u8 *script = - bitcoin_tx_output_get_script(tmpctx, tx, n); wallet_utxoset_add(topo->ld->wallet, &outpoint, b->height, i, script, amount_asset_to_sat(&amt));