mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-10-11 10:43:00 +02:00
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:
@@ -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