4 #include <shared_mutex>
13 std::unordered_map<vote_hash_t, std::pair<std::shared_ptr<PillarVote>, uint64_t >>
votes;
32 bool voteExists(
const std::shared_ptr<PillarVote> vote)
const;
40 bool isUniqueVote(
const std::shared_ptr<PillarVote> vote)
const;
65 bool addVerifiedVote(
const std::shared_ptr<PillarVote>& vote, uint64_t validator_vote_count);
78 bool above_threshold =
false)
const;
90 std::map<PbftPeriod, PeriodVotes>
votes_;
Definition: pillar_votes.hpp:10
std::shared_mutex mutex_
Definition: pillar_votes.hpp:91
bool voteExists(const std::shared_ptr< PillarVote > vote) const
Checks if vote exists.
Definition: pillar_votes.cpp:5
uint64_t threshold
Definition: pillar_votes.hpp:22
std::vector< std::shared_ptr< PillarVote > > getVerifiedVotes(PbftPeriod period, const blk_hash_t &pillar_block_hash, bool above_threshold=false) const
Get all pillar block votes for specified pillar block.
Definition: pillar_votes.cpp:41
std::map< PbftPeriod, PeriodVotes > votes_
Definition: pillar_votes.hpp:90
std::unordered_map< blk_hash_t, WeightVotes > pillar_block_votes
Definition: pillar_votes.hpp:18
bool addVerifiedVote(const std::shared_ptr< PillarVote > &vote, uint64_t validator_vote_count)
Add a vote to the votes map.
Definition: pillar_votes.cpp:104
void initializePeriodData(PbftPeriod period, uint64_t threshold)
Initialize period data with period_two_t_plus_one.
Definition: pillar_votes.cpp:133
bool isUniqueVote(const std::shared_ptr< PillarVote > vote) const
Checks if vote is unique per period & validator.
Definition: pillar_votes.cpp:21
uint64_t weight
Definition: pillar_votes.hpp:14
void eraseVotes(PbftPeriod min_period)
Erases votes wit period < min_period.
Definition: pillar_votes.cpp:138
std::unordered_map< addr_t, vote_hash_t > unique_voters
Definition: pillar_votes.hpp:19
bool periodDataInitialized(PbftPeriod period) const
Checks if specified period data have been already initialized.
Definition: pillar_votes.cpp:99
std::unordered_map< vote_hash_t, std::pair< std::shared_ptr< PillarVote >, uint64_t > > votes
Definition: pillar_votes.hpp:13
Definition: pillar_votes.hpp:17
Definition: pillar_votes.hpp:12
Definition: pillar_block.hpp:16
EthBlockNumber PbftPeriod
Definition: types.hpp:24