channeldb: save outgoing payments
Add structure for outgoing payments. Saving payment in DB after successful payment send. Add RPC call for listing all payments.
This commit is contained in:
1 parent
343cd7779f
commit
eb4d0e035e
12 files changed
+1117
-168
No files matched your search
@@ -1076,3 +1076,27 @@ func printRTAsJSON(r *rt.RoutingTable) {
|
||||
}
|
||||
printRespJson(channels)
|
||||
}
|
||||
|
||||
|
||||
|
||||
var ListPaymentsCommand = cli.Command{
|
||||
Name: "listpayments",
|
||||
Usage: "listpayments",
|
||||
Description: "list all outgoing payments",
|
||||
Action: listPayments,
|
||||
}
|
||||
|
||||
func listPayments(ctx *cli.Context) error {
|
||||
client := getClient(ctx)
|
||||
|
||||
req := &lnrpc.ListPaymentsRequest{}
|
||||
|
||||
payments, err := client.ListPayments(context.Background(), req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
printRespJson(payments)
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -66,6 +66,7 @@ func main() {
|
||||
ListInvoicesCommand,
|
||||
ShowRoutingTableCommand,
|
||||
ListChannelsCommand,
|
||||
ListPaymentsCommand,
|
||||
}
|
||||
|
||||
if err := app.Run(os.Args); err != nil {
|
||||
|
||||
Reference in new issue
Block a user