Changeset View
Changeset View
Standalone View
Standalone View
src/validation.cpp
Show First 20 Lines • Show All 2,721 Lines • ▼ Show 20 Lines | LogPrint(BCLog::BENCH, " - Load block from disk: %.2fms [%.2fs]\n", | ||||
const Amount blockReward = | const Amount blockReward = | ||||
blockFees + | blockFees + | ||||
GetBlockSubsidy(pindexNew->nHeight, consensusParams); | GetBlockSubsidy(pindexNew->nHeight, consensusParams); | ||||
std::vector<std::unique_ptr<ParkingPolicy>> parkingPolicies; | std::vector<std::unique_ptr<ParkingPolicy>> parkingPolicies; | ||||
parkingPolicies.emplace_back(std::make_unique<MinerFundPolicy>( | parkingPolicies.emplace_back(std::make_unique<MinerFundPolicy>( | ||||
consensusParams, *pindexNew, blockConnecting, blockReward)); | consensusParams, *pindexNew, blockConnecting, blockReward)); | ||||
if (!std::all_of(parkingPolicies.begin(), parkingPolicies.end(), | // If any block policy is violated, bail on the first one found | ||||
[&](const auto &policy) { return (*policy)(); })) { | if (std::find_if_not( | ||||
LogPrintf("Park block %s because it violated a block policy\n", | parkingPolicies.begin(), parkingPolicies.end(), | ||||
blockhash.ToString()); | [&](const auto &policy) { | ||||
BlockPolicyValidationState blockPolicyState; | |||||
bool ret = (*policy)(blockPolicyState); | |||||
if (!ret) { | |||||
LogPrintf("Park block because it " | |||||
"violated a block policy: %s\n", | |||||
blockPolicyState.ToString()); | |||||
} | |||||
return ret; | |||||
}) != parkingPolicies.end()) { | |||||
pindexNew->nStatus = pindexNew->nStatus.withParked(); | pindexNew->nStatus = pindexNew->nStatus.withParked(); | ||||
m_blockman.m_dirty_blockindex.insert(pindexNew); | m_blockman.m_dirty_blockindex.insert(pindexNew); | ||||
return false; | return false; | ||||
} | } | ||||
} | } | ||||
nTime3 = GetTimeMicros(); | nTime3 = GetTimeMicros(); | ||||
nTimeConnectTotal += nTime3 - nTime2; | nTimeConnectTotal += nTime3 - nTime2; | ||||
▲ Show 20 Lines • Show All 3,488 Lines • Show Last 20 Lines |