mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 07:04:22 +01:00
tx: Strengthen transaction construction checks
We roll the `elements_add_fee_output` function and the cropping of overallocated arrays into the `bitcoin_tx_finalize` function. This is supposed to be the final cleanup and compaction step before a tx can be sent to bitcoin or passed off to other daemons. This is the cleanup promised in #3491
This commit is contained in:
committed by
Rusty Russell
parent
24aaf73982
commit
42a63e4416
@@ -305,8 +305,8 @@ struct bitcoin_tx *commit_tx(const tal_t *ctx,
|
||||
u32 sequence = (0x80000000 | ((obscured_commitment_number>>24) & 0xFFFFFF));
|
||||
bitcoin_tx_add_input(tx, funding_txid, funding_txout, sequence, funding, NULL);
|
||||
|
||||
elements_tx_add_fee_output(tx);
|
||||
tal_resize(&(tx->output_witscripts), tx->wtx->num_outputs);
|
||||
bitcoin_tx_finalize(tx);
|
||||
assert(bitcoin_tx_check(tx));
|
||||
|
||||
return tx;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user