38 status, proof->getPayoutScript(), proof->getScore())
46 auto it =
view.find(prevblockhash);
47 if (it ==
view.end()) {
50 .emplace(prevblockhash, pindex->
nHeight, payoutScripts)
62 if (it ==
view.end()) {
74 if (it ==
view.end()) {
87 if (it ==
view.end()) {
99 if (it ==
view.end()) {
113 if (it ==
view.end()) {
118 if (it->isAccepted()) {
138 std::vector<CScript> &
payouts)
const {
142 auto [begin, end] =
view.equal_range(prevblockhash);
143 for (
auto it = begin; it != end; it++) {
144 if (it->isInWinnerSet()) {
152 return left->computeRewardRank() < right->computeRewardRank();
The block chain is a tree shaped structure starting with the genesis block at the root,...
BlockHash GetBlockHash() const
int nHeight
height of the entry in the chain. The genesis block has height 0
Serialized script, used inside transaction inputs and outputs.
bool invalidate(const StakeContenderId &contenderId)
ManualWinnersSet manualWinners
bool accept(const StakeContenderId &contenderId)
Helpers to set avalanche state of a contender.
bool reject(const StakeContenderId &contenderId)
bool addWinner(const CBlockIndex *pindex, const CScript &payoutScript)
Add a proof that should be treated as a winner (already finalized).
int getVoteStatus(const StakeContenderId &contenderId) const
Get contender acceptance state for avalanche voting.
void cleanup(const int minHeight)
bool add(const CBlockIndex *pindex, const ProofRef &proof, uint8_t status=StakeContenderStatus::UNKNOWN)
Add a proof to consider in staking rewards pre-consensus.
bool finalize(const StakeContenderId &contenderId)
bool getWinners(const BlockHash &prevblockhash, std::vector< CScript > &payouts) const
Get payout scripts of the winning proofs.
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...
A BlockHash is a unqiue identifier for a block.
std::vector< CScript > payoutScripts
StakeContenderIds are unique for each block to ensure that the peer polling for their acceptance has ...