Skip to content

Conversation

@tnull
Copy link
Collaborator

@tnull tnull commented Mar 1, 2024

While we previously took care of persisting peer details when a channel is opened and if the user signals to connect to have the connection persisted, our background task would still only try to reconnect to channel peers. Here, we fix this omission and add a regression test ensuring we'll see the proper behavior going forward.

Testing the restart behavior also uncovered another minor issue that arose from storing and cloning the stop_receiver in the Node object. To fix this, we drop the receiver end and just subscribe to the sender when needed.

Our `stop_sender`/`stop_receiver` watch channel is used to signal to
background tasks that they need to stop as we're about to shut down.

Previously, we stored both sides in our `Node` object. However, when
restarting the node, this would lead to us cloning a stale
`stop_receiver`, i.e., one that still had the change signal set, messing
with our shutdown logic on restarts.

Here, we instead drop the stored receiver and just create all
receivers by `subscribe`ing to the sender where necessary, which fixes
the prior bug.
@tnull tnull requested a review from wpaulino March 1, 2024 09:59
@tnull tnull force-pushed the 2024-02-fix-peer-reconnection branch 2 times, most recently from c5cd5fd to 9c1aa7c Compare March 1, 2024 10:12
@wpaulino
Copy link

wpaulino commented Mar 1, 2024

LGTM but the new test failed in CI

While we previously took care of persisting peer details when a channel
is opened and if the user signals to `connect` to have the connection
persisted, our background task would still only try to reconnect to
channel peers. Here, we fix this omission and add a regression test
ensuring we'll see the proper behavior going forward.
@tnull tnull force-pushed the 2024-02-fix-peer-reconnection branch from 9c1aa7c to b1bee0f Compare March 1, 2024 19:52
@tnull
Copy link
Collaborator Author

tnull commented Mar 1, 2024

LGTM but the new test failed in CI

Added a second sleep and now CI fails on the well-known Windows test I yet have to find a solution for...

@tnull tnull merged commit 71a3e32 into lightningdevkit:main Mar 1, 2024
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