Fix comment

pull/1921/head
Rongjian Lan 5 years ago
parent 1e7822d77f
commit e0ea579922
  1. 10
      cmd/harmony/main.go
  2. 2
      internal/chain/reward.go

@ -130,8 +130,8 @@ var (
pushgatewayPort = flag.String("pushgateway_port", "9091", "Metrics view port") pushgatewayPort = flag.String("pushgateway_port", "9091", "Metrics view port")
publicRPC = flag.Bool("public_rpc", false, "Enable Public RPC Access (default: false)") publicRPC = flag.Bool("public_rpc", false, "Enable Public RPC Access (default: false)")
// Bad block revert // Bad block revert
doRevertBefore = flag.Int("do_revert_before", 1150, "If the current block is less than do_revert_before, revert all blocks until (including) revert_to block") doRevertBefore = flag.Int("do_revert_before", 0, "If the current block is less than do_revert_before, revert all blocks until (including) revert_to block")
revertTo = flag.Int("revert_to", 1130, "The revert will rollback all blocks until and including block number revert_to") revertTo = flag.Int("revert_to", 0, "The revert will rollback all blocks until and including block number revert_to")
) )
func initSetup() { func initSetup() {
@ -291,13 +291,13 @@ func setupConsensusAndNode(nodeConfig *nodeconfig.ConfigType) *node.Node {
// TODO: consensus object shouldn't start here // TODO: consensus object shouldn't start here
// TODO(minhdoan): During refactoring, found out that the peers list is actually empty. Need to clean up the logic of consensus later. // TODO(minhdoan): During refactoring, found out that the peers list is actually empty. Need to clean up the logic of consensus later.
decider := quorum.NewDecider(quorum.SuperMajorityVote) decider := quorum.NewDecider(quorum.SuperMajorityVote)
currentConsensus, err := consensus.New( currentConsensus, err := consensus.New(
myHost, nodeConfig.ShardID, p2p.Peer{}, nodeConfig.ConsensusPriKey, decider, myHost, nodeConfig.ShardID, p2p.Peer{}, nodeConfig.ConsensusPriKey, decider,
) )
currentConsensus.Decider.SetShardIDProvider(func() (uint32, error) { currentConsensus.Decider.SetShardIDProvider(func() (uint32, error) {
return currentConsensus.ShardID, nil return currentConsensus.ShardID, nil
}) })
currentConsensus.Decider.SetMyPublicKeyProvider(func() (*bls.PublicKey, error) { currentConsensus.Decider.SetMyPublicKeyProvider(func() (*bls.PublicKey, error) {
return currentConsensus.PubKey, nil return currentConsensus.PubKey, nil
}) })
@ -486,7 +486,7 @@ func main() {
go currentNode.SupportBeaconSyncing() go currentNode.SupportBeaconSyncing()
} }
////// Temporary fix for 8-6 incident ///////// if uint64(*doRevertBefore) != 0 && uint64(*revertTo) != 0 {
chain := currentNode.Blockchain() chain := currentNode.Blockchain()
curNum := chain.CurrentBlock().NumberU64() curNum := chain.CurrentBlock().NumberU64()
if curNum < uint64(*doRevertBefore) && curNum >= uint64(*revertTo) { if curNum < uint64(*doRevertBefore) && curNum >= uint64(*revertTo) {
@ -500,7 +500,7 @@ func main() {
chain.WriteLastCommits(sigAndBitMap) chain.WriteLastCommits(sigAndBitMap)
} }
} }
/////////////////////////////////////////////// }
startMsg := "==== New Harmony Node ====" startMsg := "==== New Harmony Node ===="
if *nodeType == "explorer" { if *nodeType == "explorer" {

@ -135,7 +135,7 @@ func whatPercentStakedNow(
beaconchain engine.ChainReader, beaconchain engine.ChainReader,
) (*numeric.Dec, error) { ) (*numeric.Dec, error) {
stakedNow := numeric.ZeroDec() stakedNow := numeric.ZeroDec()
// Only active validators' stake is counted in stake ratio because their // Only active validators' stake is counted in stake ratio because only their stake is under slashing risk
active, err := beaconchain.ReadActiveValidatorList() active, err := beaconchain.ReadActiveValidatorList()
if err != nil { if err != nil {
return nil, err return nil, err

Loading…
Cancel
Save