Fabcoin Core
0.16.2
P2P Digital Currency
|
Encapsulation of a block header. More...
#include <BlockHeader.h>
Public Member Functions | |
BlockHeader () | |
BlockHeader (bytesConstRef _data, BlockDataType _bdt=BlockData, h256 const &_hashWith=h256()) | |
BlockHeader (bytes const &_data, BlockDataType _bdt=BlockData, h256 const &_hashWith=h256()) | |
operator bool () const | |
bool | operator== (BlockHeader const &_cmp) const |
bool | operator!= (BlockHeader const &_cmp) const |
void | clear () |
void | noteDirty () const |
void | populateFromParent (BlockHeader const &parent) |
void | verify (Strictness _s=CheckEverything, BlockHeader const &_parent=BlockHeader(), bytesConstRef _block=bytesConstRef()) const |
void | verify (Strictness _s, bytesConstRef _block) const |
h256 | hash (IncludeSeal _i=WithSeal) const |
void | streamRLP (RLPStream &_s, IncludeSeal _i=WithSeal) const |
void | setParentHash (h256 const &_v) |
void | setSha3Uncles (h256 const &_v) |
void | setTimestamp (u256 const &_v) |
void | setAuthor (Address const &_v) |
void | setRoots (h256 const &_t, h256 const &_r, h256 const &_u, h256 const &_s) |
void | setGasUsed (u256 const &_v) |
void | setNumber (u256 const &_v) |
void | setGasLimit (u256 const &_v) |
void | setExtraData (bytes const &_v) |
void | setLogBloom (LogBloom const &_v) |
void | setDifficulty (u256 const &_v) |
template<class T > | |
void | setSeal (unsigned _offset, T const &_value) |
template<class T > | |
void | setSeal (T const &_value) |
h256 const & | parentHash () const |
h256 const & | sha3Uncles () const |
u256 const & | timestamp () const |
Address const & | author () const |
h256 const & | stateRoot () const |
h256 const & | transactionsRoot () const |
h256 const & | receiptsRoot () const |
u256 const & | gasUsed () const |
u256 const & | number () const |
u256 const & | gasLimit () const |
bytes const & | extraData () const |
LogBloom const & | logBloom () const |
u256 const & | difficulty () const |
template<class T > | |
T | seal (unsigned _offset=0) const |
Static Public Member Functions | |
static h256 | headerHashFromBlock (bytes const &_block) |
static h256 | headerHashFromBlock (bytesConstRef _block) |
static RLP | extractHeader (bytesConstRef _block) |
Static Public Attributes | |
static const unsigned | BasicFields = 13 |
Private Member Functions | |
void | populate (RLP const &_header) |
void | streamRLPFields (RLPStream &_s) const |
Private Attributes | |
h256 | m_parentHash |
h256 | m_sha3Uncles |
h256 | m_stateRoot |
h256 | m_transactionsRoot |
h256 | m_receiptsRoot |
LogBloom | m_logBloom |
u256 | m_number |
u256 | m_gasLimit |
u256 | m_gasUsed |
bytes | m_extraData |
u256 | m_timestamp = Invalid256 |
Address | m_author |
u256 | m_difficulty |
std::vector< bytes > | m_seal |
Additional (RLP-encoded) header fields. More... | |
h256 | m_hash |
(Memoised) SHA3 hash of the block header with seal. More... | |
h256 | m_hashWithout |
(Memoised) SHA3 hash of the block header without seal. More... | |
Friends | |
class | BlockChain |
Encapsulation of a block header.
Class to contain all of a block header's data. It is able to parse a block header and populate from some given RLP block serialisation with the static fromHeader(), through the method populate(). This will not conduct any verification above basic formating. In this case extra verification can be performed through verify().
The object may also be populated from an entire block through the explicit constructor BlockHeader(bytesConstRef) and manually with the populate() method. These will conduct verification of the header against the other information in the block.
The object may be populated with a template given a parent BlockHeader object with the populateFromParent() method. The genesis block info may be retrieved with genesis() and the corresponding RLP block created with createGenesisBlock().
To determine the header hash without the nonce (for sealing), the method hash(WithoutNonce) is provided.
The default constructor creates an empty object, which can be tested against with the boolean conversion operator.
Definition at line 95 of file BlockHeader.h.
BlockHeader::BlockHeader | ( | ) |
|
explicit |
|
inlineexplicit |
Definition at line 103 of file BlockHeader.h.
|
inline |
void BlockHeader::clear | ( | ) |
|
inline |
|
static |
Definition at line 100 of file BlockHeader.cpp.
|
inline |
|
inline |
|
inline |
h256 BlockHeader::hash | ( | IncludeSeal | _i = WithSeal | ) | const |
Definition at line 64 of file BlockHeader.cpp.
Definition at line 105 of file BlockHeader.h.
|
static |
|
inline |
|
inline |
Definition at line 130 of file BlockHeader.h.
|
inline |
|
inlineexplicit |
Definition at line 109 of file BlockHeader.h.
|
inline |
|
inline |
Definition at line 111 of file BlockHeader.h.
|
inline |
|
private |
Definition at line 115 of file BlockHeader.cpp.
void BlockHeader::populateFromParent | ( | BlockHeader const & | parent | ) |
Definition at line 146 of file BlockHeader.cpp.
|
inline |
|
inline |
Definition at line 167 of file BlockHeader.h.
|
inline |
Definition at line 143 of file BlockHeader.h.
|
inline |
Definition at line 150 of file BlockHeader.h.
|
inline |
Definition at line 148 of file BlockHeader.h.
|
inline |
Definition at line 147 of file BlockHeader.h.
|
inline |
Definition at line 145 of file BlockHeader.h.
|
inline |
Definition at line 149 of file BlockHeader.h.
|
inline |
Definition at line 146 of file BlockHeader.h.
|
inline |
Definition at line 140 of file BlockHeader.h.
|
inline |
Definition at line 144 of file BlockHeader.h.
|
inline |
Definition at line 151 of file BlockHeader.h.
|
inline |
Definition at line 152 of file BlockHeader.h.
|
inline |
Definition at line 141 of file BlockHeader.h.
|
inline |
Definition at line 142 of file BlockHeader.h.
|
inline |
|
inline |
void BlockHeader::streamRLP | ( | RLPStream & | _s, |
IncludeSeal | _i = WithSeal |
||
) | const |
Definition at line 83 of file BlockHeader.cpp.
|
private |
|
inline |
|
inline |
void BlockHeader::verify | ( | Strictness | _s = CheckEverything , |
BlockHeader const & | _parent = BlockHeader() , |
||
bytesConstRef | _block = bytesConstRef() |
||
) | const |
Definition at line 156 of file BlockHeader.cpp.
|
inline |
Definition at line 135 of file BlockHeader.h.
|
friend |
Definition at line 97 of file BlockHeader.h.
|
static |
Definition at line 99 of file BlockHeader.h.
|
private |
Definition at line 185 of file BlockHeader.h.
|
private |
Definition at line 186 of file BlockHeader.h.
|
private |
Definition at line 182 of file BlockHeader.h.
|
private |
Definition at line 180 of file BlockHeader.h.
|
private |
Definition at line 181 of file BlockHeader.h.
|
mutableprivate |
(Memoised) SHA3 hash of the block header with seal.
Definition at line 190 of file BlockHeader.h.
|
mutableprivate |
(Memoised) SHA3 hash of the block header without seal.
Definition at line 191 of file BlockHeader.h.
|
private |
Definition at line 178 of file BlockHeader.h.
|
private |
Definition at line 179 of file BlockHeader.h.
|
private |
Definition at line 173 of file BlockHeader.h.
|
private |
Definition at line 177 of file BlockHeader.h.
|
private |
Additional (RLP-encoded) header fields.
Definition at line 188 of file BlockHeader.h.
|
private |
Definition at line 174 of file BlockHeader.h.
|
private |
Definition at line 175 of file BlockHeader.h.
|
private |
Definition at line 183 of file BlockHeader.h.
|
private |
Definition at line 176 of file BlockHeader.h.