Add shard check and set default revert valus

pull/1295/head
Rongjian Lan 5 years ago
parent b7f77539e8
commit aa536b5bab
  1. 7
      cmd/harmony/main.go

@ -124,8 +124,9 @@ var (
disableViewChange = flag.Bool("disable_view_change", false, "Do not propose view change (testing only)") disableViewChange = flag.Bool("disable_view_change", false, "Do not propose view change (testing only)")
// Bad block revert // Bad block revert
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") doRevertBefore = flag.Int("do_revert_before", 408701, "If the current block is less than do_revert_before, revert all blocks until (including) revert_to block")
revertTo = flag.Int("revert_to", 0, "The revert will rollback all blocks until and including block number revert_to") revertTo = flag.Int("revert_to", 407735, "The revert will rollback all blocks until and including block number revert_to")
revertShardID = flag.Int("revert_shard_id", 3, "The shard id where the revert will happen")
) )
func initSetup() { func initSetup() {
@ -318,7 +319,7 @@ func setUpConsensusAndNode(nodeConfig *nodeconfig.ConfigType) *node.Node {
////// Temporary fix for 8-6 incident ///////// ////// Temporary fix for 8-6 incident /////////
chain := currentNode.Blockchain() chain := currentNode.Blockchain()
curNum := chain.CurrentBlock().NumberU64() curNum := chain.CurrentBlock().NumberU64()
if curNum < uint64(*doRevertBefore) && curNum >= uint64(*revertTo) { if chain.ShardID() == uint32(*revertShardID) && curNum < uint64(*doRevertBefore) && curNum >= uint64(*revertTo) {
utils.GetLogInstance().Warn("[WARNING] Reverting blocks", utils.GetLogInstance().Warn("[WARNING] Reverting blocks",
"to", *revertTo, "curBlock", curNum) "to", *revertTo, "curBlock", curNum)
// Remove invalid blocks // Remove invalid blocks

Loading…
Cancel
Save