Merge pull request #1239 from LeoHChen/recovery_block_for_shard1

[recovery] add block recovery for shard1
pull/1242/head
Leo Chen 5 years ago committed by GitHub
commit 5e18f6f4a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      consensus/config.go
  2. 4
      consensus/consensus_service.go

@ -17,6 +17,8 @@ const (
consensusBlockNumBuffer uint64 = 2 consensusBlockNumBuffer uint64 = 2
// ReProposeBlockNumShard0: leader propose this block from it's database and validators accept them // ReProposeBlockNumShard0: leader propose this block from it's database and validators accept them
ReProposeBlockNumShard0 uint64 = 270108 ReProposeBlockNumShard0 uint64 = 270108
// ReProposeBlockNumShard1: leader propose this block from it's database and validators accept them
ReProposeBlockNumShard1 uint64 = 275559
// ReProposeBlockNumShard2: leader propose this block from it's database and validators accept them // ReProposeBlockNumShard2: leader propose this block from it's database and validators accept them
ReProposeBlockNumShard2 uint64 = 275057 ReProposeBlockNumShard2 uint64 = 275057
) )

@ -657,6 +657,8 @@ func (consensus *Consensus) NeedsBlockRecovery(blockNum uint64) bool {
switch { switch {
case blockNum == ReProposeBlockNumShard0 && consensus.ShardID == 0: case blockNum == ReProposeBlockNumShard0 && consensus.ShardID == 0:
return true return true
case blockNum == ReProposeBlockNumShard1 && consensus.ShardID == 1:
return true
case blockNum == ReProposeBlockNumShard2 && consensus.ShardID == 2: case blockNum == ReProposeBlockNumShard2 && consensus.ShardID == 2:
return true return true
} }
@ -668,6 +670,8 @@ func (consensus *Consensus) RecoveryBlockNumber(shardID uint32) uint64 {
switch { switch {
case consensus.ShardID == 0: case consensus.ShardID == 0:
return ReProposeBlockNumShard0 return ReProposeBlockNumShard0
case consensus.ShardID == 1:
return ReProposeBlockNumShard1
case consensus.ShardID == 2: case consensus.ShardID == 2:
return ReProposeBlockNumShard2 return ReProposeBlockNumShard2
} }

Loading…
Cancel
Save