88 "google.golang.org/grpc"
99)
1010
11- // Implementation of the watchtower client interface
11+ // WatchtowerClientClient implements the watchtower client interface
1212// https://lightning.engineering/api-docs/category/watchtowerclient-service/
1313type WatchtowerClientClient interface {
1414 ServiceClient [wtclientrpc.WatchtowerClientClient ]
@@ -25,20 +25,21 @@ type WatchtowerClientClient interface {
2525 DeactivateTower (ctx context.Context , pubkey []byte ) (string , error )
2626
2727 // GetTowerInfo gets information about a watchtower that corresponds to the
28- // given pubkey. The `includeSessions` flag controls whether session information is
29- // included. The `excludeExhaustedSessions` controls whether exhausted sessions
30- // are included in the response.
28+ // given pubkey. The `includeSessions` flag controls whether session
29+ // information is included. The `excludeExhaustedSessions` controls whether
30+ // exhausted sessions are included in the response.
3131 GetTowerInfo (ctx context.Context , pubkey []byte , includeSessions ,
3232 excludeExhaustedSessions bool ) (* wtclientrpc.Tower , error )
3333
3434 // ListTowers gets information about all registered watchtowers. The
35- // `includeSessions` and `excludeExhaustedSessions` flags serve the same function as
36- // in the `GetTowerInfo` method.
35+ // `includeSessions` and `excludeExhaustedSessions` flags serve the same
36+ // function as in the `GetTowerInfo` method.
3737 ListTowers (ctx context.Context , includeSessions ,
3838 excludeExhaustedSessions bool ) ([]* wtclientrpc.Tower , error )
3939
4040 // Policy returns the active watchtower client policy configuration.
41- Policy (ctx context.Context , policyType wtclientrpc.PolicyType ) (* PolicyResponse , error )
41+ Policy (ctx context.Context , policyType wtclientrpc.PolicyType ) (
42+ * PolicyResponse , error )
4243
4344 // RemoveTower removes a watchtower from being considered for future session
4445 // negotiations and from being used for any subsequent backups until it's added
@@ -54,14 +55,16 @@ type WatchtowerClientClient interface {
5455 TerminateSession (ctx context.Context , sessionId []byte ) (string , error )
5556}
5657
57- // Response returned by `Policy`
58+ // PolicyResponse returned by `Policy`
59+ // nolint:lll
5860// https://lightning.engineering/api-docs/api/lnd/watchtower-client/policy/#wtclientrpcpolicyresponse
5961type PolicyResponse struct {
6062 maxUpdates uint32
6163 sweepSatPerVbyte uint32
6264}
6365
64- // Response returned by `Stats`
66+ // StatsResponse returned by `Stats`
67+ // nolint:lll
6568// https://lightning.engineering/api-docs/api/lnd/watchtower-client/stats/#wtclientrpcstatsresponse
6669type StatsResponse struct {
6770 numBackups uint32
@@ -105,7 +108,9 @@ func (m *wtClientClient) RawClientWithMacAuth(
105108// considers it for new sessions. If the watchtower already exists, then
106109// any new addresses included will be considered when dialing it for
107110// session negotiations and backups.
108- func (m * wtClientClient ) AddTower (ctx context.Context , pubkey []byte , address string ) error {
111+ func (m * wtClientClient ) AddTower (ctx context.Context , pubkey []byte ,
112+ address string ) error {
113+
109114 rpcCtx , cancel := context .WithTimeout (ctx , m .timeout )
110115 defer cancel ()
111116
@@ -126,14 +131,18 @@ func (m *wtClientClient) AddTower(ctx context.Context, pubkey []byte, address st
126131// DeactivateTower sets the given tower's status to inactive so that it
127132// is not considered for session negotiation. Its sessions will also not
128133// be used while the tower is inactive.
129- func (m * wtClientClient ) DeactivateTower (ctx context.Context , pubkey []byte ) (string , error ) {
134+ func (m * wtClientClient ) DeactivateTower (ctx context.Context , pubkey []byte ) (
135+ string , error ) {
136+
130137 rpcCtx , cancel := context .WithTimeout (ctx , m .timeout )
131138 defer cancel ()
132139
133140 rpcCtx = m .wtClientMac .WithMacaroonAuth (rpcCtx )
134- resp , err := m .client .DeactivateTower (rpcCtx , & wtclientrpc.DeactivateTowerRequest {
135- Pubkey : pubkey ,
136- })
141+ resp , err := m .client .DeactivateTower (rpcCtx ,
142+ & wtclientrpc.DeactivateTowerRequest {
143+ Pubkey : pubkey ,
144+ },
145+ )
137146 if err != nil {
138147 return "" , err
139148 }
@@ -142,11 +151,11 @@ func (m *wtClientClient) DeactivateTower(ctx context.Context, pubkey []byte) (st
142151}
143152
144153// GetTowerInfo gets information about a watchtower that corresponds to the
145- // given pubkey. The `includeSessions` flag controls whether session information is
146- // included. The `excludeExhaustedSessions` controls whether exhausted sessions
147- // are included in the response.
148- func (m * wtClientClient ) GetTowerInfo (ctx context.Context , pubkey []byte , includeSessions ,
149- excludeExhaustedSessions bool ) (* wtclientrpc.Tower , error ) {
154+ // given pubkey. The `includeSessions` flag controls whether session information
155+ // is included. The `excludeExhaustedSessions` controls whether exhausted
156+ // sessions are included in the response.
157+ func (m * wtClientClient ) GetTowerInfo (ctx context.Context , pubkey []byte ,
158+ includeSessions , excludeExhaustedSessions bool ) (* wtclientrpc.Tower , error ) {
150159
151160 rpcCtx , cancel := context .WithTimeout (ctx , m .timeout )
152161 defer cancel ()
@@ -165,8 +174,8 @@ func (m *wtClientClient) GetTowerInfo(ctx context.Context, pubkey []byte, includ
165174}
166175
167176// ListTowers gets information about all registered watchtowers. The
168- // `includeSessions` and `excludeExhaustedSessions` flags serve the same function as
169- // in the `GetTowerInfo` method.
177+ // `includeSessions` and `excludeExhaustedSessions` flags serve the same
178+ // function as in the `GetTowerInfo` method.
170179func (m * wtClientClient ) ListTowers (ctx context.Context , includeSessions ,
171180 excludeExhaustedSessions bool ) ([]* wtclientrpc.Tower , error ) {
172181
@@ -186,7 +195,9 @@ func (m *wtClientClient) ListTowers(ctx context.Context, includeSessions,
186195}
187196
188197// Policy returns the active watchtower client policy configuration.
189- func (m * wtClientClient ) Policy (ctx context.Context , policyType wtclientrpc.PolicyType ) (* PolicyResponse , error ) {
198+ func (m * wtClientClient ) Policy (ctx context.Context ,
199+ policyType wtclientrpc.PolicyType ) (* PolicyResponse , error ) {
200+
190201 rpcCtx , cancel := context .WithTimeout (ctx , m .timeout )
191202 defer cancel ()
192203
@@ -208,7 +219,9 @@ func (m *wtClientClient) Policy(ctx context.Context, policyType wtclientrpc.Poli
208219// negotiations and from being used for any subsequent backups until it's added
209220// again. If an address is provided, then this RPC only serves as a way of
210221// removing the address from the watchtower instead.
211- func (m * wtClientClient ) RemoveTower (ctx context.Context , pubkey []byte , address string ) error {
222+ func (m * wtClientClient ) RemoveTower (ctx context.Context , pubkey []byte ,
223+ address string ) error {
224+
212225 rpcCtx , cancel := context .WithTimeout (ctx , m .timeout )
213226 defer cancel ()
214227
@@ -246,14 +259,18 @@ func (m *wtClientClient) Stats(ctx context.Context) (*StatsResponse, error) {
246259
247260// Terminates the given session and marks it to not be used for backups
248261// anymore. Returns a human readable status string.
249- func (m * wtClientClient ) TerminateSession (ctx context.Context , sessionId []byte ) (string , error ) {
262+ func (m * wtClientClient ) TerminateSession (ctx context.Context ,
263+ sessionId []byte ) (string , error ) {
264+
250265 rpcCtx , cancel := context .WithTimeout (ctx , m .timeout )
251266 defer cancel ()
252267
253268 rpcCtx = m .wtClientMac .WithMacaroonAuth (rpcCtx )
254- resp , err := m .client .TerminateSession (rpcCtx , & wtclientrpc.TerminateSessionRequest {
255- SessionId : sessionId ,
256- })
269+ resp , err := m .client .TerminateSession (rpcCtx ,
270+ & wtclientrpc.TerminateSessionRequest {
271+ SessionId : sessionId ,
272+ },
273+ )
257274 if err != nil {
258275 return "" , err
259276 }
0 commit comments