You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is the simplest upgrade mechanism I could come up with. It's
ready for option_anchors_zero_fee_htlc_tx, too.
Signed-off-by: Rusty Russell <[email protected]>
- MUST set the channel features which currently apply to the channel.
1441
+
- if it sets `upgrades_available`
1442
+
- MUST set `channel_features`
1443
+
- MUST set it to a set of channel features not in `channel_features`.
1444
+
- if it sets `upgrades_wanted`:
1445
+
- MUST set it to a single channel feature NOT in `channel_features`, plus any required features which are also not in `channel_features`.
1446
+
- MUST NOT set any bits not in `upgrades_available`.
1447
+
1448
+
A node receiving `channel_reestablish`:
1449
+
- if `channel_features` has more bits set than the sent `channel_features`:
1450
+
- if the additional bits are not in the sent `upgrades_available`:
1451
+
- MUST fail the upgrade
1452
+
- otherwise:
1453
+
- MUST consider the received `channel_features` as the current features of the channel.
1454
+
- otherwise, if `channel_features` has fewer bits set than the sent `channel_features`:
1455
+
- if the missing bits are not in the sent `upgrades_available`:
1456
+
- MUST fail the upgrade
1457
+
- otherwise:
1458
+
- MUST consider the sent `channel_features` as the current features of the channel.
1459
+
- if either peer sets a bit in `upgrades_wanted` which is also in both peers' `upgrades_available`:
1460
+
- if `channel_features` modified by `upgrades_wanted` does not have required features:
1461
+
- MUST fail the upgrade.
1462
+
- MUST send `update_upgrade` with the new `channel_features` after any retransmissions required by `channel_reestablish` and as soon as there are no outstanding updates on either commitment transaction.
1463
+
1464
+
A node receiving `update_upgrade`:
1465
+
- if the `features` is not the same as the one it sent (or will send):
1466
+
- MUST fail the upgrade
1467
+
1468
+
When a node has both sent and received `update_upgrade`:
1469
+
- MUST consider the channel features to be those sent in `update_upgrade`.
1470
+
- if it has a lower SEC1-encoded node_id than its peer:
1471
+
- MUST send `commitment_signed` (using the new channel features).
1472
+
1473
+
#### Rationale
1474
+
1475
+
It is generally simpler to have both sides synchronized when upgrades
1476
+
occur: by indicating that an upgrade is desired and available, both
1477
+
sides know to perform the upgrade as soon as this is the case. In
1478
+
practice most upgrades happen by restarting software which implies a
1479
+
reconnect cycle anyway.
1480
+
1481
+
The modification of bits is actually quite tricky: a channel which has
1482
+
`option_static_remotekey` needs only set `option_anchor_outputs` in
1483
+
`upgrades_wanted`, but one with neither would set both.
1484
+
1485
+
A node which only offered `option_anchor_outputs` as an upgrade would
1486
+
only set that in `upgrades_available`, to avoid indicating that an
1487
+
upgrade only to `option_static_remotekey` was available.
1488
+
1489
+
There's weasel wording around how `channel_features` combines with
1490
+
`upgrades_wanted` ("modified by") since future channel features may
1491
+
turn off existing features they conflict with. This will be defined
1492
+
by them.
1493
+
1494
+
Finally, the `update_upgrade` features field is technically redundant,
1495
+
but a useful sanity check and diagnostic that both sides are now
1496
+
entering the same state. It also allows us to continue to enforce the
1497
+
rule that commitment_signed must include an update.
0 commit comments