Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
1,632 additions
and
446 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// +build routerrpc | ||
|
||
package main | ||
|
||
import ( | ||
"context" | ||
"encoding/hex" | ||
|
||
"github.com/lightningnetwork/lnd/lnrpc/routerrpc" | ||
|
||
"github.com/urfave/cli" | ||
) | ||
|
||
var queryMissionControlCommand = cli.Command{ | ||
Name: "querymc", | ||
Category: "Payments", | ||
Action: actionDecorator(queryMissionControl), | ||
} | ||
|
||
func queryMissionControl(ctx *cli.Context) error { | ||
conn := getClientConn(ctx, false) | ||
defer conn.Close() | ||
|
||
client := routerrpc.NewRouterClient(conn) | ||
|
||
req := &routerrpc.QueryMissionControlRequest{} | ||
rpcCtx := context.Background() | ||
snapshot, err := client.QueryMissionControl(rpcCtx, req) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
type displayNodeHistory struct { | ||
Pubkey string | ||
LastFailTime int64 | ||
OtherChanSuccessProb float32 | ||
Channels []*routerrpc.ChannelHistory | ||
} | ||
|
||
displayResp := struct { | ||
Nodes []displayNodeHistory | ||
}{ | ||
make([]displayNodeHistory, len(snapshot.Nodes)), | ||
} | ||
|
||
for i, n := range snapshot.Nodes { | ||
displayResp.Nodes[i] = displayNodeHistory{ | ||
Pubkey: hex.EncodeToString(n.Pubkey), | ||
LastFailTime: n.LastFailTime, | ||
OtherChanSuccessProb: n.OtherChanSuccessProb, | ||
Channels: n.Channels, | ||
} | ||
} | ||
|
||
printJSON(displayResp) | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// +build routerrpc | ||
|
||
package main | ||
|
||
import "github.com/urfave/cli" | ||
|
||
// routerCommands will return nil for non-routerrpc builds. | ||
func routerCommands() []cli.Command { | ||
return []cli.Command{queryMissionControlCommand} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// +build !routerrpc | ||
|
||
package main | ||
|
||
import "github.com/urfave/cli" | ||
|
||
// routerCommands will return nil for non-routerrpc builds. | ||
func routerCommands() []cli.Command { | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.