TARAXA
Loading...
Searching...
No Matches
data.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <libdevcore/Common.h>
4#include <libdevcore/Guards.h>
5#include <libdevcore/Log.h>
6#include <libdevcore/SHA3.h>
7
9#include "common/types.hpp"
12
13namespace taraxa {
14class PbftBlock;
15}
16
17namespace taraxa::final_chain {
18
24
39
41 BlockHeader() = default;
42 BlockHeader(std::string&& raw_header_data);
43 BlockHeader(std::string&& raw_header_data, const PbftBlock& pbft, uint64_t gas_limit);
44
45 void setFromPbft(const PbftBlock& pbft);
46
47 static h256 const& unclesHash();
48
49 static const Nonce& nonce();
50
51 static const u256& difficulty();
52
53 static h256 const& mixHash();
54
55 static std::shared_ptr<BlockHeader> fromRLP(const dev::RLP& rlp);
56
57 void ethereumRlp(dev::RLPStream& encoding) const;
58 dev::bytes ethereumRlp() const;
59
60 h256 hash;
61 Address author;
62 uint64_t gas_limit = 0;
63 uint64_t timestamp = 0;
66
68};
69
70static constexpr auto c_bloomIndexSize = 16;
71static constexpr auto c_bloomIndexLevels = 2;
72
73using BlocksBlooms = std::array<LogBloom, c_bloomIndexSize>;
74
75struct NewBlock {
77 uint64_t timestamp;
78 std::vector<h256> dag_blk_hashes;
79 h256 hash;
80};
81
87
90} // namespace taraxa::final_chain
Definition FixedHash.h:35
Definition RLP.h:56
Class for writing to an RLP bytestream.
Definition RLP.h:484
#define HAS_RLP_FIELDS
Definition encoding_rlp.hpp:208
h256 transactions_root
Definition data.hpp:28
std::shared_ptr< BlockHeader const > final_chain_blk
Definition data.hpp:83
static const Nonce & nonce()
Definition data.cpp:35
h256 state_root
Definition data.hpp:27
uint64_t timestamp
Definition data.hpp:63
EthBlockNumber number
Definition data.hpp:64
static h256 const & mixHash()
Definition data.cpp:39
static std::shared_ptr< BlockHeader > fromRLP(const dev::RLP &rlp)
Definition data.cpp:41
static const u256 & difficulty()
Definition data.cpp:37
BlockHeader(std::string &&raw_header_data)
static h256 const & unclesHash()
Definition data.cpp:33
SharedTransactions trxs
Definition data.hpp:84
TransactionReceipts trx_receipts
Definition data.hpp:85
h256 hash
Definition data.hpp:79
dev::bytes ethereumRlp() const
Definition data.cpp:56
bytes extra_data
Definition data.hpp:65
void setFromPbft(const PbftBlock &pbft)
Definition data.cpp:26
u256 total_reward
Definition data.hpp:32
uint64_t size
Definition data.hpp:33
h256 hash
Definition data.hpp:60
dev::bytes serializeForDB() const
Definition data.cpp:11
h256 parent_hash
Definition data.hpp:26
Address author
Definition data.hpp:61
h256 receipts_root
Definition data.hpp:29
addr_t author
Definition data.hpp:76
uint64_t gas_limit
Definition data.hpp:62
std::vector< h256 > dag_blk_hashes
Definition data.hpp:78
uint64_t gas_used
Definition data.hpp:31
LogBloom log_bloom
Definition data.hpp:30
uint64_t timestamp
Definition data.hpp:77
std::array< LogBloom, c_bloomIndexSize > BlocksBlooms
Definition data.hpp:73
static constexpr auto c_bloomIndexSize
Definition data.hpp:70
static constexpr auto c_bloomIndexLevels
Definition data.hpp:71
Definition data.hpp:40
Definition data.hpp:75
The PbftBlock class is a PBFT block class that includes PBFT block hash, previous PBFT block hash,...
Definition pbft_block.hpp:22
std::vector<::byte > bytes
Definition Common.h:46
FixedHash< 8 > h64
Definition FixedHash.h:456
Definition app_base.hpp:22
Definition app.hpp:16
uint64_t EthBlockNumber
Definition types.hpp:24
std::vector< TransactionReceipt > TransactionReceipts
Definition receipt.hpp:35
std::vector< byte > bytes
Definition types.hpp:53
std::vector< SharedTransaction > SharedTransactions
Definition transaction.hpp:86