#include <stakecontendercache.h>
|
| | StakeContenderCache () |
| |
| void | cleanup (const int requestedMinHeight) |
| |
| bool | isEmpty () const |
| | For tests. More...
|
| |
| bool | add (const CBlockIndex *pindex, const ProofRef &proof, uint8_t status=StakeContenderStatus::UNKNOWN) |
| | Add a proof to consider in staking rewards pre-consensus. More...
|
| |
| void | promoteToBlock (const CBlockIndex *activeTip, std::function< bool(const ProofId &proofid)> const &shouldPromote) |
| | Promote cache entries to a the active chain tip. More...
|
| |
| bool | setWinners (const CBlockIndex *pindex, const std::vector< CScript > &payoutScripts) |
| | Set proof(s) that should be treated as winners (already finalized). More...
|
| |
| bool | accept (const StakeContenderId &contenderId) |
| | Helpers to set avalanche state of a contender. More...
|
| |
| bool | finalize (const StakeContenderId &contenderId) |
| |
| bool | reject (const StakeContenderId &contenderId) |
| |
| std::optional< StakeContenderCacheInfo > | getContenderInfo (const StakeContenderId &contenderId) const |
| |
| int | getVoteStatus (const StakeContenderId &contenderId, BlockHash &prevblockhashout) const |
| | Get contender acceptance state for avalanche voting. More...
|
| |
| size_t | getPollableContenders (const BlockHash &prevblockhash, size_t maxPollable, std::vector< StakeContenderId > &pollableContenders) const |
| | Get the best ranking contenders, accepted contenders ranking first. More...
|
| |
| bool | getWinners (const BlockHash &prevblockhash, std::vector< std::pair< ProofId, CScript > > &winners) const |
| |
|
| using | ContenderSet = boost::multi_index_container< StakeContenderCacheEntry, bmi::indexed_by< bmi::hashed_unique< bmi::tag< by_stakecontenderid >, stakecontenderid_index, SaltedUint256Hasher >, bmi::hashed_non_unique< bmi::tag< by_prevblockhash >, bmi::member< StakeContenderCacheEntry, BlockHash, &StakeContenderCacheEntry::prevblockhash >, SaltedUint256Hasher >, bmi::ordered_non_unique< bmi::tag< by_blockheight >, bmi::member< StakeContenderCacheEntry, int, &StakeContenderCacheEntry::blockheight > > > > |
| |
| using | ManualWinnersSet = boost::multi_index_container< ManualWinners, bmi::indexed_by< bmi::hashed_unique< bmi::tag< by_prevblockhash >, bmi::member< ManualWinners, BlockHash, &ManualWinners::prevblockhash >, SaltedUint256Hasher >, bmi::ordered_unique< bmi::tag< by_blockheight >, bmi::member< ManualWinners, int, &ManualWinners::blockheight > > > > |
| |
Definition at line 103 of file stakecontendercache.h.
◆ ContenderSet
| using avalanche::StakeContenderCache::ContenderSet = boost::multi_index_container< StakeContenderCacheEntry, bmi::indexed_by< bmi::hashed_unique<bmi::tag<by_stakecontenderid>, stakecontenderid_index, SaltedUint256Hasher>, bmi::hashed_non_unique< bmi::tag<by_prevblockhash>, bmi::member<StakeContenderCacheEntry, BlockHash, &StakeContenderCacheEntry::prevblockhash>, SaltedUint256Hasher>, bmi::ordered_non_unique< bmi::tag<by_blockheight>, bmi::member<StakeContenderCacheEntry, int, &StakeContenderCacheEntry::blockheight> >> > |
|
private |
◆ ManualWinnersSet
◆ StakeContenderCache()
| avalanche::StakeContenderCache::StakeContenderCache |
( |
| ) |
|
|
inline |
◆ accept()
| bool avalanche::StakeContenderCache::accept |
( |
const StakeContenderId & |
contenderId | ) |
|
◆ add()
| bool avalanche::StakeContenderCache::add |
( |
const CBlockIndex * |
pindex, |
|
|
const ProofRef & |
proof, |
|
|
uint8_t |
status = StakeContenderStatus::UNKNOWN |
|
) |
| |
◆ cleanup()
| void avalanche::StakeContenderCache::cleanup |
( |
const int |
requestedMinHeight | ) |
|
◆ finalize()
| bool avalanche::StakeContenderCache::finalize |
( |
const StakeContenderId & |
contenderId | ) |
|
◆ getContenderInfo()
◆ getPollableContenders()
| size_t avalanche::StakeContenderCache::getPollableContenders |
( |
const BlockHash & |
prevblockhash, |
|
|
size_t |
maxPollable, |
|
|
std::vector< StakeContenderId > & |
pollableContenders |
|
) |
| const |
Get the best ranking contenders, accepted contenders ranking first.
The output of this function is only reliable to select contenders to reconcile and should not be called after contender polling begins.
Definition at line 188 of file stakecontendercache.cpp.
◆ getVoteStatus()
| int avalanche::StakeContenderCache::getVoteStatus |
( |
const StakeContenderId & |
contenderId, |
|
|
BlockHash & |
prevblockhashout |
|
) |
| const |
Get contender acceptance state for avalanche voting.
Returns 0 for accepted, 1 for rejected, and -1 for not in cache. prevblockhashout gets set if the contender is in the cache.
Definition at line 177 of file stakecontendercache.cpp.
◆ getWinners()
| bool avalanche::StakeContenderCache::getWinners |
( |
const BlockHash & |
prevblockhash, |
|
|
std::vector< std::pair< ProofId, CScript > > & |
winners |
|
) |
| const |
◆ isEmpty()
| bool avalanche::StakeContenderCache::isEmpty |
( |
| ) |
const |
|
inline |
◆ promoteToBlock()
| void avalanche::StakeContenderCache::promoteToBlock |
( |
const CBlockIndex * |
activeTip, |
|
|
std::function< bool(const ProofId &proofid)> const & |
shouldPromote |
|
) |
| |
◆ reject()
| bool avalanche::StakeContenderCache::reject |
( |
const StakeContenderId & |
contenderId | ) |
|
◆ setWinners()
| bool avalanche::StakeContenderCache::setWinners |
( |
const CBlockIndex * |
pindex, |
|
|
const std::vector< CScript > & |
payoutScripts |
|
) |
| |
Set proof(s) that should be treated as winners (already finalized).
This should only be used for manually added winners via RPC.
Definition at line 92 of file stakecontendercache.cpp.
◆ contenders
◆ lastPromotedHeight
| int avalanche::StakeContenderCache::lastPromotedHeight {0} |
|
private |
◆ manualWinners
The documentation for this class was generated from the following files: