TARAXA
verified_votes.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <unordered_map>
4 
5 #include "common/types.hpp"
6 
7 namespace taraxa {
8 
9 class PbftVote;
10 
12 
13 struct VerifiedVotes {
14  struct StepVotes {
15  std::unordered_map<blk_hash_t, std::pair<uint64_t, std::unordered_map<vote_hash_t, std::shared_ptr<PbftVote>>>>
17  std::unordered_map<addr_t, std::pair<std::shared_ptr<PbftVote>, std::shared_ptr<PbftVote>>> unique_voters;
18  };
19 
20  // 2t+1 voted blocks
21  std::unordered_map<TwoTPlusOneVotedBlockType, std::pair<blk_hash_t, PbftStep>> two_t_plus_one_voted_blocks_;
22 
23  // Step votes
24  std::map<PbftStep, StepVotes> step_votes;
25 
26  // Greatest step, for which there is at least t+1 next votes - it is used for lambda exponential backoff: Usually
27  // when network gets stalled it is due to lack of 2t+1 voting power and steps keep increasing. When new node joins
28  // the network, it should catch up with the rest of nodes asap so we dont start exponentially backing of its lambda
29  // if it's current step is far behind network_t_plus_one_step (at least 1 third of network is at this step)
31 };
32 
33 } // namespace taraxa
Definition: config.hpp:8
uint32_t PbftStep
Definition: types.hpp:26
std::map< PbftStep, StepVotes > step_votes
Definition: verified_votes.hpp:24
std::unordered_map< addr_t, std::pair< std::shared_ptr< PbftVote >, std::shared_ptr< PbftVote > > > unique_voters
Definition: verified_votes.hpp:17
PbftStep network_t_plus_one_step
Definition: verified_votes.hpp:30
std::unordered_map< blk_hash_t, std::pair< uint64_t, std::unordered_map< vote_hash_t, std::shared_ptr< PbftVote > > > > votes
Definition: verified_votes.hpp:16
std::unordered_map< TwoTPlusOneVotedBlockType, std::pair< blk_hash_t, PbftStep > > two_t_plus_one_voted_blocks_
Definition: verified_votes.hpp:21
TwoTPlusOneVotedBlockType
Definition: verified_votes.hpp:11
Definition: verified_votes.hpp:13
Definition: verified_votes.hpp:14