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:
BitfuryLightning
2016-12-05 06:59:36 -05:00
committed by Olaoluwa Osuntokun
parent 343cd7779f
commit eb4d0e035e
12 changed files with 1117 additions and 168 deletions

View File

@@ -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
}

View File

@@ -66,6 +66,7 @@ func main() {
ListInvoicesCommand,
ShowRoutingTableCommand,
ListChannelsCommand,
ListPaymentsCommand,
}
if err := app.Run(os.Args); err != nil {