Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unlock utxos when peer is unavailable for splice #564

Merged
merged 2 commits into from
Dec 8, 2023
Merged

Conversation

pm47
Copy link
Member

@pm47 pm47 commented Dec 8, 2023

If the peer is offline when the swap-in job requests a splice-in, the request will be ignored, but we weren't unlocking UTXOs, preventing any further attempt.

Also add an optimistic synchronization in the swap-in job, which as a side effect will cause us to retry swaps everytime the peer gets reconnected (vs at every new block or liquidity policy update previously).

cc @dpad85 @robbiehanson

If the peer is offline when the swap-in job requests a splice-in, the
request will be ignored, but we weren't unlocking UTXOs, preventing any
further attempt.

Also add an optimistic synchronization in the swap-in job, which as a
side effect will cause us to retry swaps everytime the peer gets
reconnected (vs at every new block or liquidity policy update previously).
@pm47 pm47 requested a review from t-bast December 8, 2023 16:35
@@ -453,6 +453,7 @@ class Peer(
.combine(currentTipFlow.filterNotNull()) { walletState, currentTip -> Pair(walletState, currentTip.first) }
.combine(swapInFeeratesFlow.filterNotNull()) { (walletState, currentTip), feerate -> Triple(walletState, currentTip, feerate) }
.combine(nodeParams.liquidityPolicy) { (walletState, currentTip, feerate), policy -> TrySwapInFlow(currentTip, walletState, feerate, policy) }
.combine(channelsFlow.filter { it.values.all { channel -> channel !is Offline && channel !is Syncing } }) { req, _ -> req } // this is only for synchronization, we discard the channels data
Copy link
Member Author

@pm47 pm47 Dec 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NB: this is a simplification of waitForPeerReady(), which doesn't handle the "local syncing" corner case.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't that mean that any user affected by the "local syncing" issue won't be able to initiate swap-ins? This would be a regression, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you look at the handler for RequestChannelOpen, in the "local syncing" case requests always end up being ignored. It's probably a (rare) bug, but technically not a regression 😓

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed this part in 71e2ae3.

@pm47 pm47 merged commit 9ac8fba into master Dec 8, 2023
2 checks passed
@pm47 pm47 deleted the unlock-utxos-offline branch December 8, 2023 17:37
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