mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-25 18:01:20 +02:00
multi: move AddTower to Tower Client Manager
In this commit we move the AddTower method from the Client interface to the TowerClientManager interface. The wtclientrpc is updated to call the `AddTower` method of the Manager instead of calling the `AddTower` method of each individual client. The TowerClient now is also only concerned with adding a new tower (or new tower address) to its in-memory state; the tower Manager will handle adding the tower to the DB.
This commit is contained in:
@@ -23,6 +23,10 @@ type Config struct {
|
||||
// we'll interact through the watchtower RPC subserver.
|
||||
AnchorClient wtclient.Client
|
||||
|
||||
// ClientMgr is a tower client manager that manages a set of tower
|
||||
// clients.
|
||||
ClientMgr wtclient.TowerClientManager
|
||||
|
||||
// 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.
|
||||
|
@@ -208,11 +208,7 @@ func (c *WatchtowerClient) AddTower(ctx context.Context,
|
||||
Address: addr,
|
||||
}
|
||||
|
||||
// TODO(conner): make atomic via multiplexed client
|
||||
if err := c.cfg.Client.AddTower(towerAddr); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := c.cfg.AnchorClient.AddTower(towerAddr); err != nil {
|
||||
if err := c.cfg.ClientMgr.AddTower(towerAddr); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user