@@ -8,11 +8,15 @@ import (
88 "google.golang.org/grpc"
99)
1010
11+ // Implementation of the watchtower client interface
12+ // https://lightning.engineering/api-docs/category/watchtowerclient-service/
1113type WatchtowerClientClient interface {
1214 ServiceClient [wtclientrpc.WatchtowerClientClient ]
1315
1416 AddTower (ctx context.Context , pubkey []byte , address string ) error
1517
18+ // Sets the given tower's status to inactive so that it's not considered
19+ // for session negotiation. Returns a human readable status string.
1620 DeactivateTower (ctx context.Context , pubkey []byte ) (string , error )
1721
1822 GetTowerInfo (ctx context.Context , pubkey []byte , includeSessions ,
@@ -27,14 +31,20 @@ type WatchtowerClientClient interface {
2731
2832 Stats (ctx context.Context ) (* StatsResponse , error )
2933
34+ // Terminates the given session and marks it to not be used for backups
35+ // anymore. Returns a human readable status string.
3036 TerminateSession (ctx context.Context , sessionId []byte ) (string , error )
3137}
3238
39+ // Response returned by `Policy`
40+ // https://lightning.engineering/api-docs/api/lnd/watchtower-client/policy/#wtclientrpcpolicyresponse
3341type PolicyResponse struct {
3442 maxUpdates uint32
3543 sweepSatPerVbyte uint32
3644}
3745
46+ // Response returned by `Stats`
47+ // https://lightning.engineering/api-docs/api/lnd/watchtower-client/stats/#wtclientrpcstatsresponse
3848type StatsResponse struct {
3949 numBackups uint32
4050 numPendingBackups uint32
@@ -107,6 +117,7 @@ func (m *wtClientClient) DeactivateTower(ctx context.Context, pubkey []byte) (st
107117
108118func (m * wtClientClient ) GetTowerInfo (ctx context.Context , pubkey []byte , includeSessions ,
109119 excludeExhaustedSessions bool ) (* wtclientrpc.Tower , error ) {
120+
110121 rpcCtx , cancel := context .WithTimeout (ctx , m .timeout )
111122 defer cancel ()
112123
@@ -125,6 +136,7 @@ func (m *wtClientClient) GetTowerInfo(ctx context.Context, pubkey []byte, includ
125136
126137func (m * wtClientClient ) ListTowers (ctx context.Context , includeSessions ,
127138 excludeExhaustedSessions bool ) ([]* wtclientrpc.Tower , error ) {
139+
128140 rpcCtx , cancel := context .WithTimeout (ctx , m .timeout )
129141 defer cancel ()
130142
@@ -157,6 +169,7 @@ func (m *wtClientClient) Policy(ctx context.Context, policyType wtclientrpc.Poli
157169 sweepSatPerVbyte : resp .SweepSatPerVbyte ,
158170 }, nil
159171}
172+
160173func (m * wtClientClient ) RemoveTower (ctx context.Context , pubkey []byte , address string ) error {
161174 rpcCtx , cancel := context .WithTimeout (ctx , m .timeout )
162175 defer cancel ()
0 commit comments