TARAXA
pillar_vote.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <libdevcore/RLP.h>
4 
6 #include "vote.hpp"
7 
8 namespace taraxa {
9 
17 class PillarVote : public Vote {
18  public:
19  constexpr static size_t kNoSigRlpSize{2};
20  constexpr static size_t kStandardRlpSize{3};
21 
22  public:
23  PillarVote() = default;
24  PillarVote(const secret_t& node_sk, PbftPeriod period, const blk_hash_t& block_hash);
25  PillarVote(PbftPeriod period, const blk_hash_t& block_hash, sig_t&& signature);
26 
27  explicit PillarVote(const dev::RLP& rlp);
28  explicit PillarVote(const bytes& rlp);
29 
33  PbftPeriod getPeriod() const;
34 
39  bytes rlp() const;
40 
46  bytes encodeSolidity(bool inc_sig = true) const;
47 
54  static PillarVote decodeSolidity(const bytes& enc);
55 
57 
58  private:
64  vote_hash_t sha3(bool inc_sig) const override;
65 
66  private:
68 };
69 
72 } // namespace taraxa
Definition: RLP.h:56
#define HAS_RLP_FIELDS
Definition: encoding_rlp.hpp:208
PbftPeriod period_
Definition: pillar_vote.hpp:67
static PillarVote decodeSolidity(const bytes &enc)
Decodes solidity encoded representation of pillar vote.
Definition: pillar_vote.cpp:37
constexpr static size_t kNoSigRlpSize
Definition: pillar_vote.hpp:19
bytes encodeSolidity(bool inc_sig=true) const
Definition: pillar_vote.cpp:29
constexpr static size_t kStandardRlpSize
Definition: pillar_vote.hpp:20
PbftPeriod getPeriod() const
Definition: pillar_vote.cpp:51
vote_hash_t sha3(bool inc_sig) const override
Secure Hash Algorithm 3.
Definition: pillar_vote.cpp:53
bytes rlp() const
Recursive Length Prefix.
Definition: pillar_vote.cpp:27
PillarVote()=default
PillarVote class.
Definition: pillar_vote.hpp:17
Vote class is a vote class that includes vote hash, vote on PBFT block hash, vote signature,...
Definition: vote.hpp:15
std::vector<::byte > bytes
Definition: Common.h:46
Definition: config.hpp:8
EthBlockNumber PbftPeriod
Definition: types.hpp:24