github.com/decred/dcrlnd@v0.7.6/cmd/dcrlncli/cmd_dcrlnd.go (about) 1 package main 2 3 import ( 4 "github.com/decred/dcrlnd/lnrpc" 5 "github.com/urfave/cli" 6 ) 7 8 var calcPayStatsCommand = cli.Command{ 9 Name: "calcpaystats", 10 Usage: "Scans the db and generates a report on total payment counts.", 11 ArgsUsage: "", 12 Category: "Payments", 13 Description: ` 14 Goes through the DB and generates a report on total number of payments 15 made, settled and failed. 16 17 NOTE: This requires a scan through the entire set of payments in the DB, 18 so it may be slow on nodes that have a large number of payments. 19 `, 20 Action: actionDecorator(calcPayStats), 21 } 22 23 func calcPayStats(ctx *cli.Context) error { 24 ctxc := getContext() 25 26 client, cleanUp := getClient(ctx) 27 defer cleanUp() 28 29 req := &lnrpc.CalcPaymentStatsRequest{} 30 resp, err := client.CalcPaymentStats(ctxc, req) 31 if err != nil { 32 return err 33 } 34 35 printRespJSON(resp) 36 37 return nil 38 }