mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-28 06:32:18 +02:00
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:
committed by
Olaoluwa Osuntokun
parent
343cd7779f
commit
eb4d0e035e
@@ -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