Skip to content

Commit

Permalink
Merge pull request #175 from orogvany/prepare_new_testnet
Browse files Browse the repository at this point in the history
Concensus: update max testnet validator check for testnet reboot
  • Loading branch information
semuxgo authored Jul 2, 2019
2 parents ceb6bac + 379fdd0 commit 5442ee2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 18 deletions.
10 changes: 2 additions & 8 deletions src/main/java/org/semux/config/TestnetConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,14 @@ public Map<Fork, Long> forkActivationCheckpoints() {
}

/**
* Testnet maxes out at 15 validators to stop dead validators from breaking
* Testnet maxes out at 10 validators to stop dead validators from breaking
* concensus
*
* @param number
* @return
*/
@Override
public int getNumberOfValidators(long number) {

// adjust number down to unstick testnet to more reasonable max
if (number <= 751638) {
return super.getNumberOfValidators(number);
} else {
return 15;
}
return Math.min(10, super.getNumberOfValidators(number));
}
}
10 changes: 0 additions & 10 deletions src/main/java/org/semux/consensus/SemuxSync.java
Original file line number Diff line number Diff line change
Expand Up @@ -539,16 +539,6 @@ protected boolean validateBlock(Block block, AccountState asSnapshot, DelegateSt
BlockHeader header = block.getHeader();
List<Transaction> transactions = block.getTransactions();

// a workaround to ensure testnet clients ignore bad block, can remove at later
// date
if (config.network() == Network.TESTNET) {
String badBlock = "0x1a472841464b9bea9e530d73a95e1213f29adef11a3661f3e98df87a9a230b7d";
String blockHash = Hex.encode0x(block.getHash());
if (badBlock.equals(blockHash)) {
return false;
}
}

// [1] check block header
Block latest = chain.getLatestBlock();
if (!block.validateHeader(latest.getHeader(), header)) {
Expand Down

0 comments on commit 5442ee2

Please sign in to comment.