Skip to content

Commit

Permalink
walletkit: add startHeight to ListSweeps and ListSweepsVerbose
Browse files Browse the repository at this point in the history
  • Loading branch information
bhandras authored and guggero committed Aug 26, 2024
1 parent 1274ede commit f3796a3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
2 changes: 1 addition & 1 deletion lnd_services.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ var (
// back version if none is specified in the configuration.
minimalCompatibleVersion = &verrpc.Version{
AppMajor: 0,
AppMinor: 15,
AppMinor: 17,
AppPatch: 4,
BuildTags: DefaultBuildTags,
}
Expand Down
28 changes: 18 additions & 10 deletions walletkit_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,17 @@ type WalletKitClient interface {

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

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

// BumpFee attempts to bump the fee of a transaction by spending one of
// its outputs at the given fee rate. This essentially results in a
Expand Down Expand Up @@ -528,14 +532,17 @@ func (m *walletKitClient) EstimateFeeRate(ctx context.Context, confTarget int32)
// ListSweeps returns a list of sweep transaction ids known to our node.
// Note that this function only looks up transaction ids (Verbose=false), and
// does not query our wallet for the full set of transactions.
func (m *walletKitClient) ListSweeps(ctx context.Context) ([]string, error) {
func (m *walletKitClient) ListSweeps(ctx context.Context, startHeight int32) (
[]string, error) {

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

resp, err := m.client.ListSweeps(
m.walletKitMac.WithMacaroonAuth(rpcCtx),
&walletrpc.ListSweepsRequest{
Verbose: false,
Verbose: false,
StartHeight: startHeight,
},
)
if err != nil {
Expand Down Expand Up @@ -660,16 +667,17 @@ func UnmarshalTransactionDetail(tx *lnrpc.Transaction,

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

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

resp, err := m.client.ListSweeps(
m.walletKitMac.WithMacaroonAuth(rpcCtx),
&walletrpc.ListSweepsRequest{
Verbose: true,
Verbose: true,
StartHeight: startHeight,
},
)
if err != nil {
Expand Down

0 comments on commit f3796a3

Please sign in to comment.