Changeset View
Changeset View
Standalone View
Standalone View
src/validation.cpp
Show First 20 Lines • Show All 592 Lines • ▼ Show 20 Lines | |||||
bool IsDAAEnabled(const Config &config, const CBlockIndex *pindexPrev) { | bool IsDAAEnabled(const Config &config, const CBlockIndex *pindexPrev) { | ||||
if (pindexPrev == nullptr) { | if (pindexPrev == nullptr) { | ||||
return false; | return false; | ||||
} | } | ||||
return IsDAAEnabled(config, pindexPrev->nHeight); | return IsDAAEnabled(config, pindexPrev->nHeight); | ||||
} | } | ||||
static bool IsForkMay152018Enabled(const Config &config, int64_t nMedianTimePast) { | |||||
return nMedianTimePast >= config.GetChainParams().GetConsensus().May152018ActivationTime; | |||||
} | |||||
bool IsForkMay152018Enabled(const Config &config, const CBlockIndex *pindexPrev) { | |||||
if (pindexPrev == nullptr) { | |||||
return false; | |||||
} | |||||
return IsForkMay152018Enabled(config, pindexPrev->GetMedianTimePast()); | |||||
} | |||||
/** | /** | ||||
* Make mempool consistent after a reorg, by re-adding or recursively erasing | * Make mempool consistent after a reorg, by re-adding or recursively erasing | ||||
* disconnected block transactions from the mempool, and also removing any other | * disconnected block transactions from the mempool, and also removing any other | ||||
* transactions from the mempool that are no longer valid given the new | * transactions from the mempool that are no longer valid given the new | ||||
* tip/height. | * tip/height. | ||||
* | * | ||||
* Note: we assume that disconnectpool only contains transactions that are NOT | * Note: we assume that disconnectpool only contains transactions that are NOT | ||||
* confirmed in the current chain nor already in the mempool (otherwise, | * confirmed in the current chain nor already in the mempool (otherwise, | ||||
▲ Show 20 Lines • Show All 1,268 Lines • ▼ Show 20 Lines | static uint32_t GetBlockScriptFlags(const CBlockIndex *pindex, | ||||
// s in their signature. We also make sure that signature that are supposed | // s in their signature. We also make sure that signature that are supposed | ||||
// to fail (for instance in multisig or other forms of smart contracts) are | // to fail (for instance in multisig or other forms of smart contracts) are | ||||
// null. | // null. | ||||
if (IsDAAEnabled(config, pindex->pprev)) { | if (IsDAAEnabled(config, pindex->pprev)) { | ||||
flags |= SCRIPT_VERIFY_LOW_S; | flags |= SCRIPT_VERIFY_LOW_S; | ||||
flags |= SCRIPT_VERIFY_NULLFAIL; | flags |= SCRIPT_VERIFY_NULLFAIL; | ||||
} | } | ||||
// Once the the 15 May 2018 hardfork activates we may begin using new opcodes. | |||||
// Therefore script flags need to be passed to the interpreter allowing this. | |||||
if (IsForkMay152018Enabled(config, pindex->pprev)) { | |||||
//flags |= SCRIPT_ENABLE_OPCODES0; // Note this will be uncommented in a later commit | |||||
} | |||||
return flags; | return flags; | ||||
} | } | ||||
static int64_t nTimeCheck = 0; | static int64_t nTimeCheck = 0; | ||||
static int64_t nTimeForks = 0; | static int64_t nTimeForks = 0; | ||||
static int64_t nTimeVerify = 0; | static int64_t nTimeVerify = 0; | ||||
static int64_t nTimeConnect = 0; | static int64_t nTimeConnect = 0; | ||||
static int64_t nTimeIndex = 0; | static int64_t nTimeIndex = 0; | ||||
▲ Show 20 Lines • Show All 3,430 Lines • Show Last 20 Lines |