Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

invoices+rpc: add missing channel graph to the AddInvoiceConfig #4978

Merged
merged 1 commit into from
Feb 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions lnrpc/invoicesrpc/config_active.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,13 @@ type Config struct {
// specified.
DefaultCLTVExpiry uint32

// ChanDB is a global boltdb instance which is needed to access the
// LocalChanDB is a global boltdb instance which is needed to access the
// channel graph.
ChanDB *channeldb.DB
LocalChanDB *channeldb.DB

// RemoteChanDB is a replicatd db instance which is the same as the
// localdb when running without remote db.
RemoteChanDB *channeldb.DB

// GenInvoiceFeatures returns a feature containing feature bits that
// should be advertised on freshly generated invoices.
Expand Down
3 changes: 2 additions & 1 deletion lnrpc/invoicesrpc/invoices_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,8 @@ func (s *Server) AddHoldInvoice(ctx context.Context,
ChainParams: s.cfg.ChainParams,
NodeSigner: s.cfg.NodeSigner,
DefaultCLTVExpiry: s.cfg.DefaultCLTVExpiry,
ChanDB: s.cfg.ChanDB,
ChanDB: s.cfg.RemoteChanDB,
Graph: s.cfg.LocalChanDB.ChannelGraph(),
GenInvoiceFeatures: s.cfg.GenInvoiceFeatures,
}

Expand Down
6 changes: 3 additions & 3 deletions rpcserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -621,9 +621,9 @@ func newRPCServer(cfg *Config, s *server, macService *macaroons.Service,
err = subServerCgs.PopulateDependencies(
cfg, s.cc, cfg.networkDir, macService, atpl, invoiceRegistry,
s.htlcSwitch, cfg.ActiveNetParams.Params, s.chanRouter,
routerBackend, s.nodeSigner, s.remoteChanDB, s.sweeper, tower,
s.towerClient, s.anchorTowerClient, cfg.net.ResolveTCPAddr,
genInvoiceFeatures, rpcsLog,
routerBackend, s.nodeSigner, s.localChanDB, s.remoteChanDB,
s.sweeper, tower, s.towerClient, s.anchorTowerClient,
cfg.net.ResolveTCPAddr, genInvoiceFeatures, rpcsLog,
)
if err != nil {
return nil, err
Expand Down
10 changes: 7 additions & 3 deletions subrpcserver_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ func (s *subRPCServerConfigs) PopulateDependencies(cfg *Config,
chanRouter *routing.ChannelRouter,
routerBackend *routerrpc.RouterBackend,
nodeSigner *netann.NodeSigner,
chanDB *channeldb.DB,
localChanDB *channeldb.DB,
remoteChanDB *channeldb.DB,
sweeper *sweep.UtxoSweeper,
tower *watchtower.Standalone,
towerClient wtclient.Client,
Expand Down Expand Up @@ -220,8 +221,11 @@ func (s *subRPCServerConfigs) PopulateDependencies(cfg *Config,
subCfgValue.FieldByName("DefaultCLTVExpiry").Set(
reflect.ValueOf(defaultDelta),
)
subCfgValue.FieldByName("ChanDB").Set(
reflect.ValueOf(chanDB),
subCfgValue.FieldByName("LocalChanDB").Set(
reflect.ValueOf(localChanDB),
)
subCfgValue.FieldByName("RemoteChanDB").Set(
reflect.ValueOf(remoteChanDB),
)
subCfgValue.FieldByName("GenInvoiceFeatures").Set(
reflect.ValueOf(genInvoiceFeatures),
Expand Down