mirror of
https://github.com/lightningnetwork/lnd.git
synced 2024-11-19 01:43:16 +01:00
cmd/lncli: print new status responses to CLI
This commit is contained in:
parent
d89ea2d335
commit
870e845a1e
@ -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
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user