Skip to content

Commit

Permalink
Performance fix for IsSuperMajority check
Browse files Browse the repository at this point in the history
The IsSuperMajority check was being done for blocks with ANY of
the SIZE_FORK_VERSION bits set, instead of blocks with ALL of those
bits set.

Thanks to Michael Ruddy for finding during code review.
  • Loading branch information
gavinandresen committed Jul 30, 2015
1 parent 93ac0f3 commit 17adac5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1857,7 +1857,7 @@ static int64_t nTimeCallbacks = 0;
static int64_t nTimeTotal = 0;

static bool DidBlockTriggerSizeFork(const CBlock &block, const CBlockIndex *pindex, const CChainParams &chainparams) {
return (block.nVersion & SIZE_FORK_VERSION) &&
return ((block.nVersion & SIZE_FORK_VERSION) == SIZE_FORK_VERSION) &&
(pblocktree->ForkActivated(SIZE_FORK_VERSION) == uint256()) &&
IsSuperMajority(SIZE_FORK_VERSION, pindex, chainparams.GetConsensus().ActivateSizeForkMajority(), chainparams.GetConsensus(), true /* use bitmask */);
}
Expand Down

0 comments on commit 17adac5

Please sign in to comment.