Skip to content

Peer storage enable#8140

Merged
rustyrussell merged 15 commits intoElementsProject:masterfrom
rustyrussell:peer-storage-enable
May 16, 2025
Merged

Peer storage enable#8140
rustyrussell merged 15 commits intoElementsProject:masterfrom
rustyrussell:peer-storage-enable

Conversation

@rustyrussell
Copy link
Contributor

Based on #8136

This gets chanbackup to the point that we can enable it by default. If we did that now it would have too much penalty for large nodes with many channels, so we fix that up, and finally enable it!

@rustyrussell rustyrussell added this to the v25.05 milestone Mar 5, 2025
@rustyrussell rustyrussell requested a review from adi2011 March 5, 2025 05:01
@rustyrussell rustyrussell force-pushed the peer-storage-enable branch from e89b21c to 36b6df1 Compare March 6, 2025 00:47
@adi2011
Copy link
Collaborator

adi2011 commented Mar 11, 2025

I’m currently reviewing it and will share my full feedback soon.

In the meantime, I have one major suggestion to discuss: Should we send a bogus ChannelReestablish message during recovery? LND does not respond to errors with a force close.

@rustyrussell rustyrussell force-pushed the peer-storage-enable branch from 36b6df1 to 607aa40 Compare May 15, 2025 07:27
This is the only way to track spec changes in future.

Signed-off-by: Rusty Russell <[email protected]>
after_listpeers() doesn't use the argument, so we don't need to allocate anything.

Signed-off-by: Rusty Russell <[email protected]>
We should not send a message on unknown custom message receipt (we
expect this!).

Signed-off-by: Rusty Russell <[email protected]>
This avoids globals, which is a bit neater.

Signed-off-by: Rusty Russell <[email protected]>
@rustyrussell rustyrussell force-pushed the peer-storage-enable branch 2 times, most recently from 97365e4 to 537561c Compare May 16, 2025 02:24
@rustyrussell rustyrussell marked this pull request as ready for review May 16, 2025 04:12
@rustyrussell rustyrussell force-pushed the peer-storage-enable branch from 537561c to f5be46e Compare May 16, 2025 04:13
@rustyrussell rustyrussell enabled auto-merge (rebase) May 16, 2025 04:13
…ing with NULL cb.

This should complete the command, otherwise we get an assertion on
line 1090.

Signed-off-by: Rusty Russell <[email protected]>
By keeping a local hash table, we won't have to look up every time.
We still write to the datastore when it changes, and we need to
initialize it at plugin start.

Signed-off-by: Rusty Russell <[email protected]>
Now actually use our cache.

Signed-off-by: Rusty Russell <[email protected]>
We already get the connected hook, so in there we can add to a hash
table of suitable peers.  Rather than subscribe to disconnection, we
simply remove the peer if a sendcustommsg fails.

This does make after_send_scb_single() a bit more complex, since it
needs this specific node_id: we use a `struct info` per node and a
pointer to a shared "idx" reference counter.

Signed-off-by: Rusty Russell <[email protected]>
This is much better for very large nodes with lots of channel activity.

Signed-off-by: Rusty Russell <[email protected]>
This, too, is vital for large nodes, which don't want a significant
traffic increase.

Signed-off-by: Rusty Russell <[email protected]>
They will in fact get truncated, and never restore.  Large nodes should be using some real
backup strategy!

For this reason, we split "peer_backup" support into send vs store support, so we can
turn off send of our own without disabling storing/sending theirs.

Signed-off-by: Rusty Russell <[email protected]>
…tore users.

When peer backup is enabled by default, it puts things in the datastore, breaking
this assumption.  Narrow the test to examine the specific funder directory.

Signed-off-by: Rusty Russell <[email protected]>
Now we've make it only on existing channels, and not have to call
listdatastore every time, that means we can safely turn it on by
default.

Changelog-Added: Protocol: we now offer peer storage to any peers who create a channel.
Changelog-Deprecated: Config: `--experimental-peer-storage` (it's now the default).
Signed-off-by: Rusty Russell <[email protected]>
We picked one node and iterated.  This means we would only sent to 1,
not 2 nodes if we picked the last (common if there were only a few
peers).  But it also means we would generally send to the same pair of
nodes, which isn't great for redundancy.

Rework to be more random.

Signed-off-by: Rusty Russell <[email protected]>
@rustyrussell rustyrussell force-pushed the peer-storage-enable branch from 50b8321 to 7bc26c4 Compare May 16, 2025 12:04
@rustyrussell rustyrussell merged commit 44972b2 into ElementsProject:master May 16, 2025
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants