rpc+cli: add general ListAliases function to dump all aliases

This commit is contained in:
eugene committed 2022-08-09 14:11:08 -04:00
1 parent 48f270fe20
commit aa576adecc
11 files changed
+1574 -1084

No files matched your search

+25
View File
@@ -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)
}
}