Skip to content

Commit 3129979

Browse files
committed
Relax backup storage requirements
We should be less strict with our backup storage peers, they only provide this feature as a best effort. In particular, this lets peers safely store backups for each other without risking channel closure.
1 parent 42e68e0 commit 3129979

File tree

2 files changed

+12
-31
lines changed

2 files changed

+12
-31
lines changed

01-messaging.md

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -456,17 +456,14 @@ arbitrary data for their peers. The data stored must not exceed 32000 bytes,
456456
which lets it fit in existing lightning messages (e.g. a `commitment_signed`
457457
message with 483 htlc signatures).
458458

459-
Nodes that advertize the `want_peer_backup_storage` feature want to have their
459+
Nodes that advertise the `want_peer_backup_storage` feature want to have their
460460
data stored by their peers that support `provide_peer_backup_storage`.
461461

462462
Nodes can verify that their `provide_peer_backup_storage` peers correctly store
463463
their backup data at each reconnection, by comparing the contents of the
464-
retrieved backups with the last one they sent.
465-
466-
Note that it's not possible for _both_ peers to store each other's backups;
467-
whenever one loses data it would force the other to close channels, which is
468-
undesirable. In practice, this means that a node cannot set both
469-
`want_peer_backup_storage` and `provide_peer_backup_storage`.
464+
retrieved backups with the last one they sent. However, nodes should not expect
465+
their peers to always have their latest backup available (note that there is no
466+
ack to ensure a backup has been correctly stored).
470467

471468
There are two types of backups:
472469
- `node_backup`, described in this section
@@ -480,31 +477,23 @@ Nodes ask their peers to store data using the `update_backup` message:
480477
* [`length*byte`:`node_backup`]
481478

482479
A node with `want_peer_backup_storage` activated:
483-
- MUST NOT activate `provide_peer_backup_storage`
484480
- if its peer doesn't support `provide_peer_backup_storage`:
485481
- MUST NOT send `update_backup`
486482
- otherwise:
487483
- MAY send `update_backup` whenever necessary
488484
- MUST limit its `node_backup` to 32000 bytes
489485
- when it receives `init` with an outdated or missing `node_backup`:
490-
- SHOULD send a warning
491-
- MAY disconnect
492-
- MAY fail all channels with that peer
486+
- MAY send a warning
493487

494488
A node with `provide_peer_backup_storage` activated:
495-
- MUST NOT activate `want_peer_backup_storage`
496489
- when it receives `update_backup`:
497-
- if its peer also has activated the `provide_peer_backup_storage` feature:
490+
- if the `node_backup` exceeds 32000 bytes:
498491
- SHOULD send a warning
499492
- MUST NOT store this backup data
500493
- otherwise:
501-
- if the `node_backup` exceeds 32000 bytes:
502-
- SHOULD send a warning
503-
- MUST NOT store this backup data
504-
- otherwise:
505-
- MUST store this backup data
494+
- SHOULD store this backup data
506495
- when it sends `init`:
507-
- MUST include the last `node_backup` it received from that peer
496+
- MUST include the last `node_backup` it stored for that peer
508497
- when all channels with that peer are closed:
509498
- SHOULD wait at least 2016 blocks before deleting the `node_backup`
510499

02-peer-protocol.md

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1428,32 +1428,24 @@ describes how this allows storing per-node data, and the following section
14281428
describes how this allows storing per-channel data.
14291429

14301430
A node with `want_peer_backup_storage` activated:
1431-
- MUST NOT activate `provide_peer_backup_storage`
14321431
- if its peer doesn't support `provide_peer_backup_storage`:
14331432
- MUST NOT send their `channel_backup`
14341433
- otherwise:
14351434
- when it sends a message that completes an update of the channel state (`funding_signed`, `commitment_signed`, `revoke_and_ack`, `shutdown` or `closing_signed`):
14361435
- MAY include an optional `channel_backup` TLV field
14371436
- MUST limit its `channel_backup` to 32000 bytes
14381437
- when it receives `channel_reestablish` with an outdated or missing `channel_backup`:
1439-
- SHOULD send a warning
1440-
- MAY disconnect
1441-
- MAY fail the channel
1438+
- MAY send a warning
14421439

14431440
A node with `provide_peer_backup_storage` activated:
1444-
- MUST NOT activate `want_peer_backup_storage`
14451441
- when it receives a `channel_backup`:
1446-
- if its peer also has activated the `provide_peer_backup_storage` feature:
1442+
- if the `channel_backup` exceeds 32000 bytes:
14471443
- SHOULD send a warning
14481444
- MUST NOT store this backup data
14491445
- otherwise:
1450-
- if the `channel_backup` exceeds 32000 bytes:
1451-
- SHOULD send a warning
1452-
- MUST NOT store this backup data
1453-
- otherwise:
1454-
- MUST store this backup data
1446+
- SHOULD store this backup data
14551447
- when it sends `channel_reestablish`:
1456-
- MUST include the last `channel_backup` it received for that channel
1448+
- MUST include the last `channel_backup` it stored for that channel
14571449
- when the channel is closed:
14581450
- SHOULD wait at least 2016 blocks before deleting the `channel_backup`
14591451

0 commit comments

Comments
 (0)