Skip to content

Commit

Permalink
fixup! remove bootChannels
Browse files Browse the repository at this point in the history
  • Loading branch information
pm47 committed Jun 21, 2023
1 parent 104a605 commit dfcd8a8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/commonMain/kotlin/fr/acinq/lightning/io/Peer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -212,18 +212,19 @@ class Peer(
}
launch {
// we don't restore closed channels
val channels = db.channels.listLocalChannels().filterNot { it is Closed }.associateBy { it.channelId }
val bootChannels = db.channels.listLocalChannels().filterNot { it is Closed }
_channels = bootChannels.associateBy { it.channelId }
_initialized.emit(true)
channels.values.forEach {
bootChannels.forEach {
logger.info { "restoring channel ${it.channelId} from local storage" }
val state = WaitForInit
val (state1, actions) = state.process(ChannelCommand.Init.Restore(it))
processActions(it.channelId, actions)
_channels = _channels + (it.channelId to state1)
}
logger.info { "restored ${channels.size} channels" }
logger.info { "restored ${bootChannels.size} channels" }
launch {
watchSwapInWallet(channels.values.toList())
watchSwapInWallet(bootChannels)
}
launch {
// If we have some htlcs that have timed out, we may need to close channels to ensure we don't lose funds.
Expand Down

0 comments on commit dfcd8a8

Please sign in to comment.