diff options
| author | Patrick Lodder <[email protected]> | 2014-08-08 12:19:34 +0200 |
|---|---|---|
| committer | Patrick Lodder <[email protected]> | 2014-08-17 22:39:28 +0200 |
| commit | 2d1ea2c3076fdb75ce9e32ee6c699f810f342858 (patch) | |
| tree | 08116d113e10b56345b4d9eb6b93eba4df9020f3 /src/main.cpp | |
| parent | Merge pull request #611 from rnicoll/1.8-dev-gitian (diff) | |
| download | archived-discoin-2d1ea2c3076fdb75ce9e32ee6c699f810f342858.tar.xz archived-discoin-2d1ea2c3076fdb75ce9e32ee6c699f810f342858.zip | |
check block version for aux blocks properly for version warning
UpdateTip() was checking block versions against one of two
possible AuxPoW versions. Added consts for version checks and
IsAuxPowVersion(int nVersion) for use with UpdateTip()'s
block version check.
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp index da1f12cdc..c8d024bab 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1158,6 +1158,11 @@ void CBlockHeader::SetAuxPow(CAuxPow* pow) auxpow.reset(pow); } +bool IsAuxPowVersion(int nVersion) +{ + return (nVersion == BLOCK_VERSION_AUXPOW_WITH_AUX || nVersion == BLOCK_VERSION_AUXPOW_WITHOUT_AUX); +} + uint256 static GetOrphanRoot(const uint256& hash) { map<uint256, COrphanBlock*>::iterator it = mapOrphanBlocks.find(hash); @@ -2064,10 +2069,9 @@ void static UpdateTip(CBlockIndex *pindexNew) { { int nUpgraded = 0; const CBlockIndex* pindex = chainActive.Tip(); - int nAuxVersion = CBlockHeader::CURRENT_VERSION | (AUXPOW_CHAIN_ID * BLOCK_VERSION_CHAIN_START); for (int i = 0; i < 100 && pindex != NULL; i++) { - if (pindex->nVersion > CBlock::CURRENT_VERSION && pindex->nVersion != nAuxVersion) + if (pindex->nVersion > CBlock::CURRENT_VERSION && !IsAuxPowVersion(pindex->nVersion)) ++nUpgraded; pindex = pindex->pprev; } |