Skip to content

Commit

Permalink
BOLT 7: correct the default min_final_cltv_expiry_delta in routing …
Browse files Browse the repository at this point in the history
…example (#1143)
  • Loading branch information
trigger67 committed Feb 22, 2024
1 parent 8fc3ba9 commit 60de4a0
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions 07-routing-gossip.md
Original file line number Diff line number Diff line change
Expand Up @@ -1069,7 +1069,7 @@ channel:
3. C: 30 blocks
4. D: 40 blocks

C also uses a `min_final_cltv_expiry_delta` of 9 (the default) when requesting
C also uses a `min_final_cltv_expiry_delta` of 18 (the default) when requesting
payments.

Also, each node has a set fee scheme that it uses for each of its
Expand All @@ -1093,16 +1093,16 @@ The network will see eight `channel_update` messages:

**B->C.** If B were to send 4,999,999 millisatoshi directly to C, it would
neither charge itself a fee nor add its own `cltv_expiry_delta`, so it would
use C's requested `min_final_cltv_expiry_delta` of 9. Presumably it would also add a
use C's requested `min_final_cltv_expiry_delta` of 18. Presumably it would also add a
_shadow route_ to give an extra CLTV of 42. Additionally, it could add extra
CLTV deltas at other hops, as these values represent a minimum, but chooses not
to do so here, for the sake of simplicity:

* `amount_msat`: 4999999
* `cltv_expiry`: current-block-height + 9 + 42
* `cltv_expiry`: current-block-height + 18 + 42
* `onion_routing_packet`:
* `amt_to_forward` = 4999999
* `outgoing_cltv_value` = current-block-height + 9 + 42
* `outgoing_cltv_value` = current-block-height + 18 + 42

**A->B->C.** If A were to send 4,999,999 millisatoshi to C via B, it needs to
pay B the fee it specified in the B->C `channel_update`, calculated as
Expand All @@ -1113,25 +1113,25 @@ per [HTLC Fees](#htlc-fees):
200 + ( 4999999 * 2000 / 1000000 ) = 10199

Similarly, it would need to add B->C's `channel_update` `cltv_expiry_delta` (20), C's
requested `min_final_cltv_expiry_delta` (9), and the cost for the _shadow route_ (42).
requested `min_final_cltv_expiry_delta` (18), and the cost for the _shadow route_ (42).
Thus, A->B's `update_add_htlc` message would be:

* `amount_msat`: 5010198
* `cltv_expiry`: current-block-height + 20 + 9 + 42
* `cltv_expiry`: current-block-height + 20 + 18 + 42
* `onion_routing_packet`:
* `amt_to_forward` = 4999999
* `outgoing_cltv_value` = current-block-height + 9 + 42
* `outgoing_cltv_value` = current-block-height + 18 + 42

B->C's `update_add_htlc` would be the same as B->C's direct payment above.

**A->D->C.** Finally, if for some reason A chose the more expensive route via D,
A->D's `update_add_htlc` message would be:

* `amount_msat`: 5020398
* `cltv_expiry`: current-block-height + 40 + 9 + 42
* `cltv_expiry`: current-block-height + 40 + 18 + 42
* `onion_routing_packet`:
* `amt_to_forward` = 4999999
* `outgoing_cltv_value` = current-block-height + 9 + 42
* `outgoing_cltv_value` = current-block-height + 18 + 42

And D->C's `update_add_htlc` would again be the same as B->C's direct payment
above.
Expand Down

0 comments on commit 60de4a0

Please sign in to comment.