Skip to content

Commit f3796a3

Browse files
bhandrasguggero
authored andcommitted
walletkit: add startHeight to ListSweeps and ListSweepsVerbose
1 parent 1274ede commit f3796a3

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

lnd_services.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ var (
4141
// back version if none is specified in the configuration.
4242
minimalCompatibleVersion = &verrpc.Version{
4343
AppMajor: 0,
44-
AppMinor: 15,
44+
AppMinor: 17,
4545
AppPatch: 4,
4646
BuildTags: DefaultBuildTags,
4747
}

walletkit_client.go

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,17 @@ type WalletKitClient interface {
111111

112112
// ListSweeps returns a list of sweep transaction ids known to our node.
113113
// Note that this function only looks up transaction ids, and does not
114-
// query our wallet for the full set of transactions.
115-
ListSweeps(ctx context.Context) ([]string, error)
114+
// query our wallet for the full set of transactions. If startHeight is
115+
// set to zero it'll fetch all sweeps. If it's set to -1 it'll fetch the
116+
// pending sweeps only.
117+
ListSweeps(ctx context.Context, startHeight int32) ([]string, error)
116118

117119
// ListSweepsVerbose returns a list of sweep transactions known to our
118-
// node with verbose information about each sweep.
119-
ListSweepsVerbose(ctx context.Context) ([]lnwallet.TransactionDetail,
120-
error)
120+
// node with verbose information about each sweep. If startHeight is set
121+
// to zero it'll fetch all sweeps. If it's set to -1 it'll fetch the
122+
// pending sweeps only.
123+
ListSweepsVerbose(ctx context.Context, startHeight int32) (
124+
[]lnwallet.TransactionDetail, error)
121125

122126
// BumpFee attempts to bump the fee of a transaction by spending one of
123127
// its outputs at the given fee rate. This essentially results in a
@@ -528,14 +532,17 @@ func (m *walletKitClient) EstimateFeeRate(ctx context.Context, confTarget int32)
528532
// ListSweeps returns a list of sweep transaction ids known to our node.
529533
// Note that this function only looks up transaction ids (Verbose=false), and
530534
// does not query our wallet for the full set of transactions.
531-
func (m *walletKitClient) ListSweeps(ctx context.Context) ([]string, error) {
535+
func (m *walletKitClient) ListSweeps(ctx context.Context, startHeight int32) (
536+
[]string, error) {
537+
532538
rpcCtx, cancel := context.WithTimeout(ctx, m.timeout)
533539
defer cancel()
534540

535541
resp, err := m.client.ListSweeps(
536542
m.walletKitMac.WithMacaroonAuth(rpcCtx),
537543
&walletrpc.ListSweepsRequest{
538-
Verbose: false,
544+
Verbose: false,
545+
StartHeight: startHeight,
539546
},
540547
)
541548
if err != nil {
@@ -660,16 +667,17 @@ func UnmarshalTransactionDetail(tx *lnrpc.Transaction,
660667

661668
// ListSweepsVerbose returns a list of sweep transactions known to our node
662669
// with verbose information about each sweep.
663-
func (m *walletKitClient) ListSweepsVerbose(ctx context.Context) (
664-
[]lnwallet.TransactionDetail, error) {
670+
func (m *walletKitClient) ListSweepsVerbose(ctx context.Context,
671+
startHeight int32) ([]lnwallet.TransactionDetail, error) {
665672

666673
rpcCtx, cancel := context.WithTimeout(ctx, m.timeout)
667674
defer cancel()
668675

669676
resp, err := m.client.ListSweeps(
670677
m.walletKitMac.WithMacaroonAuth(rpcCtx),
671678
&walletrpc.ListSweepsRequest{
672-
Verbose: true,
679+
Verbose: true,
680+
StartHeight: startHeight,
673681
},
674682
)
675683
if err != nil {

0 commit comments

Comments
 (0)