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:
Andras Banki-Horvath committed 2020-03-27 13:56:08 +01:00
1 parent 3fe9c70722
commit 7e50997bb4
7 files changed
+1222 -780

No files matched your search

+25
View File
@@ -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",