@@ -8,11 +8,15 @@ import (
8
8
"google.golang.org/grpc"
9
9
)
10
10
11
+ // Implementation of the watchtower client interface
12
+ // https://lightning.engineering/api-docs/category/watchtowerclient-service/
11
13
type WatchtowerClientClient interface {
12
14
ServiceClient [wtclientrpc.WatchtowerClientClient ]
13
15
14
16
AddTower (ctx context.Context , pubkey []byte , address string ) error
15
17
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.
16
20
DeactivateTower (ctx context.Context , pubkey []byte ) (string , error )
17
21
18
22
GetTowerInfo (ctx context.Context , pubkey []byte , includeSessions ,
@@ -27,14 +31,20 @@ type WatchtowerClientClient interface {
27
31
28
32
Stats (ctx context.Context ) (* StatsResponse , error )
29
33
34
+ // Terminates the given session and marks it to not be used for backups
35
+ // anymore. Returns a human readable status string.
30
36
TerminateSession (ctx context.Context , sessionId []byte ) (string , error )
31
37
}
32
38
39
+ // Response returned by `Policy`
40
+ // https://lightning.engineering/api-docs/api/lnd/watchtower-client/policy/#wtclientrpcpolicyresponse
33
41
type PolicyResponse struct {
34
42
maxUpdates uint32
35
43
sweepSatPerVbyte uint32
36
44
}
37
45
46
+ // Response returned by `Stats`
47
+ // https://lightning.engineering/api-docs/api/lnd/watchtower-client/stats/#wtclientrpcstatsresponse
38
48
type StatsResponse struct {
39
49
numBackups uint32
40
50
numPendingBackups uint32
@@ -107,6 +117,7 @@ func (m *wtClientClient) DeactivateTower(ctx context.Context, pubkey []byte) (st
107
117
108
118
func (m * wtClientClient ) GetTowerInfo (ctx context.Context , pubkey []byte , includeSessions ,
109
119
excludeExhaustedSessions bool ) (* wtclientrpc.Tower , error ) {
120
+
110
121
rpcCtx , cancel := context .WithTimeout (ctx , m .timeout )
111
122
defer cancel ()
112
123
@@ -125,6 +136,7 @@ func (m *wtClientClient) GetTowerInfo(ctx context.Context, pubkey []byte, includ
125
136
126
137
func (m * wtClientClient ) ListTowers (ctx context.Context , includeSessions ,
127
138
excludeExhaustedSessions bool ) ([]* wtclientrpc.Tower , error ) {
139
+
128
140
rpcCtx , cancel := context .WithTimeout (ctx , m .timeout )
129
141
defer cancel ()
130
142
@@ -157,6 +169,7 @@ func (m *wtClientClient) Policy(ctx context.Context, policyType wtclientrpc.Poli
157
169
sweepSatPerVbyte : resp .SweepSatPerVbyte ,
158
170
}, nil
159
171
}
172
+
160
173
func (m * wtClientClient ) RemoveTower (ctx context.Context , pubkey []byte , address string ) error {
161
174
rpcCtx , cancel := context .WithTimeout (ctx , m .timeout )
162
175
defer cancel ()
0 commit comments