Changeset View
Changeset View
Standalone View
Standalone View
src/validation.cpp
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show All 30 Lines | |||||
#include <kernel/notifications_interface.h> | #include <kernel/notifications_interface.h> | ||||
#include <logging.h> | #include <logging.h> | ||||
#include <logging/timer.h> | #include <logging/timer.h> | ||||
#include <minerfund.h> | #include <minerfund.h> | ||||
#include <node/blockstorage.h> | #include <node/blockstorage.h> | ||||
#include <node/utxo_snapshot.h> | #include <node/utxo_snapshot.h> | ||||
#include <policy/block/minerfund.h> | #include <policy/block/minerfund.h> | ||||
#include <policy/block/preconsensus.h> | #include <policy/block/preconsensus.h> | ||||
#include <policy/block/rtt.h> | |||||
#include <policy/block/stakingrewards.h> | #include <policy/block/stakingrewards.h> | ||||
#include <policy/policy.h> | #include <policy/policy.h> | ||||
#include <policy/settings.h> | #include <policy/settings.h> | ||||
#include <pow/pow.h> | #include <pow/pow.h> | ||||
#include <primitives/block.h> | #include <primitives/block.h> | ||||
#include <primitives/transaction.h> | #include <primitives/transaction.h> | ||||
#include <random.h> | #include <random.h> | ||||
#include <reverse_iterator.h> | #include <reverse_iterator.h> | ||||
▲ Show 20 Lines • Show All 2,907 Lines • ▼ Show 20 Lines | LogPrint(BCLog::BENCH, " - Load block from disk: %.2fms [%.2fs]\n", | ||||
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 (avalanche) { | if (avalanche) { | ||||
// Only enable the RTT policy if the node already finalized a | |||||
// block. This is because it's very possible that new blocks | |||||
// will be parked after a node restart (but after IBD) if the | |||||
// node is behind by a few blocks. We want to make sure that the | |||||
// node will be able to switch back to the right tip in this | |||||
// case. | |||||
if (avalanche->hasFinalizedTip()) { | |||||
// Special case for testnet, don't reject blocks mined with | |||||
// the min difficulty | |||||
if (!consensusParams.fPowAllowMinDifficultyBlocks || | |||||
(blockConnecting.GetBlockTime() <= | |||||
pindexNew->pprev->GetBlockTime() + | |||||
2 * consensusParams.nPowTargetSpacing)) { | |||||
parkingPolicies.emplace_back( | |||||
std::make_unique<RTTPolicy>(consensusParams, | |||||
*pindexNew)); | |||||
} | |||||
} | |||||
parkingPolicies.emplace_back( | parkingPolicies.emplace_back( | ||||
std::make_unique<StakingRewardsPolicy>( | std::make_unique<StakingRewardsPolicy>( | ||||
*avalanche, consensusParams, *pindexNew, | *avalanche, consensusParams, *pindexNew, | ||||
blockConnecting, blockReward)); | blockConnecting, blockReward)); | ||||
if (m_mempool) { | if (m_mempool) { | ||||
parkingPolicies.emplace_back( | parkingPolicies.emplace_back( | ||||
std::make_unique<PreConsensusPolicy>( | std::make_unique<PreConsensusPolicy>( | ||||
▲ Show 20 Lines • Show All 3,970 Lines • Show Last 20 Lines |