Skip to content

Commit

Permalink
Don't retry on liquidity policy changes
Browse files Browse the repository at this point in the history
  • Loading branch information
t-bast committed Jun 21, 2023
1 parent 07febbb commit 1a1aceb
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions src/commonMain/kotlin/fr/acinq/lightning/io/Peer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ class Peer(
}
logger.info { "restored ${channelIds.size} channels" }
launch { watchSwapInWallet() }
launch { watchLiquidityPolicyChanges() }
launch {
// If we have some htlcs that have timed out, we may need to close channels to ensure we don't lose funds.
// But maybe we were offline for too long and it is why our peer couldn't settle these htlcs in time.
Expand Down Expand Up @@ -389,20 +388,6 @@ class Peer(
}
}

private suspend fun watchLiquidityPolicyChanges() {
nodeParams.liquidityPolicy.collect {
val walletState = swapInWallet.walletStateFlow.first()
if (walletState.consistent) {
logger.info { "liquidity policy changed, retrying swaps" }
val currentBlockHeight = currentTipFlow.filterNotNull().first().first
input.send(WalletCommand.TrySwapIn(currentBlockHeight, walletState, walletParams.swapInConfirmations, isMigrationFromLegacyApp))
} else {
// If the wallet is inconsistent, it should become consistent soon, which will trigger the normal swap flow.
logger.info { "liquidity policy changed, waiting for wallet to be consistent" }
}
}
}

suspend fun send(cmd: PeerCommand) {
input.send(cmd)
}
Expand Down

0 comments on commit 1a1aceb

Please sign in to comment.