multi: extract address source into interface

As a preparation to have the method for querying the addresses of a node
separate from the channel state, we extract that method out into its own
interface.
This commit is contained in:
Oliver Gugger
2021-09-21 19:18:16 +02:00
parent c1f686f860
commit ddea833d31
4 changed files with 29 additions and 16 deletions

View File

@ -224,6 +224,8 @@ type server struct {
chanStateDB *channeldb.DB
addrSource chanbackup.AddressSource
htlcSwitch *htlcswitch.Switch
interceptableSwitch *htlcswitch.InterceptableSwitch
@ -433,6 +435,7 @@ func newServer(cfg *Config, listenAddrs []net.Addr,
cfg: cfg,
graphDB: dbs.graphDB.ChannelGraph(),
chanStateDB: dbs.chanStateDB,
addrSource: dbs.chanStateDB,
cc: cc,
sigPool: lnwallet.NewSigPool(cfg.Workers.Sig, cc.Signer),
writePool: writePool,
@ -1246,7 +1249,9 @@ func newServer(cfg *Config, listenAddrs []net.Addr,
addrs: s.chanStateDB,
}
backupFile := chanbackup.NewMultiFile(cfg.BackupFilePath)
startingChans, err := chanbackup.FetchStaticChanBackups(s.chanStateDB)
startingChans, err := chanbackup.FetchStaticChanBackups(
s.chanStateDB, s.addrSource,
)
if err != nil {
return nil, err
}