invoices+rpc: add missing channel graph to the AddInvoiceConfig

The Graph which is referenced later in the AddInvoice call graph is
unset when adding a hodl invoice. This resulted in a crash.
This commit is contained in:
Andras Banki-Horvath committed 2021-02-03 11:33:27 +01:00
1 parent 814b81bd25
commit dde5750160
4 files changed
+18 -9

No files matched your search

+6 -2
View File
@@ -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.
+2 -1
View File
@@ -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,
}