MCPcopy Create free account
hub / github.com/LUX-Core/lux / populate

Method populate

src/cpp-ethereum/libethcore/BlockHeader.cpp:115–142  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

113}
114
115void BlockHeader::populate(RLP const& _header)
116{
117 int field = 0;
118 try
119 {
120 m_parentHash = _header[field = 0].toHash<h256>(RLP::VeryStrict);
121 m_sha3Uncles = _header[field = 1].toHash<h256>(RLP::VeryStrict);
122 m_author = _header[field = 2].toHash<Address>(RLP::VeryStrict);
123 m_stateRoot = _header[field = 3].toHash<h256>(RLP::VeryStrict);
124 m_transactionsRoot = _header[field = 4].toHash<h256>(RLP::VeryStrict);
125 m_receiptsRoot = _header[field = 5].toHash<h256>(RLP::VeryStrict);
126 m_logBloom = _header[field = 6].toHash<LogBloom>(RLP::VeryStrict);
127 m_difficulty = _header[field = 7].toInt<u256>();
128 m_number = _header[field = 8].toInt<u256>();
129 m_gasLimit = _header[field = 9].toInt<u256>();
130 m_gasUsed = _header[field = 10].toInt<u256>();
131 m_timestamp = _header[field = 11].toInt<u256>();
132 m_extraData = _header[field = 12].toBytes();
133 m_seal.clear();
134 for (unsigned i = 13; i < _header.itemCount(); ++i)
135 m_seal.push_back(_header[i].data().toBytes());
136 }
137 catch (Exception const& _e)
138 {
139 _e << errinfo_name("invalid block header format") << BadFieldError(field, toHex(_header[field].data().toBytes()));
140 throw;
141 }
142}
143
144struct BlockInfoDiagnosticsChannel: public LogChannel { static const char* name() { return EthBlue "▧" EthWhite " ◌"; } static const int verbosity = 9; };
145

Callers 6

syncMethod · 0.45
serialiseMethod · 0.45
serialiseMethod · 0.45
deserialiseMethod · 0.45
deserialiseMethod · 0.45
deserialiseMethod · 0.45

Calls 6

toHexFunction · 0.85
toBytesMethod · 0.45
clearMethod · 0.45
itemCountMethod · 0.45
push_backMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected