lnrpc: add ForwardingHistory for querying payment circuit time series

In this commit, we add a new method to the RPC service:
ForwardingHistory. This method will allow callers to query for the
completed payment circuits in a particular time slice, skip a series of
events, and also paginate within a time slice.
This commit is contained in:
Olaoluwa Osuntokun committed 2018-03-06 13:56:12 -05:00
1 parent ff720e1252
commit 36f214f48c
4 files changed
+782 -318

No files matched your search

+120
View File
@@ -670,6 +670,34 @@
]
}
},
"/v1/switch": {
"post": {
"summary": "* lncli: `forwardinghistory`\nForwardingHistory allows the caller to query the htlcswitch for a record of\nall HTLC's forwarded within the target time range, and integer offset\nwithin that time range. If no time-range is specified, then the first chunk\nof the past 24 hrs of forwarding history are returned.",
"description": "A list of forwarding events are returned. The size of each forwarding event\nis 40 bytes, and the max message size able to be returned in gRPC is 4 MiB.\nAs a result each message can only contain 50k entries. Each response has\nthe index offset of the last entry. The index offset can be provided to the\nrequest to allow the caller to skip a series of records.",
"operationId": "ForwardingHistory",
"responses": {
"200": {
"description": "",
"schema": {
"$ref": "#/definitions/lnrpcForwardingHistoryResponse"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/lnrpcForwardingHistoryRequest"
}
}
],
"tags": [
"Lightning"
]
}
},
"/v1/transactions": {
"get": {
"summary": "* lncli: `listchaintxns`\nGetTransactions returns a list describing all the known transactions\nrelevant to the wallet.",
@@ -1189,6 +1217,98 @@
"$ref": "#/definitions/lnrpcChannelFeeReport"
},
"description": "/ An array of channel fee reports which describes the current fee schedule for each channel."
},
"day_fee_sum": {
"type": "string",
"format": "uint64",
"description": "/ The total amount of fee revenue (in satoshis) the switch has collected over the past 24 hrs."
},
"week_fee_sum": {
"type": "string",
"format": "uint64",
"description": "/ The total amount of fee revenue (in satoshis) the switch has collected over the past 1 week."
},
"month_fee_sum": {
"type": "string",
"format": "uint64",
"description": "/ The total amount of fee revenue (in satoshis) the switch has collected over the past 1 month."
}
}
},
"lnrpcForwardingEvent": {
"type": "object",
"properties": {
"timestamp": {
"type": "string",
"format": "uint64",
"description": "/ Timestamp is the time (unix epoch offset) that this circuit was completed."
},
"chan_id_in": {
"type": "string",
"format": "uint64",
"description": "/ The incoming channel ID that carried the HTLC that created the circuit."
},
"chan_id_out": {
"type": "string",
"format": "uint64",
"description": "/ The outgoing channel ID that carried the preimage that completed the circuit."
},
"amt_in": {
"type": "string",
"format": "uint64",
"description": "/ The total amount of the incoming HTLC that created half the circuit."
},
"amt_out": {
"type": "string",
"format": "uint64",
"description": "/ The total amount of the outgoign HTLC that created the second half of the circuit."
},
"fee": {
"type": "string",
"format": "uint64",
"description": "/ The total fee that this payment circuit carried."
}
}
},
"lnrpcForwardingHistoryRequest": {
"type": "object",
"properties": {
"start_time": {
"type": "string",
"format": "uint64",
"description": "/ Start time is the starting point of the forwarding history request. All records beyond this point will be included, respecting the end time, and the index offset."
},
"end_time": {
"type": "string",
"format": "uint64",
"description": "/ End time is the end point of the forwarding history request. The response will carry at most 50k records between the start time and the end time. The index offset can be used to implement pagination."
},
"index_offset": {
"type": "integer",
"format": "int64",
"description": "/ Index offset is the offset in the time series to start at. As each response can only contain 50k records, callers can use this to skip around within a packed time series."
},
"num_max_events": {
"type": "integer",
"format": "int64",
"description": "/ The max number of events to return in the response to this query."
}
}
},
"lnrpcForwardingHistoryResponse": {
"type": "object",
"properties": {
"forwarding_events": {
"type": "array",
"items": {
"$ref": "#/definitions/lnrpcForwardingEvent"
},
"description": "/ A list of forwarding events from the time slice of the time series specified in the request."
},
"last_offset_index": {
"type": "integer",
"format": "int64",
"description": "/ The index of the last time in the set of returned forwarding events. Can be used to seek further, pagination style."
}
}
},