rpc+cli: add general ListAliases function to dump all aliases
This commit is contained in:
11 files changed
+1574
-1084
No files matched your search
@@ -1700,4 +1700,29 @@ func RegisterLightningJSONCallbacks(registry map[string]func(ctx context.Context
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
registry["lnrpc.Lightning.ListAliases"] = func(ctx context.Context,
|
||||
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
||||
|
||||
req := &ListAliasesRequest{}
|
||||
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
||||
if err != nil {
|
||||
callback("", err)
|
||||
return
|
||||
}
|
||||
|
||||
client := NewLightningClient(conn)
|
||||
resp, err := client.ListAliases(ctx, req)
|
||||
if err != nil {
|
||||
callback("", err)
|
||||
return
|
||||
}
|
||||
|
||||
respBytes, err := marshaler.Marshal(resp)
|
||||
if err != nil {
|
||||
callback("", err)
|
||||
return
|
||||
}
|
||||
callback(string(respBytes), nil)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user