Skip to content

Commit

Permalink
config: add ChainRPC config
Browse files Browse the repository at this point in the history
  • Loading branch information
wpaulino committed Dec 11, 2018
1 parent a511a84 commit a5da112
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions log.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ var (
swprLog = build.NewSubLogger("SWPR", backendLog.Logger)
sgnrLog = build.NewSubLogger("SGNR", backendLog.Logger)
wlktLog = build.NewSubLogger("WLKT", backendLog.Logger)
ntfrLog = build.NewSubLogger("NTFR", backendLog.Logger)
)

// Initialize package-global logger variables.
Expand Down
19 changes: 19 additions & 0 deletions subrpcserver_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"reflect"

"github.com/lightningnetwork/lnd/lnrpc/chainrpc"
"github.com/lightningnetwork/lnd/lnrpc/signrpc"
"github.com/lightningnetwork/lnd/lnrpc/walletrpc"
"github.com/lightningnetwork/lnd/macaroons"
Expand All @@ -25,6 +26,11 @@ type subRPCServerConfigs struct {
// also requests keys and addresses under control of the backing
// wallet.
WalletKitRPC *walletrpc.Config `group:"walletrpc" namespace:"walletrpc"`

// ChainRPC is a sub-RPC server that exposes functionality allowing a
// client to be notified of certain on-chain events (new blocks,
// confirmations, spends).
ChainRPC *chainrpc.Config `group:"chainrpc" namespace:"chainrpc"`
}

// PopulateDependencies attempts to iterate through all the sub-server configs
Expand Down Expand Up @@ -92,6 +98,19 @@ func (s *subRPCServerConfigs) PopulateDependencies(cc *chainControl,
reflect.ValueOf(cc.keyRing),
)

case *chainrpc.Config:
subCfgValue := extractReflectValue(cfg)

subCfgValue.FieldByName("NetworkDir").Set(
reflect.ValueOf(networkDir),
)
subCfgValue.FieldByName("MacService").Set(
reflect.ValueOf(macService),
)
subCfgValue.FieldByName("ChainNotifier").Set(
reflect.ValueOf(cc.chainNotifier),
)

default:
return fmt.Errorf("unknown field: %v, %T", fieldName,
cfg)
Expand Down

0 comments on commit a5da112

Please sign in to comment.