multi: add a rpc endpoint to track the recovery process
This commit is contained in:
1 parent
c1ef5bb908
commit
987edc9d81
17 files changed
+1182
-613
No files matched your search
@@ -261,6 +261,10 @@ func mainRPCServerPermissions() map[string][]bakery.Op {
|
||||
Entity: "info",
|
||||
Action: "read",
|
||||
}},
|
||||
"/lnrpc.Lightning/GetRecoveryInfo": {{
|
||||
Entity: "info",
|
||||
Action: "read",
|
||||
}},
|
||||
"/lnrpc.Lightning/ListPeers": {{
|
||||
Entity: "peers",
|
||||
Action: "read",
|
||||
@@ -2481,6 +2485,27 @@ func (r *rpcServer) GetInfo(ctx context.Context,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// GetRecoveryInfo returns a boolean indicating whether the wallet is started
|
||||
// in recovery mode, whether the recovery is finished, and the progress made
|
||||
// so far.
|
||||
func (r *rpcServer) GetRecoveryInfo(ctx context.Context,
|
||||
in *lnrpc.GetRecoveryInfoRequest) (*lnrpc.GetRecoveryInfoResponse, error) {
|
||||
|
||||
isRecoveryMode, progress, err := r.server.cc.wallet.GetRecoveryInfo()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("unable to get wallet recovery info: %v", err)
|
||||
}
|
||||
|
||||
rpcsLog.Debugf("[getrecoveryinfo] is recovery mode=%v, progress=%v",
|
||||
isRecoveryMode, progress)
|
||||
|
||||
return &lnrpc.GetRecoveryInfoResponse{
|
||||
RecoveryMode: isRecoveryMode,
|
||||
RecoveryFinished: progress == 1,
|
||||
Progress: progress,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// ListPeers returns a verbose listing of all currently active peers.
|
||||
func (r *rpcServer) ListPeers(ctx context.Context,
|
||||
in *lnrpc.ListPeersRequest) (*lnrpc.ListPeersResponse, error) {
|
||||
|
||||
Reference in new issue
Block a user