Skip to content

Commit 27fbed0

Browse files
committed
Bolt7: add channel update flag for scid alias
Since lightning#910, nodes are allowed to use aliases instead of real scids. It is helpful to be explicit about it and set a flag in `channel_update` when an alias is used instead of a real scid. We also make the `htlc_maximum_msat` field mandatory: every node on the network currently sets it, so we can simplify the spec.
1 parent bc86304 commit 27fbed0

File tree

1 file changed

+21
-33
lines changed

1 file changed

+21
-33
lines changed

07-routing-gossip.md

Lines changed: 21 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ of *relaying* payments, not *sending* payments. When making a payment
413413
* [`u64`:`htlc_minimum_msat`]
414414
* [`u32`:`fee_base_msat`]
415415
* [`u32`:`fee_proportional_millionths`]
416-
* [`u64`:`htlc_maximum_msat`] (option_channel_htlc_max)
416+
* [`u64`:`htlc_maximum_msat`]
417417

418418
The `channel_flags` bitfield is used to indicate the direction of the channel: it
419419
identifies the node that this update originated from and signals various options
@@ -425,18 +425,13 @@ individual bits:
425425
| 0 | `direction` | Direction this update refers to. |
426426
| 1 | `disable` | Disable the channel. |
427427

428-
The `message_flags` bitfield is used to indicate the presence of optional
429-
fields in the `channel_update` message:
428+
The `message_flags` bitfield is used to provide additional details about how to
429+
interpret some of the message fields:
430430

431431
| Bit Position | Name | Field |
432432
| ------------- | ------------------------- | -------------------------------- |
433-
| 0 | `option_channel_htlc_max` | `htlc_maximum_msat` |
434-
435-
Note that the `htlc_maximum_msat` field is static in the current
436-
protocol over the life of the channel: it is *not* designed to be
437-
indicative of real-time channel capacity in each direction, which
438-
would be both a massive data leak and uselessly spam the network (it
439-
takes an average of 30 seconds for gossip to propagate each hop).
433+
| 0 | `must_be_one` | |
434+
| 1 | `scid_alias` | `short_channel_id` |
440435

441436
The `node_id` for the signature verification is taken from the corresponding
442437
`channel_announcement`: `node_id_1` if the least-significant bit of flags is 0
@@ -450,7 +445,11 @@ The origin node:
450445
channel peer, even though the channel has not yet been announced (i.e. the
451446
`announce_channel` bit was not set).
452447
- MUST set the `short_channel_id` to either an `alias` it has
453-
received from the peer, or the real channel `short_channel_id`.
448+
received from the peer, or the real channel `short_channel_id`.
449+
- if it sets `short_channel_id` to an `alias`:
450+
- MUST set `scid_alias` to 1 in `message_flags`
451+
- otherwise:
452+
- MUST set `scid_alias` to 0 in `message_flags`
454453
- MUST NOT forward such a `channel_update` to other peers, for privacy
455454
reasons.
456455
- Note: such a `channel_update`, one not preceded by a
@@ -464,15 +463,8 @@ The origin node:
464463
- MUST set the `direction` bit of `channel_flags` to 0.
465464
- otherwise:
466465
- MUST set the `direction` bit of `channel_flags` to 1.
467-
- if the `htlc_maximum_msat` field is present:
468-
- MUST set the `option_channel_htlc_max` bit of `message_flags` to 1.
469-
- MUST set `htlc_maximum_msat` to the maximum value it will send through this channel for a single HTLC.
470-
- MUST set this to less than or equal to the channel capacity.
471-
- MUST set this to less than or equal to `max_htlc_value_in_flight_msat`
472-
it received from the peer.
473-
- otherwise:
474-
- MUST set the `option_channel_htlc_max` bit of `message_flags` to 0.
475-
- MUST set bits in `channel_flags` and `message_flags `that are not assigned a meaning to 0.
466+
- MUST set `must_be_one` in `message_flags` to 1.
467+
- MUST set bits in `channel_flags` and `message_flags` that are not assigned a meaning to 0.
476468
- MAY create and send a `channel_update` with the `disable` bit set to 1, to
477469
signal a channel's temporary unavailability (e.g. due to a loss of
478470
connectivity) OR permanent unavailability (e.g. prior to an on-chain
@@ -523,14 +515,11 @@ The receiving node:
523515
- otherwise:
524516
- SHOULD queue the message for rebroadcasting.
525517
- MAY choose NOT to for messages longer than the minimum expected length.
526-
- if the `option_channel_htlc_max` bit of `message_flags` is 0:
527-
- MUST consider `htlc_maximum_msat` not to be present.
518+
- if `htlc_maximum_msat` is greater than channel capacity:
519+
- MAY blacklist this `node_id`
520+
- SHOULD ignore this channel during route considerations.
528521
- otherwise:
529-
- if `htlc_maximum_msat` is not present or greater than channel capacity:
530-
- MAY blacklist this `node_id`
531-
- SHOULD ignore this channel during route considerations.
532-
- otherwise:
533-
- SHOULD consider the `htlc_maximum_msat` when routing.
522+
- SHOULD consider the `htlc_maximum_msat` when routing.
534523

535524
### Rationale
536525

@@ -551,12 +540,6 @@ message can rebroadcast it just by changing the `s` component of signature with
551540
This should however not result in the blacklist of the `node_id` from where
552541
the message originated.
553542

554-
The explicit `option_channel_htlc_max` flag to indicate the presence
555-
of `htlc_maximum_msat` (rather than having `htlc_maximum_msat` implied
556-
by the message length) allows us to extend the `channel_update`
557-
with different fields in future. Since channels are limited to 2^32-1
558-
millisatoshis in Bitcoin, the `htlc_maximum_msat` has the same restriction.
559-
560543
The recommendation against redundant `channel_update`s minimizes spamming the network,
561544
however it is sometimes inevitable. For example, a channel with a
562545
peer which is unreachable will eventually cause a `channel_update` to
@@ -565,6 +548,11 @@ the channel when the peer reestablishes contact. Because gossip
565548
messages are batched and replace previous ones, the result may be a
566549
single seemingly-redundant update.
567550

551+
The `must_be_one` field field in `message_flags` was previously used to
552+
indicate the presence of the `htlc_maximum_msat` field. This field must
553+
now always be present, so `must_be_one` is a constant value, and ignored
554+
by receivers.
555+
568556
## Query Messages
569557

570558
Negotiating the `gossip_queries` option via `init` enables a number

0 commit comments

Comments
 (0)