mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 05:12:45 +01:00
elements: Add explicit fee outputs to various transactions we create
Elements requires us to have an explicit fee output instead of bitcoin's implied fee. We add the fee output mostly after sorting the other outputs since that matches the behavior in elements itself. Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
parent
cd93a855ce
commit
b356dda0ba
@ -289,5 +289,7 @@ 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);
|
||||
|
||||
bitcoin_tx_add_fee_output(tx);
|
||||
|
||||
return tx;
|
||||
}
|
||||
|
@ -61,6 +61,8 @@ struct bitcoin_tx *create_close_tx(const tal_t *ctx,
|
||||
return tal_free(tx);
|
||||
|
||||
permute_outputs(tx, NULL, NULL);
|
||||
bitcoin_tx_add_fee_output(tx);
|
||||
|
||||
assert(bitcoin_tx_check(tx));
|
||||
return tx;
|
||||
}
|
||||
|
@ -48,6 +48,8 @@ struct bitcoin_tx *funding_tx(const tal_t *ctx,
|
||||
}
|
||||
|
||||
permute_inputs(tx, (const void **)utxomap);
|
||||
|
||||
bitcoin_tx_add_fee_output(tx);
|
||||
assert(bitcoin_tx_check(tx));
|
||||
return tx;
|
||||
}
|
||||
|
@ -63,6 +63,8 @@ static struct bitcoin_tx *htlc_tx(const tal_t *ctx,
|
||||
wscript = bitcoin_wscript_htlc_tx(tx, to_self_delay, revocation_pubkey,
|
||||
local_delayedkey);
|
||||
bitcoin_tx_add_output(tx, scriptpubkey_p2wsh(tx, wscript), amount);
|
||||
bitcoin_tx_add_fee_output(tx);
|
||||
|
||||
tal_free(wscript);
|
||||
|
||||
return tx;
|
||||
|
@ -238,6 +238,7 @@ struct bitcoin_tx *initial_commit_tx(const tal_t *ctx,
|
||||
sequence = (0x80000000 | ((obscured_commitment_number>>24) & 0xFFFFFF));
|
||||
bitcoin_tx_add_input(tx, funding_txid, funding_txout, sequence, funding, NULL);
|
||||
|
||||
bitcoin_tx_add_fee_output(tx);
|
||||
assert(bitcoin_tx_check(tx));
|
||||
|
||||
return tx;
|
||||
|
@ -38,6 +38,7 @@ struct bitcoin_tx *withdraw_tx(const tal_t *ctx,
|
||||
} else if (change_outnum)
|
||||
*change_outnum = -1;
|
||||
permute_inputs(tx, (const void **)utxos);
|
||||
bitcoin_tx_add_fee_output(tx);
|
||||
assert(bitcoin_tx_check(tx));
|
||||
return tx;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user