Skip to content
This repository has been archived by the owner on Feb 15, 2024. It is now read-only.

Commit

Permalink
Version 590. Corrected new-verifier stall issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
n-y-z-o committed Jun 2, 2020
1 parent aee445e commit 65430ea
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions src/main/java/co/nyzo/verifier/Block.java
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,7 @@ public long chainScore(long zeroBlockHeight) {

// This score is always relative to a provided block height. The zero block height has a score of zero, and
// each subsequent block affects the score as follows:
// - the preferred new verifier subtracts 2; all others add 10,000
// - the preferred new verifier subtracts 2; all others add 9
// - an existing verifier adds the difference in cycle length between the previous block and this block,
// multiplied by 4
// - an existing verifier that is no longer in the mesh or shares an IP with another verifier adds 5
Expand Down Expand Up @@ -905,13 +905,17 @@ public long chainScore(long zeroBlockHeight) {
score = (Math.abs(HashUtil.longSHA256(block.getVerifierIdentifier())) % 9000) * -1L - 1000L;

} else {
// Only allow the top new verifier to join.
// Only provide room for the top new verifier to join. Apply a penalty of 9 to all other
// verifiers. This score effectively prevents this verifier from voting proactively for any
// verifier other than the top verifier, but it does allow automatic consensus to be reached
// when other verifiers have decided to admit a verifier. This avoids stalls when there is minor
// disagreement over the top new verifier.
ByteBuffer topNewVerifier = NewVerifierVoteManager.topVerifier();
if (topNewVerifier != null &&
ByteUtil.arraysAreEqual(topNewVerifier.array(), block.getVerifierIdentifier())) {
score -= 2L;
} else {
score += 10000L;
score += 9L;
}

// Penalize for each balance-list spam transaction.
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/co/nyzo/verifier/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

public class Version {

private static final int version = 589;
private static final int version = 590;

public static int getVersion() {

Expand Down

0 comments on commit 65430ea

Please sign in to comment.