diff --git a/wallet/wallet.c b/wallet/wallet.c index f102c6bf6..fb4321349 100644 --- a/wallet/wallet.c +++ b/wallet/wallet.c @@ -378,9 +378,13 @@ static const struct utxo **wallet_select(const tal_t *ctx, struct wallet *w, 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). */ + * is prefixed by a version (1 byte), an empty nonce (1 + * byte), two empty proofs (2 bytes). */ weight += (32 + 1 + 1 + 1) * 4 * num_outputs; + + /* An elements transaction has 1 additional output for fees */ + weight += (8 + 1) * 4; /* Bitcoin style output */ + weight += (32 + 1 + 1 + 1) * 4; /* Elements added fields */ } *fee_estimate = AMOUNT_SAT(0); @@ -420,6 +424,10 @@ static const struct utxo **wallet_select(const tal_t *ctx, struct wallet *w, /* Account for witness (1 byte count + sig + key) */ input_weight += 1 + (1 + 73 + 1 + 33); + /* Elements inputs have 6 bytes of blank proofs attached. */ + if (is_elements) + input_weight += 6; + weight += input_weight; if (!amount_sat_add(satoshi_in, *satoshi_in, u->amount))