46 status, proof->getPayoutScript(), proof->getScore())
62 if (
pm.isRemoteProof(proofid) &&
63 (
pm.isBoundToPeer(proofid) ||
pm.isDangling(proofid))) {
72 const CBlockIndex *pindex,
const std::vector<CScript> &payoutScripts) {
75 auto it =
view.find(prevblockhash);
76 if (it ==
view.end()) {
78 .emplace(prevblockhash, pindex->
nHeight, payoutScripts)
88 if (it ==
view.end()) {
100 if (it ==
view.end()) {
113 if (it ==
view.end()) {
125 if (it ==
view.end()) {
139 if (it ==
view.end()) {
146 if (it->isAccepted()) {
166 std::vector<CScript> &
payouts)
const {
170 auto [begin, end] =
view.equal_range(prevblockhash);
171 for (
auto it = begin; it != end; it++) {
172 if (it->isInWinnerSet()) {
180 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
bool invalidate(const StakeContenderId &contenderId)
ManualWinnersSet manualWinners
bool accept(const StakeContenderId &contenderId)
Helpers to set avalanche state of a contender.
void cleanup(const int requestedMinHeight)
bool reject(const StakeContenderId &contenderId)
bool setWinners(const CBlockIndex *pindex, const std::vector< CScript > &payoutScripts)
Set proof(s) that should be treated as winners (already finalized).
bool add(const CBlockIndex *pindex, const ProofRef &proof, uint8_t status=StakeContenderStatus::UNKNOWN)
Add a proof to consider in staking rewards pre-consensus.
int getVoteStatus(const StakeContenderId &contenderId, BlockHash &prevblockhashout) const
Get contender acceptance state for avalanche voting.
bool finalize(const StakeContenderId &contenderId)
bool getWinners(const BlockHash &prevblockhash, std::vector< CScript > &payouts) const
Get payout scripts of the winning proofs.
void promoteToBlock(const CBlockIndex *activeTip, PeerManager &pm)
Promote cache entries to a the active chain tip.
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.
StakeContenderIds are unique for each block to ensure that the peer polling for their acceptance has ...