-
Notifications
You must be signed in to change notification settings - Fork 24
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
Conversation
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).
@@ -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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 😓
There was a problem hiding this comment.
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.
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