TARAXA
Loading...
Searching...
No Matches
vote.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "common/types.hpp"
4
5namespace taraxa {
6
15class Vote {
16 public:
17 Vote() = default;
18 Vote(const blk_hash_t& block_hash);
19 virtual ~Vote() = default;
20
26 void signVote(const secret_t& node_sk);
27
32 const vote_hash_t& getHash() const;
33
38 const public_t& getVoter() const;
39
44 const addr_t& getVoterAddr() const;
45
50 const sig_t& getVoteSignature() const;
51
56 const blk_hash_t& getBlockHash() const;
57
62 bool verifyVote() const;
63
69 virtual vote_hash_t sha3(bool inc_sig) const = 0;
70
71 protected:
72 blk_hash_t block_hash_; // Voted block hash
74
75 mutable vote_hash_t vote_hash_; // hash of this vote
78};
79
82} // 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:76
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:75
virtual ~Vote()=default
addr_t cached_voter_addr_
Definition vote.hpp:77
blk_hash_t block_hash_
Definition vote.hpp:72
sig_t vote_signature_
Definition vote.hpp:73
Vote()=default
Vote class is a vote class that includes vote hash, vote on PBFT block hash, vote signature,...
Definition vote.hpp:15
Definition app.hpp:16