permission: removed unused eth from args and revert passing eth channel to raft

This commit is contained in:
amalraj.manigmail.com 2019-05-08 14:33:24 +08:00
parent 7e4b3ff310
commit cfc59bab76
1 changed files with 6 additions and 6 deletions

View File

@ -162,10 +162,8 @@ func makeFullNode(ctx *cli.Context) *node.Node {
ethChan := utils.RegisterEthService(stack, &cfg.Eth)
ethereum := <-ethChan
if ctx.GlobalBool(utils.RaftModeFlag.Name) {
RegisterRaftService(stack, ctx, cfg, ethereum)
RegisterRaftService(stack, ctx, cfg, ethChan)
}
if ctx.GlobalBool(utils.DashboardEnabledFlag.Name) {
@ -173,7 +171,7 @@ func makeFullNode(ctx *cli.Context) *node.Node {
}
if ctx.GlobalBool(utils.EnableNodePermissionFlag.Name) {
RegisterPermissionService(ctx, stack, ethereum)
RegisterPermissionService(ctx, stack)
}
// Whisper must be explicitly enabled by specifying at least 1 whisper flag or in dev mode
@ -198,7 +196,7 @@ func makeFullNode(ctx *cli.Context) *node.Node {
}
return stack
}
func RegisterPermissionService(ctx *cli.Context, stack *node.Node, ethereum *eth.Ethereum) {
func RegisterPermissionService(ctx *cli.Context, stack *node.Node) {
if err := stack.Register(func(sctx *node.ServiceContext) (node.Service, error) {
dataDir := ctx.GlobalString(utils.DataDirFlag.Name)
var permissionConfig types.PermissionConfig
@ -239,7 +237,7 @@ func dumpConfig(ctx *cli.Context) error {
return nil
}
func RegisterRaftService(stack *node.Node, ctx *cli.Context, cfg gethConfig, ethereum *eth.Ethereum) {
func RegisterRaftService(stack *node.Node, ctx *cli.Context, cfg gethConfig, ethChan <-chan *eth.Ethereum) {
blockTimeMillis := ctx.GlobalInt(utils.RaftBlockTimeFlag.Name)
datadir := ctx.GlobalString(utils.DataDirFlag.Name)
joinExistingId := ctx.GlobalInt(utils.RaftJoinExistingFlag.Name)
@ -280,6 +278,8 @@ func RegisterRaftService(stack *node.Node, ctx *cli.Context, cfg gethConfig, eth
}
}
ethereum := <-ethChan
return raft.New(ctx, ethereum.ChainConfig(), myId, raftPort, joinExisting, blockTimeNanos, ethereum, peers, datadir)
}); err != nil {
utils.Fatalf("Failed to register the Raft service: %v", err)