mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 01:43:36 +01:00
fromwire_bitcoin_tx: avoid creating a PSBT wrapper just to throw it away again
Changelog-None Signed-off-by: Jon Griffiths <jon_p_griffiths@yahoo.com>
This commit is contained in:
parent
1b37515528
commit
cdb5de0bce
@ -794,15 +794,13 @@ struct bitcoin_tx *fromwire_bitcoin_tx(const tal_t *ctx,
|
||||
|
||||
u32 len = fromwire_u32(cursor, max);
|
||||
size_t start = *max;
|
||||
tx = pull_bitcoin_tx(ctx, cursor, max);
|
||||
tx = pull_bitcoin_tx_only(ctx, cursor, max);
|
||||
if (!tx)
|
||||
return fromwire_fail(cursor, max);
|
||||
// Check that we consumed len bytes
|
||||
if (start - *max != len)
|
||||
return fromwire_fail(cursor, max);
|
||||
|
||||
/* 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);
|
||||
|
Loading…
Reference in New Issue
Block a user