diff --git a/bitcoin/tx.c b/bitcoin/tx.c index c7ffe12ee..01e723caa 100644 --- a/bitcoin/tx.c +++ b/bitcoin/tx.c @@ -595,6 +595,8 @@ struct bitcoin_tx *pull_bitcoin_tx(const tal_t *ctx, const u8 **cursor, tal_add_destructor(tx, bitcoin_tx_destroy); tx->chainparams = chainparams; tx->psbt = new_psbt(tx, tx->wtx); + if (!tx->psbt) + return tal_free(tx); return tx; } @@ -710,6 +712,8 @@ struct bitcoin_tx *fromwire_bitcoin_tx(const tal_t *ctx, /* pull_bitcoin_tx sets the psbt */ tal_free(tx->psbt); tx->psbt = fromwire_wally_psbt(tx, cursor, max); + if (!tx->psbt) + return fromwire_fail(cursor, max); return tx; }