lnrpc+rpcserver: thread GenAmpInvoiceFeatures to invoicesrpc
This commit is contained in:
parent
e97da53676
commit
6a7d3c4b5e
@ -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.
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -316,6 +316,7 @@ func (s *Server) AddHoldInvoice(ctx context.Context,
|
||||
ChanDB: s.cfg.RemoteChanDB,
|
||||
Graph: s.cfg.LocalChanDB.ChannelGraph(),
|
||||
GenInvoiceFeatures: s.cfg.GenInvoiceFeatures,
|
||||
GenAmpInvoiceFeatures: s.cfg.GenAmpInvoiceFeatures,
|
||||
}
|
||||
|
||||
hash, err := lntypes.MakeHash(invoice.Hash)
|
||||
|
@ -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)
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user