Browse Source

Minor state reporting fix.

cl-refactor
Gav Wood 11 years ago
parent
commit
7eda4a4cea
  1. 11
      libethereum/State.cpp
  2. 1
      libethereum/State.h

11
libethereum/State.cpp

@ -189,7 +189,7 @@ void State::commit()
bool State::sync(BlockChain const& _bc)
{
return sync(_bc, _bc.currentHash());
return sync(_bc, _bc.currentHash());
}
bool State::sync(BlockChain const& _bc, h256 _block)
@ -414,8 +414,6 @@ u256 State::playback(bytesConstRef _block, BlockInfo const& _grandParent, bool _
// (i.e. all the transactions we executed).
void State::commitToMine(BlockChain const& _bc)
{
cnote << "Commiting to mine on" << m_previousBlock.hash;
if (m_currentBlock.sha3Transactions != h256() || m_currentBlock.sha3Uncles != h256())
return;
@ -454,12 +452,19 @@ void State::commitToMine(BlockChain const& _bc)
// Commit any and all changes to the trie that are in the cache, then update the state root accordingly.
commit();
m_currentBlock.stateRoot = m_state.root();
m_currentBlock.parentHash = m_previousBlock.hash;
}
MineInfo State::mine(uint _msTimeout)
{
if (m_previousBlock.hash != m_committedPreviousHash)
{
m_committedPreviousHash = m_committedPreviousHash;
cnote << "Commiting to mine on" << m_previousBlock.hash;
}
// Update timestamp according to clock.
m_currentBlock.timestamp = time(0);

1
libethereum/State.h

@ -224,6 +224,7 @@ private:
BlockInfo m_currentBlock; ///< The current block's information.
bytes m_currentBytes; ///< The current block.
uint m_currentNumber;
h256 m_committedPreviousHash; ///< Hash of previous block that we are committing to mine.
bytes m_currentTxs;
bytes m_currentUncles;

Loading…
Cancel
Save