diff --git a/lnrpc/invoicesrpc/addinvoice.go b/lnrpc/invoicesrpc/addinvoice.go index 658a6dfa..fe13e566 100644 --- a/lnrpc/invoicesrpc/addinvoice.go +++ b/lnrpc/invoicesrpc/addinvoice.go @@ -54,6 +54,10 @@ type AddInvoiceConfig struct { // GenInvoiceFeatures returns a feature containing feature bits that // should be advertised on freshly generated invoices. GenInvoiceFeatures func() *lnwire.FeatureVector + + // GenAmpInvoiceFeatures returns a feature containing feature bits that + // should be advertised on freshly generated AMP invoices. + GenAmpInvoiceFeatures func() *lnwire.FeatureVector } // AddInvoiceData contains the required data to create a new invoice. diff --git a/lnrpc/invoicesrpc/config_active.go b/lnrpc/invoicesrpc/config_active.go index 59737c5a..ce008a5f 100644 --- a/lnrpc/invoicesrpc/config_active.go +++ b/lnrpc/invoicesrpc/config_active.go @@ -55,4 +55,8 @@ type Config struct { // GenInvoiceFeatures returns a feature containing feature bits that // should be advertised on freshly generated invoices. GenInvoiceFeatures func() *lnwire.FeatureVector + + // GenAmpInvoiceFeatures returns a feature containing feature bits that + // should be advertised on freshly generated AMP invoices. + GenAmpInvoiceFeatures func() *lnwire.FeatureVector } diff --git a/lnrpc/invoicesrpc/invoices_server.go b/lnrpc/invoicesrpc/invoices_server.go index 0c76b1d7..0db5022c 100644 --- a/lnrpc/invoicesrpc/invoices_server.go +++ b/lnrpc/invoicesrpc/invoices_server.go @@ -308,14 +308,15 @@ func (s *Server) AddHoldInvoice(ctx context.Context, invoice *AddHoldInvoiceRequest) (*AddHoldInvoiceResp, error) { addInvoiceCfg := &AddInvoiceConfig{ - AddInvoice: s.cfg.InvoiceRegistry.AddInvoice, - IsChannelActive: s.cfg.IsChannelActive, - ChainParams: s.cfg.ChainParams, - NodeSigner: s.cfg.NodeSigner, - DefaultCLTVExpiry: s.cfg.DefaultCLTVExpiry, - ChanDB: s.cfg.RemoteChanDB, - Graph: s.cfg.LocalChanDB.ChannelGraph(), - GenInvoiceFeatures: s.cfg.GenInvoiceFeatures, + AddInvoice: s.cfg.InvoiceRegistry.AddInvoice, + IsChannelActive: s.cfg.IsChannelActive, + ChainParams: s.cfg.ChainParams, + NodeSigner: s.cfg.NodeSigner, + DefaultCLTVExpiry: s.cfg.DefaultCLTVExpiry, + ChanDB: s.cfg.RemoteChanDB, + Graph: s.cfg.LocalChanDB.ChannelGraph(), + GenInvoiceFeatures: s.cfg.GenInvoiceFeatures, + GenAmpInvoiceFeatures: s.cfg.GenAmpInvoiceFeatures, } hash, err := lntypes.MakeHash(invoice.Hash) diff --git a/rpcserver.go b/rpcserver.go index 611fb5d7..eb6048a1 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -661,6 +661,9 @@ func (r *rpcServer) addDeps(s *server, macService *macaroons.Service, genInvoiceFeatures := func() *lnwire.FeatureVector { return s.featureMgr.Get(feature.SetInvoice) } + genAmpInvoiceFeatures := func() *lnwire.FeatureVector { + return s.featureMgr.Get(feature.SetInvoiceAmp) + } var ( subServers []lnrpc.SubServer @@ -677,7 +680,8 @@ func (r *rpcServer) addDeps(s *server, macService *macaroons.Service, s.htlcSwitch, r.cfg.ActiveNetParams.Params, s.chanRouter, routerBackend, s.nodeSigner, s.localChanDB, s.remoteChanDB, s.sweeper, tower, s.towerClient, s.anchorTowerClient, - r.cfg.net.ResolveTCPAddr, genInvoiceFeatures, rpcsLog, + r.cfg.net.ResolveTCPAddr, genInvoiceFeatures, + genAmpInvoiceFeatures, rpcsLog, ) if err != nil { return err @@ -4796,6 +4800,9 @@ func (r *rpcServer) AddInvoice(ctx context.Context, GenInvoiceFeatures: func() *lnwire.FeatureVector { return r.server.featureMgr.Get(feature.SetInvoice) }, + GenAmpInvoiceFeatures: func() *lnwire.FeatureVector { + return r.server.featureMgr.Get(feature.SetInvoiceAmp) + }, } value, err := lnrpc.UnmarshallAmt(invoice.Value, invoice.ValueMsat) diff --git a/subrpcserver_config.go b/subrpcserver_config.go index dcdffbef..14671f53 100644 --- a/subrpcserver_config.go +++ b/subrpcserver_config.go @@ -100,6 +100,7 @@ func (s *subRPCServerConfigs) PopulateDependencies(cfg *Config, anchorTowerClient wtclient.Client, tcpResolver lncfg.TCPResolver, genInvoiceFeatures func() *lnwire.FeatureVector, + genAmpInvoiceFeatures func() *lnwire.FeatureVector, rpcLogger btclog.Logger) error { // First, we'll use reflect to obtain a version of the config struct @@ -230,6 +231,9 @@ func (s *subRPCServerConfigs) PopulateDependencies(cfg *Config, subCfgValue.FieldByName("GenInvoiceFeatures").Set( reflect.ValueOf(genInvoiceFeatures), ) + subCfgValue.FieldByName("GenAmpInvoiceFeatures").Set( + reflect.ValueOf(genAmpInvoiceFeatures), + ) // RouterRPC isn't conditionally compiled and doesn't need to be // populated using reflection.