lightning-kmp icon indicating copy to clipboard operation
lightning-kmp copied to clipboard

Remove `Peer.bootChannels` map

Open pm47 opened this issue 1 year ago • 1 comments

Right after starting a Peer, the channels map is empty because it is loaded asynchronously in a coroutine. Library integrators need a way to differentiate between "channels not yet loaded" and "no channels at all", otherwise they may e.g. display a 0 sat balance for a short amount of time.

Instead of using a nullable map bootChannels, we add an explicit initialized boolean.

pm47 avatar Jun 21 '23 12:06 pm47

Note: this PR is paused as there are side-effects with electrum (see https://github.com/ACINQ/lightning-kmp/pull/483#discussion_r1236735367). Removing the explicit bootChannels flow prevents us from distinguishing:

  • channels not loaded yet
  • channels loaded from local database
  • channels loaded and reestablished with the peer (<- depends on the Electrum feerates)

dpad85 avatar Jun 22 '23 15:06 dpad85