mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-06 07:34:21 +01:00
bitcoin/tx.c: don't free witness implicitly.
This causes a crash in mkfunding, which didn't expect it:
$ devtools/mkfunding 16835ac8c154b616baac524163f41fb0c4f82c7b972ad35d4d6f18d854f6856b 1 0.01btc 253 76edf0c303b9e692da9cb491abedef46ca5b81d32f102eb4648461b239cb0f99 0000000000000000000000000000000000000000000000000000000000000010 0000000000000000000000000000000000000000000000000000000000000020
# funding sig: 798d96d5a057b5b7797988a855217f41af05ece3ba8278366e2f69763c72e78565d5dd7eeddc0766ddf65557c92b9c52c301f23f94d2cf681860d32153e6ae1e
# funding witnesses: [
Aborted (core dumped)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -368,7 +368,7 @@ static struct bitcoin_tx *tx_to_us(const tal_t *ctx,
|
||||
|
||||
witness = bitcoin_witness_sig_and_element(tx, &sig, elem,
|
||||
elemsize, wscript);
|
||||
bitcoin_tx_input_set_witness(tx, 0, witness);
|
||||
bitcoin_tx_input_set_witness(tx, 0, take(witness));
|
||||
return tx;
|
||||
}
|
||||
|
||||
@@ -1277,7 +1277,7 @@ static void handle_preimage(const struct chainparams *chainparams,
|
||||
witness = bitcoin_witness_htlc_success_tx(
|
||||
tx, &sig, outs[i]->remote_htlc_sig, preimage,
|
||||
outs[i]->wscript);
|
||||
bitcoin_tx_input_set_witness(tx, 0, witness);
|
||||
bitcoin_tx_input_set_witness(tx, 0, take(witness));
|
||||
propose_resolution(outs[i], tx, 0, OUR_HTLC_SUCCESS_TX);
|
||||
} else {
|
||||
enum tx_type tx_type = THEIR_HTLC_FULFILL_TO_US;
|
||||
@@ -1530,7 +1530,7 @@ static size_t resolve_our_htlc_ourcommit(const struct chainparams *chainparams,
|
||||
out->remote_htlc_sig,
|
||||
htlc_scripts[matches[i]]);
|
||||
|
||||
bitcoin_tx_input_set_witness(tx, 0, witness);
|
||||
bitcoin_tx_input_set_witness(tx, 0, take(witness));
|
||||
|
||||
/* Steals tx onto out */
|
||||
propose_resolution_at_block(out, tx, htlcs[matches[i]].cltv_expiry,
|
||||
|
||||
Reference in New Issue
Block a user