lnrpc: add betweenness centrality to GetNodeMetrics (new RPC call)
This commit extends the RPC interface with GetNodeMetrics will contain all graph node metrics in the future. Currently only holds betweennes centrality per node.
This commit is contained in:
1 parent
3fe9c70722
commit
7e50997bb4
7 files changed
+1222
-780
No files matched your search
@@ -2974,6 +2974,31 @@ func describeGraph(ctx *cli.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
var getNodeMetricsCommand = cli.Command{
|
||||
Name: "getnodemetrics",
|
||||
Category: "Graph",
|
||||
Description: "Prints out node metrics calculated from the current graph",
|
||||
Usage: "Get node metrics.",
|
||||
Action: actionDecorator(getNodeMetrics),
|
||||
}
|
||||
|
||||
func getNodeMetrics(ctx *cli.Context) error {
|
||||
client, cleanUp := getClient(ctx)
|
||||
defer cleanUp()
|
||||
|
||||
req := &lnrpc.NodeMetricsRequest{
|
||||
Types: []lnrpc.NodeMetricType{lnrpc.NodeMetricType_BETWEENNESS_CENTRALITY},
|
||||
}
|
||||
|
||||
nodeMetrics, err := client.GetNodeMetrics(context.Background(), req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
printRespJSON(nodeMetrics)
|
||||
return nil
|
||||
}
|
||||
|
||||
var listPaymentsCommand = cli.Command{
|
||||
Name: "listpayments",
|
||||
Category: "Payments",
|
||||
|
||||
Reference in new issue
Block a user