33 std::vector<CScript> winners;
38 "Staking rewards for block %s: not ready yet\n",
50 auto it = std::find(winners.begin(), winners.end(),
o.scriptPubKey);
51 if (it != winners.end()) {
52 if (it != winners.begin()) {
54 "Staking rewards for block %s: selected winner is "
55 "flaky, accepting an alternative one\n",
64 "Staking rewards for block %s: payout script mismatch!\n",
68 "policy-bad-staking-reward",
69 strprintf(
"Block %s violates staking reward policy",
bool IsCowperthwaiteEnabled(const Consensus::Params ¶ms, int32_t nHeight)
Check if Nov 15th, 2023 protocol upgrade has activated.
bool GetBoolArg(const std::string &strArg, bool fDefault) const
Return boolean argument or default value.
std::vector< CTransactionRef > vtx
The block chain is a tree shaped structure starting with the genesis block at the root,...
CBlockIndex * pprev
pointer to the index of the predecessor of this block
BlockHash GetBlockHash() const
const avalanche::Processor & m_avalanche
bool operator()(BlockPolicyValidationState &state) override
const Consensus::Params & m_consensusParams
const Amount & m_blockReward
const CBlockIndex & m_blockIndex
bool Invalid(Result result, const std::string &reject_reason="", const std::string &debug_message="")
bool getStakingRewardWinners(const BlockHash &prevBlockHash, std::vector< std::pair< ProofId, CScript > > &winners) const EXCLUSIVE_LOCKS_REQUIRED(!cs_stakingRewards)
std::string ToString() const
#define LogPrint(category,...)
@ POLICY_VIOLATION
A block policy rule was violated. This block should be parked.
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
bool IsStakingRewardsActivated(const Consensus::Params ¶ms, const CBlockIndex *pprev)
static constexpr int STAKING_REWARD_RATIO
Percentage of the block reward to be sent to staking rewards.
Amount GetStakingRewardsAmount(const Amount &coinbaseValue)
bool IsStakingRewardsActivated(const Consensus::Params ¶ms, const CBlockIndex *pprev)
Amount GetStakingRewardsAmount(const Amount &coinbaseValue)
A BlockHash is a unqiue identifier for a block.
Parameters that influence chain consensus.
bool enableStakingRewards
Enable or disable the staking rewards by default.