-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2802 from joostjager/probability
routing: probability based path finding
- Loading branch information
Showing
27 changed files
with
1,593 additions
and
416 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,59 @@ | ||
// +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 | ||
}{} | ||
|
||
for _, n := range snapshot.Nodes { | ||
displayResp.Nodes = append( | ||
displayResp.Nodes, | ||
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
Oops, something went wrong.