Skip to content

Commit 9a0b1f6

Browse files
committed
Add fee range TLV
Both sides can optionally include a preferred fee range in their `closing_signed`. This lets their peer know what fees they find acceptable and should simplify negotiation.
1 parent b050092 commit 9a0b1f6

File tree

1 file changed

+25
-8
lines changed

1 file changed

+25
-8
lines changed

02-peer-protocol.md

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,14 @@ the channel.
547547
* [`channel_id`:`channel_id`]
548548
* [`u64`:`fee_satoshis`]
549549
* [`signature`:`signature`]
550+
* [`closing_signed_tlvs`:`tlvs`]
551+
552+
1. `tlv_stream`: `closing_signed_tlvs`
553+
2. types:
554+
1. type: 1 (`fee_range`)
555+
2. data:
556+
* [`u64`:`min_fee_satoshis`]
557+
* [`u64`:`max_fee_satoshis`]
550558

551559
#### Requirements
552560

@@ -560,6 +568,8 @@ The sending node:
560568
commitment transaction, as calculated in [BOLT #3](03-transactions.md#fee-calculation).
561569
- SHOULD set the initial `fee_satoshis` according to its estimate of cost of
562570
inclusion in a block.
571+
- SHOULD set `fee_range` according to the minimum and maximum fees it is
572+
prepared to pay for a close transaction.
563573
- MUST set `signature` to the Bitcoin signature of the close transaction,
564574
as specified in [BOLT #3](03-transactions.md#closing-transaction).
565575

@@ -570,25 +580,32 @@ The receiving node:
570580
- if `fee_satoshis` is equal to its previously sent `fee_satoshis`:
571581
- SHOULD sign and broadcast the final closing transaction.
572582
- MAY close the connection.
583+
- if `fee_satoshis` matches its previously sent `fee_range`:
584+
- SHOULD use `fee_satoshis` to sign and broadcast the final closing transaction
585+
- MAY close the connection.
573586
- otherwise, if `fee_satoshis` is greater than the base fee of the final
574587
commitment transaction as calculated in [BOLT #3](03-transactions.md#fee-calculation)
575588
and the channel does not use `option_anchor_outputs`:
576589
- MUST fail the connection.
577-
- if `fee_satoshis` is not strictly
578-
between its last-sent `fee_satoshis` and its previously-received
579-
`fee_satoshis`, UNLESS it has since reconnected:
590+
- if the message contains a `fee_range`:
591+
- if it disagrees with that `fee_range`:
592+
- SHOULD fail the connection
593+
- otherwise:
594+
- MUST propose a `fee_satoshis` in that range
595+
- otherwise, if `fee_satoshis` is not strictly between its last-sent `fee_satoshis`
596+
and its previously-received `fee_satoshis`, UNLESS it has since reconnected:
580597
- SHOULD fail the connection.
581-
- if the receiver agrees with the fee:
598+
- otherwise, if the receiver agrees with the fee:
582599
- SHOULD reply with a `closing_signed` with the same `fee_satoshis` value.
583600
- otherwise:
584601
- MUST propose a value "strictly between" the received `fee_satoshis`
585-
and its previously-sent `fee_satoshis`.
602+
and its previously-sent `fee_satoshis`.
586603

587604
#### Rationale
588605

589-
The "strictly between" requirement ensures that forward
590-
progress is made, even if only by a single satoshi at a time. To avoid
591-
keeping state and to handle the corner case, where fees have shifted
606+
When `fee_range` is not provided, the "strictly between" requirement ensures
607+
that forward progress is made, even if only by a single satoshi at a time.
608+
To avoid keeping state and to handle the corner case, where fees have shifted
592609
between disconnection and reconnection, negotiation restarts on reconnection.
593610

594611
Note there is limited risk if the closing transaction is

0 commit comments

Comments
 (0)