diff --git a/cmd/commands/cmd_custom.go b/cmd/commands/cmd_custom.go index 728d70bd3..5f3b4c6b7 100644 --- a/cmd/commands/cmd_custom.go +++ b/cmd/commands/cmd_custom.go @@ -41,15 +41,16 @@ func sendCustom(ctx *cli.Context) error { return err } - _, err = client.SendCustomMessage( - ctxc, - &lnrpc.SendCustomMessageRequest{ + resp, err := client.SendCustomMessage( + ctxc, &lnrpc.SendCustomMessageRequest{ Peer: peer, Type: uint32(msgType), Data: data, }, ) + printRespJSON(resp) + return err } diff --git a/cmd/commands/cmd_payments.go b/cmd/commands/cmd_payments.go index c8787a6cc..bac729cd8 100644 --- a/cmd/commands/cmd_payments.go +++ b/cmd/commands/cmd_payments.go @@ -26,6 +26,7 @@ import ( "github.com/lightningnetwork/lnd/routing/route" "github.com/urfave/cli" "google.golang.org/grpc" + "google.golang.org/protobuf/proto" ) const ( @@ -1781,11 +1782,7 @@ func deletePayments(ctx *cli.Context) error { failedHTLCsOnly = ctx.Bool("failed_htlcs_only") includeNonFailed = ctx.Bool("include_non_failed") err error - okMsg = struct { - OK bool `json:"ok"` - }{ - OK: true, - } + resp proto.Message ) // We pack two RPCs into the same CLI so there are a few non-valid @@ -1812,10 +1809,12 @@ func deletePayments(ctx *cli.Context) error { err) } - _, err = client.DeletePayment(ctxc, &lnrpc.DeletePaymentRequest{ - PaymentHash: paymentHash, - FailedHtlcsOnly: failedHTLCsOnly, - }) + resp, err = client.DeletePayment( + ctxc, &lnrpc.DeletePaymentRequest{ + PaymentHash: paymentHash, + FailedHtlcsOnly: failedHTLCsOnly, + }, + ) if err != nil { return fmt.Errorf("error deleting single payment: %w", err) @@ -1832,7 +1831,7 @@ func deletePayments(ctx *cli.Context) error { fmt.Printf("Removing %s payments, this might take a while...\n", what) - _, err = client.DeleteAllPayments( + resp, err = client.DeleteAllPayments( ctxc, &lnrpc.DeleteAllPaymentsRequest{ AllPayments: includeNonFailed, FailedPaymentsOnly: !includeNonFailed, @@ -1844,9 +1843,7 @@ func deletePayments(ctx *cli.Context) error { } } - // Users are confused by empty JSON outputs so let's return a simple OK - // instead of just printing the empty response RPC message. - printJSON(okMsg) + printJSON(resp) return nil } diff --git a/cmd/commands/commands.go b/cmd/commands/commands.go index d24ce6365..de13022f0 100644 --- a/cmd/commands/commands.go +++ b/cmd/commands/commands.go @@ -2128,11 +2128,13 @@ func stopDaemon(ctx *cli.Context) error { client, cleanUp := getClient(ctx) defer cleanUp() - _, err := client.StopDaemon(ctxc, &lnrpc.StopRequest{}) + resp, err := client.StopDaemon(ctxc, &lnrpc.StopRequest{}) if err != nil { return err } + printRespJSON(resp) + return nil } @@ -2997,10 +2999,12 @@ func restoreChanBackup(ctx *cli.Context) error { req.Backup = backups.Backup - _, err = client.RestoreChannelBackups(ctxc, &req) + resp, err := client.RestoreChannelBackups(ctxc, &req) if err != nil { return fmt.Errorf("unable to restore chan backups: %w", err) } + printRespJSON(resp) + return nil }