mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-10-09 19:33:31 +02:00
lnrpc: use new ExcludeExhaustedSessions option
This commit is contained in:
@@ -269,7 +269,7 @@ func (c *WatchtowerClient) ListTowers(ctx context.Context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
opts, ackCounts, committedUpdateCounts := constructFunctionalOptions(
|
opts, ackCounts, committedUpdateCounts := constructFunctionalOptions(
|
||||||
req.IncludeSessions,
|
req.IncludeSessions, req.ExcludeExhaustedSessions,
|
||||||
)
|
)
|
||||||
|
|
||||||
anchorTowers, err := c.cfg.AnchorClient.RegisteredTowers(opts...)
|
anchorTowers, err := c.cfg.AnchorClient.RegisteredTowers(opts...)
|
||||||
@@ -334,7 +334,7 @@ func (c *WatchtowerClient) GetTowerInfo(ctx context.Context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
opts, ackCounts, committedUpdateCounts := constructFunctionalOptions(
|
opts, ackCounts, committedUpdateCounts := constructFunctionalOptions(
|
||||||
req.IncludeSessions,
|
req.IncludeSessions, req.ExcludeExhaustedSessions,
|
||||||
)
|
)
|
||||||
|
|
||||||
// Get the tower and its sessions from anchors client.
|
// Get the tower and its sessions from anchors client.
|
||||||
@@ -377,9 +377,9 @@ func (c *WatchtowerClient) GetTowerInfo(ctx context.Context,
|
|||||||
// functional options to be used when fetching a tower from the DB. It also
|
// functional options to be used when fetching a tower from the DB. It also
|
||||||
// returns a map of acked-update counts and one for un-acked-update counts that
|
// returns a map of acked-update counts and one for un-acked-update counts that
|
||||||
// will be populated once the db call has been made.
|
// will be populated once the db call has been made.
|
||||||
func constructFunctionalOptions(includeSessions bool) (
|
func constructFunctionalOptions(includeSessions,
|
||||||
[]wtdb.ClientSessionListOption, map[wtdb.SessionID]uint16,
|
excludeExhaustedSessions bool) ([]wtdb.ClientSessionListOption,
|
||||||
map[wtdb.SessionID]uint16) {
|
map[wtdb.SessionID]uint16, map[wtdb.SessionID]uint16) {
|
||||||
|
|
||||||
var (
|
var (
|
||||||
opts []wtdb.ClientSessionListOption
|
opts []wtdb.ClientSessionListOption
|
||||||
@@ -407,6 +407,12 @@ func constructFunctionalOptions(includeSessions bool) (
|
|||||||
wtdb.WithPerCommittedUpdate(perCommittedUpdate),
|
wtdb.WithPerCommittedUpdate(perCommittedUpdate),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if excludeExhaustedSessions {
|
||||||
|
opts = append(opts, wtdb.WithPostEvalFilterFn(
|
||||||
|
wtclient.ExhaustedSessionFilter(),
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
return opts, ackCounts, committedUpdateCounts
|
return opts, ackCounts, committedUpdateCounts
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user