forked from Qortal/qortal
Fixed calculation error in existing chain weight code, which would have caused the last block to be missed out of the comparison after switching to same-length chain comparisons.
This commit is contained in:
parent
50244c1c40
commit
9ebcd55ff5
@ -709,7 +709,7 @@ public class Synchronizer {
|
|||||||
populateBlockSummariesMinterLevels(repository, ourBlockSummaries);
|
populateBlockSummariesMinterLevels(repository, ourBlockSummaries);
|
||||||
populateBlockSummariesMinterLevels(repository, peerBlockSummaries);
|
populateBlockSummariesMinterLevels(repository, peerBlockSummaries);
|
||||||
|
|
||||||
final int mutualHeight = commonBlockHeight - 1 + Math.min(ourBlockSummaries.size(), peerBlockSummaries.size());
|
final int mutualHeight = commonBlockHeight + Math.min(ourBlockSummaries.size(), peerBlockSummaries.size());
|
||||||
|
|
||||||
// Calculate cumulative chain weights of both blockchain subsets, from common block to highest mutual block.
|
// Calculate cumulative chain weights of both blockchain subsets, from common block to highest mutual block.
|
||||||
BigInteger ourChainWeight = Block.calcChainWeight(commonBlockHeight, commonBlockSig, ourBlockSummaries, mutualHeight);
|
BigInteger ourChainWeight = Block.calcChainWeight(commonBlockHeight, commonBlockSig, ourBlockSummaries, mutualHeight);
|
||||||
|
Loading…
Reference in New Issue
Block a user