mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-21 22:31:48 +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:
parent
225fec065a
commit
08d32123d8
1 changed files with 4 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue