TARAXA
vote.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "common/types.hpp"
4 
5 namespace taraxa {
6 
15 class Vote {
16  public:
17  Vote() = default;
18  Vote(const blk_hash_t& block_hash);
19 
25  void signVote(const secret_t& node_sk);
26 
31  const vote_hash_t& getHash() const;
32 
37  const public_t& getVoter() const;
38 
43  const addr_t& getVoterAddr() const;
44 
49  const sig_t& getVoteSignature() const;
50 
55  const blk_hash_t& getBlockHash() const;
56 
61  bool verifyVote() const;
62 
68  virtual vote_hash_t sha3(bool inc_sig) const = 0;
69 
70  protected:
71  blk_hash_t block_hash_; // Voted block hash
73 
74  mutable vote_hash_t vote_hash_; // hash of this vote
77 };
78 
81 } // namespace taraxa
const vote_hash_t & getHash() const
Get vote hash.
Definition: vote.cpp:15
const sig_t & getVoteSignature() const
Get vote signature.
Definition: vote.cpp:30
bool verifyVote() const
Verify vote.
Definition: vote.cpp:34
const public_t & getVoter() const
Get voter public key.
Definition: vote.cpp:20
public_t cached_voter_
Definition: vote.hpp:75
const addr_t & getVoterAddr() const
Get voter address.
Definition: vote.cpp:25
const blk_hash_t & getBlockHash() const
Get PBFT block hash that votes on.
Definition: vote.cpp:32
virtual vote_hash_t sha3(bool inc_sig) const =0
Secure Hash Algorithm 3.
void signVote(const secret_t &node_sk)
Sign the vote.
Definition: vote.cpp:9
vote_hash_t vote_hash_
Definition: vote.hpp:74
addr_t cached_voter_addr_
Definition: vote.hpp:76
blk_hash_t block_hash_
Definition: vote.hpp:71
sig_t vote_signature_
Definition: vote.hpp:72
Vote()=default
Vote class is a vote class that includes vote hash, vote on PBFT block hash, vote signature,...
Definition: vote.hpp:15
Definition: config.hpp:8