OSDN Git Service

add logs (#371)
[bytom/vapor.git] / cmd / consensusreward / main.go
index b718511..b38d07a 100644 (file)
@@ -15,9 +15,9 @@ import (
 const logModule = "consensusereward"
 
 var (
-       rewardStartHeight uint64
-       rewardEndHeight   uint64
-       configFile        string
+       startHeight uint64
+       endHeight   uint64
+       configFile  string
 )
 
 var RootCmd = &cobra.Command{
@@ -27,8 +27,8 @@ var RootCmd = &cobra.Command{
 }
 
 func init() {
-       RootCmd.Flags().Uint64Var(&rewardStartHeight, "reward_start_height", 0, "The starting height of the distributive income reward interval, It is a multiple of the dpos consensus cycle(1200). example: 1200")
-       RootCmd.Flags().Uint64Var(&rewardEndHeight, "reward_end_height", 0, "The end height of the distributive income reward interval, It is a multiple of the dpos consensus cycle(1200). example: 2400")
+       RootCmd.Flags().Uint64Var(&startHeight, "start_height", 0, "The starting height of the distributive income reward interval, It is a multiple of the dpos consensus cycle(1200). example: 1200")
+       RootCmd.Flags().Uint64Var(&endHeight, "end_height", 0, "The end height of the distributive income reward interval, It is a multiple of the dpos consensus cycle(1200). example: 2400")
        RootCmd.Flags().StringVar(&configFile, "config_file", "reward.json", "config file. default: reward.json")
 }
 
@@ -38,11 +38,11 @@ func runReward(cmd *cobra.Command, args []string) error {
        if err := cfg.LoadConfigFile(configFile, config); err != nil {
                log.WithFields(log.Fields{"module": logModule, "config": configFile, "error": err}).Fatal("Failded to load config file.")
        }
-       if rewardStartHeight >= rewardEndHeight || rewardStartHeight%consensus.ActiveNetParams.RoundVoteBlockNums != 0 || rewardEndHeight%consensus.ActiveNetParams.RoundVoteBlockNums != 0 {
+       if startHeight >= endHeight || startHeight%consensus.ActiveNetParams.RoundVoteBlockNums != 0 || endHeight%consensus.ActiveNetParams.RoundVoteBlockNums != 0 {
                log.Fatal("Please check the height range, which must be multiple of the number of block rounds.")
        }
 
-       s := consensusreward.NewStandbyNodeReward(config, rewardStartHeight, rewardEndHeight)
+       s := consensusreward.NewStandbyNodeReward(config, startHeight, endHeight)
        if err := s.Settlement(); err != nil {
                log.WithFields(log.Fields{"module": logModule, "error": err}).Fatal("Standby node rewards failure.")
        }