mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-24 09:34:24 +01:00
bitcoin/tx: check PSBT sanity after parsing
We could end up handing a valid tx containing a NULL PSBT around. Signed-off-by: Antoine Poinsot <darosior@protonmail.com>
This commit is contained in:
committed by
Rusty Russell
parent
225fec065a
commit
08d32123d8
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user