fix fDIP0001* flags initialization (#1625)

This commit is contained in:
UdjinM6 2017-09-15 21:08:03 +03:00 committed by GitHub
parent 10eddb52de
commit e22453c902
3 changed files with 12 additions and 8 deletions

View File

@ -36,10 +36,16 @@ void CDSNotificationInterface::UpdatedBlockTip(const CBlockIndex *pindexNew, con
instantsend.UpdatedBlockTip(pindexNew);
mnpayments.UpdatedBlockTip(pindexNew);
governance.UpdatedBlockTip(pindexNew);
// DIP0001 updates
// Update global flags
fDIP0001LockedInAtTip = (VersionBitsState(pindexNew, Params().GetConsensus(), Consensus::DEPLOYMENT_DIP0001, versionbitscache) == THRESHOLD_LOCKED_IN);
fDIP0001ActiveAtTip = (VersionBitsState(pindexNew, Params().GetConsensus(), Consensus::DEPLOYMENT_DIP0001, versionbitscache) == THRESHOLD_ACTIVE);
}
void CDSNotificationInterface::SyncTransaction(const CTransaction &tx, const CBlock *pblock)
{
instantsend.SyncTransaction(tx, pblock);
CPrivateSend::SyncTransaction(tx, pblock);
}
}

View File

@ -85,6 +85,9 @@ uint64_t nPruneTarget = 0;
bool fAlerts = DEFAULT_ALERTS;
bool fEnableReplacement = DEFAULT_ENABLE_REPLACEMENT;
std::atomic<bool> fDIP0001LockedInAtTip{false};
std::atomic<bool> fDIP0001ActiveAtTip{false};
uint256 hashAssumeValid;
/** Fees smaller than this (in duffs) are considered zero fee (for relaying, mining and transaction creation) */
@ -2460,10 +2463,6 @@ void static UpdateTip(CBlockIndex *pindexNew) {
}
}
}
// Update global flags
fDIP0001LockedInAtTip = (VersionBitsTipState(chainParams.GetConsensus(), Consensus::DEPLOYMENT_DIP0001) == THRESHOLD_LOCKED_IN);
fDIP0001ActiveAtTip = (VersionBitsTipState(chainParams.GetConsensus(), Consensus::DEPLOYMENT_DIP0001) == THRESHOLD_ACTIVE);
}
/** Disconnect chainActive's tip. You probably want to call mempool.removeForReorg and manually re-limit mempool size after this, with cs_main held. */

View File

@ -47,9 +47,6 @@ class CValidationState;
struct LockPoints;
static std::atomic<bool> fDIP0001LockedInAtTip{false};
static std::atomic<bool> fDIP0001ActiveAtTip{false};
/** Default for accepting alerts from the P2P network. */
static const bool DEFAULT_ALERTS = true;
/** Default for DEFAULT_WHITELISTRELAY. */
@ -164,6 +161,8 @@ extern bool fAlerts;
extern bool fEnableReplacement;
extern std::map<uint256, int64_t> mapRejectedBlocks;
extern std::atomic<bool> fDIP0001LockedInAtTip;
extern std::atomic<bool> fDIP0001ActiveAtTip;
/** Block hash whose ancestors we will assume to have valid scripts without checking them. */
extern uint256 hashAssumeValid;