| 113 | } |
| 114 | |
| 115 | void 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 | |
| 144 | struct BlockInfoDiagnosticsChannel: public LogChannel { static const char* name() { return EthBlue "▧" EthWhite " ◌"; } static const int verbosity = 9; }; |
| 145 |
no test coverage detected