Skip to content
This repository has been archived by the owner on Oct 28, 2021. It is now read-only.

Commit

Permalink
logs
Browse files Browse the repository at this point in the history
  • Loading branch information
winsvega committed Mar 16, 2018
1 parent f1f6f3e commit 0a421c7
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 11 deletions.
10 changes: 8 additions & 2 deletions libdevcore/Worker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ void Worker::startWorking()
// cnote << "Spawning" << m_name;
}

DEV_TIMED_ABOVE("Start worker", 100)
// m_state = WorkerState::Started;
// return;

DEV_TIMED_ABOVE("Start worker", 100)
while (m_state == WorkerState::Starting)
m_state_notifier.wait(l);
}
Expand All @@ -107,7 +110,10 @@ void Worker::stopWorking()
return;
m_state_notifier.notify_all();

DEV_TIMED_ABOVE("Stop worker", 100)
// m_state = WorkerState::Stopped;
// return;

DEV_TIMED_ABOVE("Stop worker", 100)
while (m_state != WorkerState::Stopped)
m_state_notifier.wait(l); // but yes who can wake this up, when the mutex is taken.
}
Expand Down
32 changes: 23 additions & 9 deletions libweb3jsonrpc/Test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,21 +73,35 @@ Json::Value fillJsonWithState(eth::State const& _state, eth::AccountMaskMap cons
return oState;
}

string exportLog(eth::LogEntries const& _logs)
{
RLPStream s;
s.appendList(_logs.size());
for (eth::LogEntry const& l : _logs)
l.streamRLP(s);
return toHexPrefixed(sha3(s.out()));
}

const int c_postStateJustHashVersion = 1;
const int c_postStateFullStateVersion = 2;
const int c_postStateLogHashVersion = 3;
string Test::test_getPostState(Json::Value const& param1)
{
if (param1["version"] == "1")
{
// Just return the hash
h256 postState = m_eth.blockChain().info().stateRoot(); // m_eth.pendingInfo().stateRoot();
return toJS(postState);
}
else if (param1["version"] == "2")
Json::Value out;
Json::FastWriter fastWriter;
if (u256(param1["version"].asString()) == c_postStateJustHashVersion)
return toJS(m_eth.blockChain().info().stateRoot());
else if (u256(param1["version"].asString()) == c_postStateFullStateVersion)
{
eth::AccountMaskMap _map;
Json::Value out = fillJsonWithState(m_eth.postState().state(), _map);
Json::FastWriter fastWriter;
out = fillJsonWithState(m_eth.postState().state(), _map);
return fastWriter.write(out);
}
else if (u256(param1["version"].asString()) == c_postStateFullStateVersion)
{
h256 topBlockHash = m_eth.blockChain().currentHash();
return toJS(exportLog(m_eth.blockChain().transactionReceipt(topBlockHash, 0).log()));
}
return "";
}

Expand Down

0 comments on commit 0a421c7

Please sign in to comment.