1
0
mirror of https://github.com/lightning/bolts.git synced 2024-11-19 10:00:04 +01:00

v2 opens: proposal to get rid of the minimum estimated fee

Prior versions of the v2 dual-funding protocol assumed a 'minimum fee'
payment for any witness stack of any input, as a way to simplify fee
checks.

The suggested min feerate didn't make sense for taproot spend paths etc;
instead we remove this check entirely.
This commit is contained in:
niftynei 2022-12-16 14:00:57 -06:00 committed by neil saitug
parent cf9a5fcfe5
commit 0bc22790ea
2 changed files with 2 additions and 59 deletions

View File

@ -211,6 +211,7 @@ The sending node:
- MUST send even `serial_id`s
- if is the *non-initiator*:
- MUST send odd `serial_id`s
- MUST provide a best estimate for the weight of the witness for this input
The receiving node:
- MUST add all received inputs to the transaction
@ -411,7 +412,7 @@ prefixed with its length (since it is already specified in the `len` field).
While the `minimum fee` is calculated and verified at `tx_complete` conclusion,
it is possible for the fee for the exchanged witness data to be underpaid.
It is the responsibility of the sending peer to correctly account for the
required fee, e.g. a multisig witness stack whose weight exceeds 107.
required fee.
### The `tx_init_rbf` Message

View File

@ -873,64 +873,6 @@ Multiplying non-witness data by 4 results in a weight of:
overall_weight = funding_transaction_weight + witness_weight
### Calculating Fees for Collaborative Transaction Construction
Every participant in a collaborative transaction covers the fees for
their own inputs and outputs. The initiator also provides funds to
cover for the common transaction fields.
Upon successful exchange of `tx_complete` messages, each peer must at
least cover a minimum estimated fee. Here is how to calculate the minimum
fee for each participant.
The minimum witness weight for an input is 107.
In the following, the initiator has provided one input (P2WPKH), one change output
(P2WPKH), and the funding output. The contributor has provided two
inputs (P2WPKH) and two change outputs (P2WPKH).
Assuming a `feerate` of 253 per kiloweight, the initiator's minimum fee is
calculated as follows. Note that the feerate is rounded up to the nearest satoshi.
initiator_weight = transaction_fields * 4
+ segwit_fields
+ p2wpkh_input * 4
+ funding_output * 4
+ p2wpkh_output * 4
+ input_count * 107 (minimum witness weight)
initiator_weight = 10 * 4
+ 2
+ 41 * 4
+ 43 * 4
+ 31 * 4
+ 107
initiator_weight = 609
initiator_fees = initiator_weight * feerate
initiator_fees = 609 * 253 / 1000
initiator_fees = 155 sats
The contributor's minimum fee is calculated as follows.
contributor_weight = 2 * p2wpkh_input * 4
+ 2 * p2wpkh_output * 4
+ input_count * 107 (minimum witness weight)
contributor_weight = 2 * 41 * 4
+ 2 * 31 * 4
+ 2 * 107
contributor_weight = 790
contributor_fees = contributor_weight * feerate
contributor_fees = 790 * 253 / 1000
contributor_fees = 200 sats
This is an estimated fee. The peer MUST at least contribute the estimated fee,
and MUST exceed the minimum fee in the case that their witness weight is greater
than the estimated weight of 107 per input.
## Expected Weight of the Commitment Transaction