multi: thread anchor client down to wtclient subserver

This commit is contained in:
Conner Fromknecht 2020-11-25 15:08:05 -08:00
parent a5c40858c9
commit 5b3a08a1cd
No known key found for this signature in database
GPG Key ID: E7D737B67FA592C7
3 changed files with 11 additions and 3 deletions

@ -19,6 +19,10 @@ type Config struct {
// through the watchtower RPC subserver.
Client wtclient.Client
// AnchorClient is the backing watchtower client for anchor channels that
// we'll interact through the watchtower RPC subserver.
AnchorClient wtclient.Client
// Resolver is a custom resolver that will be used to resolve watchtower
// addresses to ensure we don't leak any information when running over
// non-clear networks, e.g. Tor, etc.

@ -619,8 +619,8 @@ func newRPCServer(cfg *Config, s *server, macService *macaroons.Service,
cfg, s.cc, cfg.networkDir, macService, atpl, invoiceRegistry,
s.htlcSwitch, cfg.ActiveNetParams.Params, s.chanRouter,
routerBackend, s.nodeSigner, s.remoteChanDB, s.sweeper, tower,
s.towerClient, cfg.net.ResolveTCPAddr, genInvoiceFeatures,
rpcsLog,
s.towerClient, s.anchorTowerClient, cfg.net.ResolveTCPAddr,
genInvoiceFeatures, rpcsLog,
)
if err != nil {
return nil, err

@ -96,6 +96,7 @@ func (s *subRPCServerConfigs) PopulateDependencies(cfg *Config,
sweeper *sweep.UtxoSweeper,
tower *watchtower.Standalone,
towerClient wtclient.Client,
anchorTowerClient wtclient.Client,
tcpResolver lncfg.TCPResolver,
genInvoiceFeatures func() *lnwire.FeatureVector,
rpcLogger btclog.Logger) error {
@ -243,13 +244,16 @@ func (s *subRPCServerConfigs) PopulateDependencies(cfg *Config,
case *wtclientrpc.Config:
subCfgValue := extractReflectValue(subCfg)
if towerClient != nil {
if towerClient != nil && anchorTowerClient != nil {
subCfgValue.FieldByName("Active").Set(
reflect.ValueOf(towerClient != nil),
)
subCfgValue.FieldByName("Client").Set(
reflect.ValueOf(towerClient),
)
subCfgValue.FieldByName("AnchorClient").Set(
reflect.ValueOf(anchorTowerClient),
)
}
subCfgValue.FieldByName("Resolver").Set(
reflect.ValueOf(tcpResolver),