multi: specify start and end height for ListTransactionDetails

Add start and end height parameters to the rpc and cli GetTransactions
endpoints. Default to returning all transactions from genesis to tip,
including unconfirmed transactions to maintain backwards compatibility.
This commit is contained in:
carla committed 2020-05-05 21:10:06 +02:00
1 parent fcc18b6815
commit 537dac3c62
10 files changed
+913 -736

No files matched your search

+733 -707
View File
File diff suppressed because it is too large. Load diff
+8
View File
@@ -114,10 +114,18 @@ func request_Lightning_ChannelBalance_0(ctx context.Context, marshaler runtime.M
}
var (
filter_Lightning_GetTransactions_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
func request_Lightning_GetTransactions_0(ctx context.Context, marshaler runtime.Marshaler, client LightningClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq GetTransactionsRequest
var metadata runtime.ServerMetadata
if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_Lightning_GetTransactions_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.GetTransactions(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
+15
View File
@@ -897,7 +897,22 @@ message Transaction {
string raw_tx_hex = 9;
}
message GetTransactionsRequest {
/*
The height from which to list transactions, inclusive. If this value is
greater than end_height, transactions will be read in reverse.
*/
int32 start_height = 1;
/*
The height until which to list transactions, inclusive. To include
unconfirmed transactions, this value should be set to -1, which will
return transactions from start_height until the current chain tip and
unconfirmed transactions. If no end_height is provided, the call will
default to this option.
*/
int32 end_height = 2;
}
message TransactionDetails {
/// The list of transactions relevant to the wallet.
repeated Transaction transactions = 1;
+18
View File
@@ -1377,6 +1377,24 @@
}
}
},
"parameters": [
{
"name": "start_height",
"description": "The height from which to list transactions, inclusive. If this value is\ngreater than end_height, transactions will be read in reverse.",
"in": "query",
"required": false,
"type": "integer",
"format": "int32"
},
{
"name": "end_height",
"description": "The height until which to list transactions, inclusive. To include\nunconfirmed transactions, this value should be set to -1, which will\nreturn transactions from start_height until the current chain tip and\nunconfirmed transactions. If no end_height is provided, the call will\ndefault to this option.",
"in": "query",
"required": false,
"type": "integer",
"format": "int32"
}
],
"tags": [
"Lightning"
]