multi: let chan and graph db implement AddrSource

Then use both to construct a multiAddrSource AddrSource and use that
around the code-base.
This commit is contained in:
Elle Mouton
2024-10-22 14:35:37 +02:00
parent 51c2f709e1
commit 2c083bc017
4 changed files with 55 additions and 70 deletions

View File

@ -607,12 +607,14 @@ func newServer(cfg *Config, listenAddrs []net.Addr,
HtlcInterceptor: invoiceHtlcModifier,
}
addrSource := channeldb.NewMultiAddrSource(dbs.ChanStateDB, dbs.GraphDB)
s := &server{
cfg: cfg,
implCfg: implCfg,
graphDB: dbs.GraphDB.ChannelGraph(),
chanStateDB: dbs.ChanStateDB.ChannelStateDB(),
addrSource: dbs.ChanStateDB,
addrSource: addrSource,
miscDB: dbs.ChanStateDB,
invoicesDB: dbs.InvoiceDB,
cc: cc,
@ -1629,7 +1631,7 @@ func newServer(cfg *Config, listenAddrs []net.Addr,
// static backup of the latest channel state.
chanNotifier := &channelNotifier{
chanNotifier: s.channelNotifier,
addrs: dbs.ChanStateDB,
addrs: s.addrSource,
}
backupFile := chanbackup.NewMultiFile(cfg.BackupFilePath)
startingChans, err := chanbackup.FetchStaticChanBackups(