|
|
@ -418,7 +418,7 @@ TransactionReceipts State::sync(BlockChain const& _bc, TransactionQueue& _tq, bo |
|
|
|
TransactionReceipts ret; |
|
|
|
auto ts = _tq.transactions(); |
|
|
|
|
|
|
|
auto lh = getLastHashes(_bc, _bc.number()); |
|
|
|
auto lh = getLastHashes(_bc, _bc.number()); |
|
|
|
|
|
|
|
for (int goodTxs = 1; goodTxs;) |
|
|
|
{ |
|
|
@ -498,7 +498,7 @@ u256 State::enact(bytesConstRef _block, BlockChain const& _bc, bool _checkNonce) |
|
|
|
GenericTrieDB<MemoryDB> receiptsTrie(&rm); |
|
|
|
receiptsTrie.init(); |
|
|
|
|
|
|
|
LastHashes lh = getLastHashes(_bc, (unsigned)m_previousBlock.number); |
|
|
|
LastHashes lh = getLastHashes(_bc, (unsigned)m_previousBlock.number); |
|
|
|
|
|
|
|
// All ok with the block generally. Play back the transactions now...
|
|
|
|
unsigned i = 0; |
|
|
@ -527,7 +527,7 @@ u256 State::enact(bytesConstRef _block, BlockChain const& _bc, bool _checkNonce) |
|
|
|
cwarn << "Bad receipts state root."; |
|
|
|
cwarn << "Block:" << toHex(_block); |
|
|
|
cwarn << "Block RLP:" << RLP(_block); |
|
|
|
cwarn << "Calculated: " << receiptsTrie.root(); |
|
|
|
cwarn << "Calculated: " << receiptsTrie.root(); |
|
|
|
for (unsigned j = 0; j < i; ++j) |
|
|
|
{ |
|
|
|
RLPStream k; |
|
|
@ -539,15 +539,15 @@ u256 State::enact(bytesConstRef _block, BlockChain const& _bc, bool _checkNonce) |
|
|
|
cwarn << TransactionReceipt(&b); |
|
|
|
} |
|
|
|
cwarn << "Recorded: " << m_currentBlock.receiptsRoot; |
|
|
|
auto rs = _bc.receipts(bi.hash); |
|
|
|
for (unsigned j = 0; j < rs.receipts.size(); ++j) |
|
|
|
{ |
|
|
|
auto b = rs.receipts[j].rlp(); |
|
|
|
cwarn << j << ": "; |
|
|
|
cwarn << "RLP: " << RLP(b); |
|
|
|
cwarn << "Hex: " << toHex(b); |
|
|
|
cwarn << rs.receipts[j]; |
|
|
|
} |
|
|
|
auto rs = _bc.receipts(bi.hash); |
|
|
|
for (unsigned j = 0; j < rs.receipts.size(); ++j) |
|
|
|
{ |
|
|
|
auto b = rs.receipts[j].rlp(); |
|
|
|
cwarn << j << ": "; |
|
|
|
cwarn << "RLP: " << RLP(b); |
|
|
|
cwarn << "Hex: " << toHex(b); |
|
|
|
cwarn << rs.receipts[j]; |
|
|
|
} |
|
|
|
BOOST_THROW_EXCEPTION(InvalidReceiptsStateRoot()); |
|
|
|
} |
|
|
|
|
|
|
@ -1016,7 +1016,7 @@ LastHashes State::getLastHashes(BlockChain const& _bc, unsigned _n) const |
|
|
|
ret.resize(256); |
|
|
|
if (c_protocolVersion > 49) |
|
|
|
{ |
|
|
|
ret[0] = _bc.numberHash(_n); |
|
|
|
ret[0] = _bc.numberHash(_n); |
|
|
|
for (unsigned i = 1; i < 256; ++i) |
|
|
|
ret[i] = ret[i - 1] ? _bc.details(ret[i - 1]).parent : h256(); |
|
|
|
} |
|
|
@ -1025,12 +1025,12 @@ LastHashes State::getLastHashes(BlockChain const& _bc, unsigned _n) const |
|
|
|
|
|
|
|
u256 State::execute(BlockChain const& _bc, bytes const& _rlp, bytes* o_output, bool _commit) |
|
|
|
{ |
|
|
|
return execute(getLastHashes(_bc, _bc.number()), &_rlp, o_output, _commit); |
|
|
|
return execute(getLastHashes(_bc, _bc.number()), &_rlp, o_output, _commit); |
|
|
|
} |
|
|
|
|
|
|
|
u256 State::execute(BlockChain const& _bc, bytesConstRef _rlp, bytes* o_output, bool _commit) |
|
|
|
{ |
|
|
|
return execute(getLastHashes(_bc, _bc.number()), _rlp, o_output, _commit); |
|
|
|
return execute(getLastHashes(_bc, _bc.number()), _rlp, o_output, _commit); |
|
|
|
} |
|
|
|
|
|
|
|
// TODO: maintain node overlay revisions for stateroots -> each commit gives a stateroot + OverlayDB; allow overlay copying for rewind operations.
|
|
|
|