multi: return txns first and last indices

In this commit we introduce first and last indices for the
tranasctions returned which can be used to seek for further
transactions in a pagination style.

Signed-off-by: Abdullahi Yunus <abdoollahikbk@gmail.com>
This commit is contained in:
Abdullahi Yunus
2024-08-11 16:31:26 +01:00
parent cd1df4ac34
commit 762d01536b
13 changed files with 3135 additions and 3044 deletions

View File

@@ -2074,6 +2074,20 @@ var listChainTxnsCommand = cli.Command{
"transactions until the chain tip, including " +
"unconfirmed, set this value to -1",
},
cli.UintFlag{
Name: "index_offset",
Usage: "the index of a transaction that will be " +
"used in a query to determine which " +
"transaction should be returned in the " +
"response",
},
cli.IntFlag{
Name: "max_transactions",
Usage: "(optional) the max number of transactions to " +
"return; leave at default of 0 to return " +
"all transactions",
Value: 0,
},
},
Description: `
List all transactions an address of the wallet was involved in.
@@ -2096,7 +2110,10 @@ func listChainTxns(ctx *cli.Context) error {
client, cleanUp := getClient(ctx)
defer cleanUp()
req := &lnrpc.GetTransactionsRequest{}
req := &lnrpc.GetTransactionsRequest{
IndexOffset: uint32(ctx.Uint64("index_offset")),
MaxTransactions: uint32(ctx.Uint64("max_transactions")),
}
if ctx.IsSet("start_height") {
req.StartHeight = int32(ctx.Int64("start_height"))