TARAXA
Loading...
Searching...
No Matches
period_data.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <libdevcore/Common.h>
4#include <libdevcore/RLP.h>
5
6#include <vector>
7
9#include "common/types.hpp"
10#include "dag/dag_block.hpp"
12
13namespace taraxa {
14
19class PbftVote;
20class PbftBlock;
21class PillarVote;
22
27 public:
28 PeriodData() = default;
29 PeriodData(std::shared_ptr<PbftBlock> pbft_blk,
30 const std::vector<std::shared_ptr<PbftVote>>& previous_block_cert_votes,
31 std::optional<std::vector<std::shared_ptr<PillarVote>>>&& pillar_votes = {});
32 explicit PeriodData(const dev::RLP& all_rlp);
33 explicit PeriodData(const bytes& all_rlp);
34
35 std::shared_ptr<PbftBlock> pbft_blk;
36 std::vector<std::shared_ptr<PbftVote>> previous_block_cert_votes; // These votes are the cert votes of previous block
37 // which match reward votes in current pbft block
38 std::vector<std::shared_ptr<DagBlock>> dag_blocks;
40
41 // Pillar votes should be present only if pbft block contains also pillar block hash
42 std::optional<std::vector<std::shared_ptr<PillarVote>>> pillar_votes_;
43
44 // Period data rlp without pillar votes
45 constexpr static size_t kBaseRlpItemCount = 4;
46
47 // Period data rlp with pillar votes (optional since ficus hardfork)
48 constexpr static size_t kExtendedRlpItemCount = 5;
49
54 bytes rlp() const;
55
59 void clear();
60
64 std::string toString() const;
65
67};
68
71} // namespace taraxa
Definition RLP.h:56
#define HAS_RLP_FIELDS
Definition encoding_rlp.hpp:208
static constexpr size_t kBaseRlpItemCount
Definition period_data.hpp:45
void clear()
Clear PBFT block, certify votes, DAG blocks, and transactions.
Definition period_data.cpp:72
std::vector< std::shared_ptr< PbftVote > > previous_block_cert_votes
Definition period_data.hpp:36
std::string toString() const
Definition period_data.cpp:84
SharedTransactions transactions
Definition period_data.hpp:39
std::shared_ptr< PbftBlock > pbft_blk
Definition period_data.hpp:35
PeriodData()=default
std::vector< std::shared_ptr< DagBlock > > dag_blocks
Definition period_data.hpp:38
bytes rlp() const
Recursive Length Prefix.
Definition period_data.cpp:42
std::optional< std::vector< std::shared_ptr< PillarVote > > > pillar_votes_
Definition period_data.hpp:42
static constexpr size_t kExtendedRlpItemCount
Definition period_data.hpp:48
PeriodData class is for block execution, that includes PBFT block, certify votes, DAG blocks,...
Definition period_data.hpp:26
Definition app.hpp:16
std::vector< byte > bytes
Definition types.hpp:53
std::vector< SharedTransaction > SharedTransactions
Definition transaction.hpp:86