invoicesrpc: remove invoicerpc server's access to ChannelGraph pointer

Define a new GraphSource interface required by the invoicerpc server and
remove its access to the graphdb.ChannelGraph pointer. Add the new
invoicesrpc.GraphSource interface to the GraphSource interface
and let DBSource implement it.
This commit is contained in:
Elle Mouton
2024-11-11 16:43:38 +02:00
parent 9854bad720
commit 6f3d45f5d9
11 changed files with 124 additions and 60 deletions

View File

@@ -796,7 +796,8 @@ func (r *rpcServer) addDeps(s *server, macService *macaroons.Service,
err = subServerCgs.PopulateDependencies(
r.cfg, s.cc, r.cfg.networkDir, macService, atpl, invoiceRegistry,
s.htlcSwitch, r.cfg.ActiveNetParams.Params, s.chanRouter,
routerBackend, s.nodeSigner, s.graphDB, s.chanStateDB,
routerBackend, s.nodeSigner, s.graphDB, s.graphSource,
s.chanStateDB,
s.sweeper, tower, s.towerClientMgr, r.cfg.net.ResolveTCPAddr,
genInvoiceFeatures, genAmpInvoiceFeatures,
s.getNodeAnnouncement, s.updateAndBroadcastSelfNode, parseAddr,
@@ -6096,7 +6097,7 @@ func (r *rpcServer) AddInvoice(ctx context.Context,
NodeSigner: r.server.nodeSigner,
DefaultCLTVExpiry: defaultDelta,
ChanDB: r.server.chanStateDB,
Graph: r.server.graphDB,
Graph: r.server.graphSource,
GenInvoiceFeatures: func() *lnwire.FeatureVector {
v := r.server.featureMgr.Get(feature.SetInvoice)