mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-19 05:44:12 +01:00
onchaind: fix minor leaks.
Not actually leaks, but they do live longer than they need. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
c5b424b6ce
commit
f0ea4d60b9
@ -59,7 +59,7 @@ done:
|
|||||||
}
|
}
|
||||||
|
|
||||||
int bitcoin_tx_add_output(struct bitcoin_tx *tx, const u8 *script,
|
int bitcoin_tx_add_output(struct bitcoin_tx *tx, const u8 *script,
|
||||||
u8 *wscript, struct amount_sat amount)
|
const u8 *wscript, struct amount_sat amount)
|
||||||
{
|
{
|
||||||
size_t i = tx->wtx->num_outputs;
|
size_t i = tx->wtx->num_outputs;
|
||||||
struct wally_tx_output *output;
|
struct wally_tx_output *output;
|
||||||
@ -197,7 +197,7 @@ int bitcoin_tx_add_input(struct bitcoin_tx *tx,
|
|||||||
input_wscript, NULL);
|
input_wscript, NULL);
|
||||||
|
|
||||||
if (input_wscript) {
|
if (input_wscript) {
|
||||||
scriptPubkey = scriptpubkey_p2wsh(tx->psbt, input_wscript);
|
scriptPubkey = scriptpubkey_p2wsh(tmpctx, input_wscript);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(scriptPubkey);
|
assert(scriptPubkey);
|
||||||
|
@ -97,7 +97,7 @@ struct wally_tx_output *wally_tx_output(const tal_t *ctx,
|
|||||||
|
|
||||||
/* Add one output to tx. */
|
/* Add one output to tx. */
|
||||||
int bitcoin_tx_add_output(struct bitcoin_tx *tx, const u8 *script,
|
int bitcoin_tx_add_output(struct bitcoin_tx *tx, const u8 *script,
|
||||||
u8 *wscript,
|
const u8 *wscript,
|
||||||
struct amount_sat amount);
|
struct amount_sat amount);
|
||||||
|
|
||||||
/* Set the locktime for a transaction */
|
/* Set the locktime for a transaction */
|
||||||
|
@ -62,7 +62,7 @@ static struct bitcoin_tx *htlc_tx(const tal_t *ctx,
|
|||||||
|
|
||||||
wscript = bitcoin_wscript_htlc_tx(tx, to_self_delay, revocation_pubkey,
|
wscript = bitcoin_wscript_htlc_tx(tx, to_self_delay, revocation_pubkey,
|
||||||
local_delayedkey);
|
local_delayedkey);
|
||||||
bitcoin_tx_add_output(tx, scriptpubkey_p2wsh(tx, wscript),
|
bitcoin_tx_add_output(tx, scriptpubkey_p2wsh(tmpctx, wscript),
|
||||||
wscript, amount);
|
wscript, amount);
|
||||||
|
|
||||||
bitcoin_tx_finalize(tx);
|
bitcoin_tx_finalize(tx);
|
||||||
|
@ -592,7 +592,7 @@ static struct bitcoin_tx *tx_to_us(const tal_t *ctx,
|
|||||||
NULL, out->sat, NULL, wscript);
|
NULL, out->sat, NULL, wscript);
|
||||||
|
|
||||||
bitcoin_tx_add_output(
|
bitcoin_tx_add_output(
|
||||||
tx, scriptpubkey_p2wpkh(tx, &our_wallet_pubkey), NULL, out->sat);
|
tx, scriptpubkey_p2wpkh(tmpctx, &our_wallet_pubkey), NULL, out->sat);
|
||||||
|
|
||||||
/* Worst-case sig is 73 bytes */
|
/* Worst-case sig is 73 bytes */
|
||||||
weight = bitcoin_tx_weight(tx) + 1 + 3 + 73 + 0 + tal_count(wscript);
|
weight = bitcoin_tx_weight(tx) + 1 + 3 + 73 + 0 + tal_count(wscript);
|
||||||
|
Loading…
Reference in New Issue
Block a user