rpcserver+invoicesrpc: alias-aware AddInvoice,AddHoldInvoice rpc

AddInvoice,AddHoldInvoice now issue invoices that include our
peer's aliases. Some extra sanity checks are included to ensure we
don't leak our confirmed SCID for a private channel.
This commit is contained in:
eugene
2022-04-04 16:49:14 -04:00
parent 1aa9626606
commit 0ba67015da
6 changed files with 117 additions and 17 deletions

View File

@ -121,7 +121,8 @@ func (s *subRPCServerConfigs) PopulateDependencies(cfg *Config,
getNodeAnnouncement func() (lnwire.NodeAnnouncement, error),
updateNodeAnnouncement func(modifiers ...netann.NodeAnnModifier) error,
parseAddr func(addr string) (net.Addr, error),
rpcLogger btclog.Logger) error {
rpcLogger btclog.Logger,
getAlias func(lnwire.ChannelID) (lnwire.ShortChannelID, error)) error {
// First, we'll use reflect to obtain a version of the config struct
// that allows us to programmatically inspect its fields.
@ -257,6 +258,9 @@ func (s *subRPCServerConfigs) PopulateDependencies(cfg *Config,
subCfgValue.FieldByName("GenAmpInvoiceFeatures").Set(
reflect.ValueOf(genAmpInvoiceFeatures),
)
subCfgValue.FieldByName("GetAlias").Set(
reflect.ValueOf(getAlias),
)
case *neutrinorpc.Config:
subCfgValue := extractReflectValue(subCfg)