mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-06-06 04:59:34 +02:00
config: add a new entry for the WalletKit sub-RPC server to subRpcServerConfigs
This commit is contained in:
parent
b492114016
commit
14ca3bb012
@ -5,6 +5,7 @@ import (
|
|||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
"github.com/lightningnetwork/lnd/lnrpc/signrpc"
|
"github.com/lightningnetwork/lnd/lnrpc/signrpc"
|
||||||
|
"github.com/lightningnetwork/lnd/lnrpc/walletrpc"
|
||||||
"github.com/lightningnetwork/lnd/macaroons"
|
"github.com/lightningnetwork/lnd/macaroons"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -18,6 +19,12 @@ type subRPCServerConfigs struct {
|
|||||||
// SignRPC is a sub-RPC server that exposes signing of arbitrary inputs
|
// SignRPC is a sub-RPC server that exposes signing of arbitrary inputs
|
||||||
// as a gRPC service.
|
// as a gRPC service.
|
||||||
SignRPC *signrpc.Config `group:"signrpc" namespace:"signrpc"`
|
SignRPC *signrpc.Config `group:"signrpc" namespace:"signrpc"`
|
||||||
|
|
||||||
|
// WalletKitRPC is a sub-RPC server that exposes functionality allowing
|
||||||
|
// a client to send transactions through a wallet, publish them, and
|
||||||
|
// also requests keys and addresses under control of the backing
|
||||||
|
// wallet.
|
||||||
|
WalletKitRPC *walletrpc.Config `group:"walletrpc" namespace:"walletrpc"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// PopulateDependencies attempts to iterate through all the sub-server configs
|
// PopulateDependencies attempts to iterate through all the sub-server configs
|
||||||
@ -66,6 +73,25 @@ func (s *subRPCServerConfigs) PopulateDependencies(cc *chainControl,
|
|||||||
reflect.ValueOf(cc.signer),
|
reflect.ValueOf(cc.signer),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
case *walletrpc.Config:
|
||||||
|
subCfgValue := extractReflectValue(cfg)
|
||||||
|
|
||||||
|
subCfgValue.FieldByName("NetworkDir").Set(
|
||||||
|
reflect.ValueOf(networkDir),
|
||||||
|
)
|
||||||
|
subCfgValue.FieldByName("MacService").Set(
|
||||||
|
reflect.ValueOf(macService),
|
||||||
|
)
|
||||||
|
subCfgValue.FieldByName("FeeEstimator").Set(
|
||||||
|
reflect.ValueOf(cc.feeEstimator),
|
||||||
|
)
|
||||||
|
subCfgValue.FieldByName("Wallet").Set(
|
||||||
|
reflect.ValueOf(cc.wallet),
|
||||||
|
)
|
||||||
|
subCfgValue.FieldByName("KeyRing").Set(
|
||||||
|
reflect.ValueOf(cc.keyRing),
|
||||||
|
)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("unknown field: %v, %T", fieldName,
|
return fmt.Errorf("unknown field: %v, %T", fieldName,
|
||||||
cfg)
|
cfg)
|
||||||
@ -88,7 +114,6 @@ func (s *subRPCServerConfigs) FetchConfig(subServerName string) (interface{}, bo
|
|||||||
// Now that we have the value of the struct, we can check to see if it
|
// Now that we have the value of the struct, we can check to see if it
|
||||||
// has an attribute with the same name as the subServerName.
|
// has an attribute with the same name as the subServerName.
|
||||||
configVal := selfVal.FieldByName(subServerName)
|
configVal := selfVal.FieldByName(subServerName)
|
||||||
configValElem := configVal.Elem()
|
|
||||||
|
|
||||||
// We'll now ensure that this field actually exists in this value. If
|
// We'll now ensure that this field actually exists in this value. If
|
||||||
// not, then we'll return false for the ok value to indicate to the
|
// not, then we'll return false for the ok value to indicate to the
|
||||||
@ -97,6 +122,8 @@ func (s *subRPCServerConfigs) FetchConfig(subServerName string) (interface{}, bo
|
|||||||
return nil, false
|
return nil, false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
configValElem := configVal.Elem()
|
||||||
|
|
||||||
// If a config of this type is found, it doesn't have any fields, then
|
// If a config of this type is found, it doesn't have any fields, then
|
||||||
// it's the same as if it wasn't present. This can happen if the build
|
// it's the same as if it wasn't present. This can happen if the build
|
||||||
// tag for the sub-server is inactive.
|
// tag for the sub-server is inactive.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user