lnrpc+rpcserver: return meaningful responses instead of empty
This commit is contained in:
4 files changed
+2872
-2660
No files matched your search
+2741
-2637
File diff suppressed because it is too large.
Load diff
@@ -643,6 +643,8 @@ message SendCustomMessageRequest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
message SendCustomMessageResponse {
|
message SendCustomMessageResponse {
|
||||||
|
// The status of the send operation.
|
||||||
|
string status = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message Utxo {
|
message Utxo {
|
||||||
@@ -1317,6 +1319,8 @@ message ConnectPeerRequest {
|
|||||||
uint64 timeout = 3;
|
uint64 timeout = 3;
|
||||||
}
|
}
|
||||||
message ConnectPeerResponse {
|
message ConnectPeerResponse {
|
||||||
|
// The status of the connect operation.
|
||||||
|
string status = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message DisconnectPeerRequest {
|
message DisconnectPeerRequest {
|
||||||
@@ -1324,6 +1328,8 @@ message DisconnectPeerRequest {
|
|||||||
string pub_key = 1;
|
string pub_key = 1;
|
||||||
}
|
}
|
||||||
message DisconnectPeerResponse {
|
message DisconnectPeerResponse {
|
||||||
|
// The status of the disconnect operation.
|
||||||
|
string status = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message HTLC {
|
message HTLC {
|
||||||
@@ -3542,6 +3548,8 @@ message NetworkInfo {
|
|||||||
message StopRequest {
|
message StopRequest {
|
||||||
}
|
}
|
||||||
message StopResponse {
|
message StopResponse {
|
||||||
|
// The status of the stop operation.
|
||||||
|
string status = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message GraphTopologySubscription {
|
message GraphTopologySubscription {
|
||||||
@@ -4366,9 +4374,13 @@ message DeleteAllPaymentsRequest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
message DeletePaymentResponse {
|
message DeletePaymentResponse {
|
||||||
|
// The status of the delete operation.
|
||||||
|
string status = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message DeleteAllPaymentsResponse {
|
message DeleteAllPaymentsResponse {
|
||||||
|
// The status of the delete operation.
|
||||||
|
string status = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message AbandonChannelRequest {
|
message AbandonChannelRequest {
|
||||||
@@ -4385,6 +4397,8 @@ message AbandonChannelRequest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
message AbandonChannelResponse {
|
message AbandonChannelResponse {
|
||||||
|
// The status of the abandon operation.
|
||||||
|
string status = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message DebugLevelRequest {
|
message DebugLevelRequest {
|
||||||
@@ -4724,12 +4738,15 @@ message RestoreChanBackupRequest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
message RestoreBackupResponse {
|
message RestoreBackupResponse {
|
||||||
|
// The number of channels successfully restored.
|
||||||
|
uint32 num_restored = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message ChannelBackupSubscription {
|
message ChannelBackupSubscription {
|
||||||
}
|
}
|
||||||
|
|
||||||
message VerifyChanBackupResponse {
|
message VerifyChanBackupResponse {
|
||||||
|
repeated string chan_points = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message MacaroonPermission {
|
message MacaroonPermission {
|
||||||
|
|||||||
@@ -3263,7 +3263,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"lnrpcAbandonChannelResponse": {
|
"lnrpcAbandonChannelResponse": {
|
||||||
"type": "object"
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"status": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "The status of the abandon operation."
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"lnrpcAddInvoiceResponse": {
|
"lnrpcAddInvoiceResponse": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
@@ -4593,7 +4599,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"lnrpcConnectPeerResponse": {
|
"lnrpcConnectPeerResponse": {
|
||||||
"type": "object"
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"status": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "The status of the connect operation."
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"lnrpcCustomMessage": {
|
"lnrpcCustomMessage": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
@@ -4635,7 +4647,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"lnrpcDeleteAllPaymentsResponse": {
|
"lnrpcDeleteAllPaymentsResponse": {
|
||||||
"type": "object"
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"status": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "The status of the delete operation."
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"lnrpcDeleteMacaroonIDResponse": {
|
"lnrpcDeleteMacaroonIDResponse": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
@@ -4647,10 +4665,22 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"lnrpcDeletePaymentResponse": {
|
"lnrpcDeletePaymentResponse": {
|
||||||
"type": "object"
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"status": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "The status of the delete operation."
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"lnrpcDisconnectPeerResponse": {
|
"lnrpcDisconnectPeerResponse": {
|
||||||
"type": "object"
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"status": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "The status of the disconnect operation."
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"lnrpcEdgeLocator": {
|
"lnrpcEdgeLocator": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
@@ -6922,7 +6952,14 @@
|
|||||||
"description": " - ANCHOR: We resolved an anchor output.\n - INCOMING_HTLC: We are resolving an incoming htlc on chain. This if this htlc is\nclaimed, we swept the incoming htlc with the preimage. If it is timed\nout, our peer swept the timeout path.\n - OUTGOING_HTLC: We are resolving an outgoing htlc on chain. If this htlc is claimed,\nthe remote party swept the htlc with the preimage. If it is timed out,\nwe swept it with the timeout path.\n - COMMIT: We force closed and need to sweep our time locked commitment output."
|
"description": " - ANCHOR: We resolved an anchor output.\n - INCOMING_HTLC: We are resolving an incoming htlc on chain. This if this htlc is\nclaimed, we swept the incoming htlc with the preimage. If it is timed\nout, our peer swept the timeout path.\n - OUTGOING_HTLC: We are resolving an outgoing htlc on chain. If this htlc is claimed,\nthe remote party swept the htlc with the preimage. If it is timed out,\nwe swept it with the timeout path.\n - COMMIT: We force closed and need to sweep our time locked commitment output."
|
||||||
},
|
},
|
||||||
"lnrpcRestoreBackupResponse": {
|
"lnrpcRestoreBackupResponse": {
|
||||||
"type": "object"
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"num_restored": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int64",
|
||||||
|
"description": "The number of channels successfully restored."
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"lnrpcRestoreChanBackupRequest": {
|
"lnrpcRestoreChanBackupRequest": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
@@ -7133,7 +7170,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"lnrpcSendCustomMessageResponse": {
|
"lnrpcSendCustomMessageResponse": {
|
||||||
"type": "object"
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"status": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "The status of the send operation."
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"lnrpcSendManyRequest": {
|
"lnrpcSendManyRequest": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
@@ -7338,7 +7381,13 @@
|
|||||||
"type": "object"
|
"type": "object"
|
||||||
},
|
},
|
||||||
"lnrpcStopResponse": {
|
"lnrpcStopResponse": {
|
||||||
"type": "object"
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"status": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "The status of the stop operation."
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"lnrpcStreamAuth": {
|
"lnrpcStreamAuth": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
@@ -7485,7 +7534,15 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"lnrpcVerifyChanBackupResponse": {
|
"lnrpcVerifyChanBackupResponse": {
|
||||||
"type": "object"
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"chan_points": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"lnrpcVerifyMessageRequest": {
|
"lnrpcVerifyMessageRequest": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
|||||||
+48
-14
@@ -1822,7 +1822,11 @@ func (r *rpcServer) ConnectPeer(ctx context.Context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
rpcsLog.Debugf("Connected to peer: %v", peerAddr.String())
|
rpcsLog.Debugf("Connected to peer: %v", peerAddr.String())
|
||||||
return &lnrpc.ConnectPeerResponse{}, nil
|
|
||||||
|
return &lnrpc.ConnectPeerResponse{
|
||||||
|
Status: fmt.Sprintf("connection to %v initiated",
|
||||||
|
peerAddr.String()),
|
||||||
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// DisconnectPeer attempts to disconnect one peer from another identified by a
|
// DisconnectPeer attempts to disconnect one peer from another identified by a
|
||||||
@@ -1884,7 +1888,9 @@ func (r *rpcServer) DisconnectPeer(ctx context.Context,
|
|||||||
return nil, fmt.Errorf("unable to disconnect peer: %w", err)
|
return nil, fmt.Errorf("unable to disconnect peer: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return &lnrpc.DisconnectPeerResponse{}, nil
|
return &lnrpc.DisconnectPeerResponse{
|
||||||
|
Status: "disconnect initiated",
|
||||||
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// newFundingShimAssembler returns a new fully populated
|
// newFundingShimAssembler returns a new fully populated
|
||||||
@@ -3165,7 +3171,9 @@ func (r *rpcServer) AbandonChannel(_ context.Context,
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return &lnrpc.AbandonChannelResponse{}, nil
|
return &lnrpc.AbandonChannelResponse{
|
||||||
|
Status: fmt.Sprintf("channel %v abandoned", chanPoint.String()),
|
||||||
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetInfo returns general information concerning the lightning node including
|
// GetInfo returns general information concerning the lightning node including
|
||||||
@@ -7035,7 +7043,10 @@ func (r *rpcServer) StopDaemon(_ context.Context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
r.interceptor.RequestShutdown()
|
r.interceptor.RequestShutdown()
|
||||||
return &lnrpc.StopResponse{}, nil
|
|
||||||
|
return &lnrpc.StopResponse{
|
||||||
|
Status: "shutdown initiated, check logs for progress",
|
||||||
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// SubscribeChannelGraph launches a streaming RPC that allows the caller to
|
// SubscribeChannelGraph launches a streaming RPC that allows the caller to
|
||||||
@@ -7286,7 +7297,9 @@ func (r *rpcServer) DeletePayment(ctx context.Context,
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return &lnrpc.DeletePaymentResponse{}, nil
|
return &lnrpc.DeletePaymentResponse{
|
||||||
|
Status: "payment deleted",
|
||||||
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteAllPayments deletes all outgoing payments from DB.
|
// DeleteAllPayments deletes all outgoing payments from DB.
|
||||||
@@ -7319,14 +7332,17 @@ func (r *rpcServer) DeleteAllPayments(ctx context.Context,
|
|||||||
"failed_htlcs_only=%v", req.FailedPaymentsOnly,
|
"failed_htlcs_only=%v", req.FailedPaymentsOnly,
|
||||||
req.FailedHtlcsOnly)
|
req.FailedHtlcsOnly)
|
||||||
|
|
||||||
_, err := r.server.miscDB.DeletePayments(
|
numDeletedPayments, err := r.server.miscDB.DeletePayments(
|
||||||
req.FailedPaymentsOnly, req.FailedHtlcsOnly,
|
req.FailedPaymentsOnly, req.FailedHtlcsOnly,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return &lnrpc.DeleteAllPaymentsResponse{}, nil
|
return &lnrpc.DeleteAllPaymentsResponse{
|
||||||
|
Status: fmt.Sprintf("%v payments deleted, failed_htlcs_only=%v",
|
||||||
|
numDeletedPayments, req.FailedHtlcsOnly),
|
||||||
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// DebugLevel allows a caller to programmatically set the logging verbosity of
|
// DebugLevel allows a caller to programmatically set the logging verbosity of
|
||||||
@@ -7974,6 +7990,10 @@ func (r *rpcServer) ExportChannelBackup(ctx context.Context,
|
|||||||
func (r *rpcServer) VerifyChanBackup(ctx context.Context,
|
func (r *rpcServer) VerifyChanBackup(ctx context.Context,
|
||||||
in *lnrpc.ChanBackupSnapshot) (*lnrpc.VerifyChanBackupResponse, error) {
|
in *lnrpc.ChanBackupSnapshot) (*lnrpc.VerifyChanBackupResponse, error) {
|
||||||
|
|
||||||
|
var (
|
||||||
|
channels []chanbackup.Single
|
||||||
|
err error
|
||||||
|
)
|
||||||
switch {
|
switch {
|
||||||
// If neither a Single or Multi has been specified, then we have nothing
|
// If neither a Single or Multi has been specified, then we have nothing
|
||||||
// to verify.
|
// to verify.
|
||||||
@@ -8004,7 +8024,7 @@ func (r *rpcServer) VerifyChanBackup(ctx context.Context,
|
|||||||
// With our PackedSingles created, we'll attempt to unpack the
|
// With our PackedSingles created, we'll attempt to unpack the
|
||||||
// backup. If this fails, then we know the backup is invalid for
|
// backup. If this fails, then we know the backup is invalid for
|
||||||
// some reason.
|
// some reason.
|
||||||
_, err := chanBackup.Unpack(r.server.cc.KeyRing)
|
channels, err = chanBackup.Unpack(r.server.cc.KeyRing)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("invalid single channel "+
|
return nil, fmt.Errorf("invalid single channel "+
|
||||||
"backup: %v", err)
|
"backup: %v", err)
|
||||||
@@ -8018,14 +8038,20 @@ func (r *rpcServer) VerifyChanBackup(ctx context.Context,
|
|||||||
|
|
||||||
// We'll now attempt to unpack the Multi. If this fails, then we
|
// We'll now attempt to unpack the Multi. If this fails, then we
|
||||||
// know it's invalid.
|
// know it's invalid.
|
||||||
_, err := packedMulti.Unpack(r.server.cc.KeyRing)
|
multi, err := packedMulti.Unpack(r.server.cc.KeyRing)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("invalid multi channel backup: "+
|
return nil, fmt.Errorf("invalid multi channel backup: "+
|
||||||
"%v", err)
|
"%v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
channels = multi.StaticBackups
|
||||||
}
|
}
|
||||||
|
|
||||||
return &lnrpc.VerifyChanBackupResponse{}, nil
|
return &lnrpc.VerifyChanBackupResponse{
|
||||||
|
ChanPoints: fn.Map(func(c chanbackup.Single) string {
|
||||||
|
return c.FundingOutpoint.String()
|
||||||
|
}, channels),
|
||||||
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// createBackupSnapshot converts the passed Single backup into a snapshot which
|
// createBackupSnapshot converts the passed Single backup into a snapshot which
|
||||||
@@ -8142,6 +8168,10 @@ func (r *rpcServer) RestoreChannelBackups(ctx context.Context,
|
|||||||
|
|
||||||
// We'll accept either a list of Single backups, or a single Multi
|
// We'll accept either a list of Single backups, or a single Multi
|
||||||
// backup which contains several single backups.
|
// backup which contains several single backups.
|
||||||
|
var (
|
||||||
|
numRestored int
|
||||||
|
err error
|
||||||
|
)
|
||||||
switch {
|
switch {
|
||||||
case in.GetChanBackups() != nil:
|
case in.GetChanBackups() != nil:
|
||||||
chanBackupsProtos := in.GetChanBackups()
|
chanBackupsProtos := in.GetChanBackups()
|
||||||
@@ -8159,7 +8189,7 @@ func (r *rpcServer) RestoreChannelBackups(ctx context.Context,
|
|||||||
// write the new backups to disk, and then attempt to connect
|
// write the new backups to disk, and then attempt to connect
|
||||||
// out to any peers that we know of which were our prior
|
// out to any peers that we know of which were our prior
|
||||||
// channel peers.
|
// channel peers.
|
||||||
_, err := chanbackup.UnpackAndRecoverSingles(
|
numRestored, err = chanbackup.UnpackAndRecoverSingles(
|
||||||
chanbackup.PackedSingles(packedBackups),
|
chanbackup.PackedSingles(packedBackups),
|
||||||
r.server.cc.KeyRing, chanRestorer, r.server,
|
r.server.cc.KeyRing, chanRestorer, r.server,
|
||||||
)
|
)
|
||||||
@@ -8176,7 +8206,7 @@ func (r *rpcServer) RestoreChannelBackups(ctx context.Context,
|
|||||||
// out to any peers that we know of which were our prior
|
// out to any peers that we know of which were our prior
|
||||||
// channel peers.
|
// channel peers.
|
||||||
packedMulti := chanbackup.PackedMulti(packedMultiBackup)
|
packedMulti := chanbackup.PackedMulti(packedMultiBackup)
|
||||||
_, err := chanbackup.UnpackAndRecoverMulti(
|
numRestored, err = chanbackup.UnpackAndRecoverMulti(
|
||||||
packedMulti, r.server.cc.KeyRing, chanRestorer,
|
packedMulti, r.server.cc.KeyRing, chanRestorer,
|
||||||
r.server,
|
r.server,
|
||||||
)
|
)
|
||||||
@@ -8186,7 +8216,9 @@ func (r *rpcServer) RestoreChannelBackups(ctx context.Context,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return &lnrpc.RestoreBackupResponse{}, nil
|
return &lnrpc.RestoreBackupResponse{
|
||||||
|
NumRestored: uint32(numRestored),
|
||||||
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// SubscribeChannelBackups allows a client to sub-subscribe to the most up to
|
// SubscribeChannelBackups allows a client to sub-subscribe to the most up to
|
||||||
@@ -8807,7 +8839,9 @@ func (r *rpcServer) SendCustomMessage(ctx context.Context, req *lnrpc.SendCustom
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return &lnrpc.SendCustomMessageResponse{}, nil
|
return &lnrpc.SendCustomMessageResponse{
|
||||||
|
Status: "message sent successfully",
|
||||||
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// SubscribeCustomMessages subscribes to a stream of incoming custom peer
|
// SubscribeCustomMessages subscribes to a stream of incoming custom peer
|
||||||
|
|||||||
Reference in new issue
Block a user