Browse Source

common changes

cl-refactor
Marek Kotewicz 10 years ago
parent
commit
aa1a40a009
  1. 44
      libethereum/Client.cpp
  2. 2
      libweb3jsonrpc/WebThreeStubServerBase.cpp

44
libethereum/Client.cpp

@ -340,18 +340,17 @@ void Client::appendFromNewPending(TransactionReceipt const& _receipt, h256Hash&
{ {
Guard l(x_filtersWatches); Guard l(x_filtersWatches);
for (pair<h256 const, InstalledFilter>& i: m_filters) for (pair<h256 const, InstalledFilter>& i: m_filters)
if (isInBlockHashRange(i.second.filter.earliest(), i.second.filter.latest(), PendingBlockHash)) {
// acceptable number.
auto m = i.second.filter.matches(_receipt);
if (m.size())
{ {
// acceptable number. // filter catches them
auto m = i.second.filter.matches(_receipt); for (LogEntry const& l: m)
if (m.size()) i.second.changes.push_back(LocalisedLogEntry(l, m_bc.number() + 1, _transactionHash));
{ io_changed.insert(i.first);
// filter catches them
for (LogEntry const& l: m)
i.second.changes.push_back(LocalisedLogEntry(l, m_bc.number() + 1, _transactionHash));
io_changed.insert(i.first);
}
} }
}
} }
void Client::appendFromNewBlock(h256 const& _block, h256Hash& io_changed) void Client::appendFromNewBlock(h256 const& _block, h256Hash& io_changed)
@ -362,21 +361,20 @@ void Client::appendFromNewBlock(h256 const& _block, h256Hash& io_changed)
Guard l(x_filtersWatches); Guard l(x_filtersWatches);
for (pair<h256 const, InstalledFilter>& i: m_filters) for (pair<h256 const, InstalledFilter>& i: m_filters)
if (isInBlockHashRange(i.second.filter.earliest(), i.second.filter.latest(), d.hash()) && i.second.filter.matches(d.logBloom)) // acceptable number & looks like block may contain a matching log entry.
// acceptable number & looks like block may contain a matching log entry. for (size_t j = 0; j < br.receipts.size(); j++)
for (size_t j = 0; j < br.receipts.size(); j++) {
auto tr = br.receipts[j];
auto m = i.second.filter.matches(tr);
if (m.size())
{ {
auto tr = br.receipts[j]; auto transactionHash = transaction(d.hash(), j).sha3();
auto m = i.second.filter.matches(tr); // filter catches them
if (m.size()) for (LogEntry const& l: m)
{ i.second.changes.push_back(LocalisedLogEntry(l, (unsigned)d.number, transactionHash));
auto transactionHash = transaction(d.hash(), j).sha3(); io_changed.insert(i.first);
// filter catches them
for (LogEntry const& l: m)
i.second.changes.push_back(LocalisedLogEntry(l, (unsigned)d.number, transactionHash));
io_changed.insert(i.first);
}
} }
}
} }
void Client::setForceMining(bool _enable) void Client::setForceMining(bool _enable)

2
libweb3jsonrpc/WebThreeStubServerBase.cpp

@ -172,7 +172,7 @@ static Json::Value toJson(dev::eth::LocalisedLogEntry const& _e)
for (auto const& t: _e.topics) for (auto const& t: _e.topics)
res["topics"].append(toJS(t)); res["topics"].append(toJS(t));
res["number"] = _e.number; res["number"] = _e.number;
res["hash"] = toJS(_e.transactionHash); res["transactionHash"] = toJS(_e.transactionHash);
} }
return res; return res;
} }

Loading…
Cancel
Save