mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 05:12:45 +01:00
elements: Compute correct weight in wallet_select for elements TXs
They are a bit larger, so account for that. Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
parent
d89962213c
commit
17af57e504
@ -354,6 +354,7 @@ static const struct utxo **wallet_select(const tal_t *ctx, struct wallet *w,
|
||||
size_t i = 0;
|
||||
struct utxo **available;
|
||||
u64 weight;
|
||||
size_t num_outputs = may_have_change ? 2 : 1;
|
||||
const struct utxo **utxos = tal_arr(ctx, const struct utxo *, 0);
|
||||
tal_add_destructor2(utxos, destroy_utxos, w);
|
||||
|
||||
@ -370,6 +371,18 @@ static const struct utxo **wallet_select(const tal_t *ctx, struct wallet *w,
|
||||
if (may_have_change)
|
||||
weight += (8 + 1 + BITCOIN_SCRIPTPUBKEY_P2WPKH_LEN) * 4;
|
||||
|
||||
/* A couple of things need to change for elements: */
|
||||
if (is_elements) {
|
||||
/* Each transaction has surjection and rangeproof (both empty
|
||||
* for us as long as we use unblinded L-BTC transactions). */
|
||||
weight += 2 * 4;
|
||||
|
||||
/* Each output additionally has an asset_tag (1 + 32), value
|
||||
* is prefixed by a version (1 byte) and an empty nonce (1
|
||||
* byte). */
|
||||
weight += (32 + 1 + 1 + 1) * 4 * num_outputs;
|
||||
}
|
||||
|
||||
*fee_estimate = AMOUNT_SAT(0);
|
||||
*satoshi_in = AMOUNT_SAT(0);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user