Browse Source

Merge pull request #1726 from debris/eth_event_topics_null

bring back proper topics parsing
cl-refactor
Marek Kotewicz 10 years ago
parent
commit
d07c16a315
  1. 22
      libweb3jsonrpc/WebThreeStubServerBase.cpp

22
libweb3jsonrpc/WebThreeStubServerBase.cpp

@ -194,7 +194,16 @@ static dev::eth::LogFilter toLogFilter(Json::Value const& _json) // commented to
}
if (!_json["topics"].empty())
for (unsigned i = 0; i < _json["topics"].size(); i++)
filter.topic(i, jsToFixed<32>(_json["topics"][i].asString()));
{
if (_json["topics"][i].isArray())
{
for (auto t: _json["topics"][i])
if (!t.isNull())
filter.topic(i, jsToFixed<32>(t.asString()));
}
else if (!_json["topics"][i].isNull()) // if it is anything else then string, it should and will fail
filter.topic(i, jsToFixed<32>(_json["topics"][i].asString()));
}
return filter;
}
@ -224,7 +233,16 @@ static shh::Envelope toSealed(Json::Value const& _json, shh::Message const& _m,
if (!_json["topics"].empty())
for (auto i: _json["topics"])
bt.shift(jsToBytes(i.asString()));
{
if (i.isArray())
{
for (auto j: i)
if (!j.isNull())
bt.shift(jsToBytes(j.asString()));
}
else if (!i.isNull()) // if it is anything else then string, it should and will fail
bt.shift(jsToBytes(i.asString()));
}
return _m.seal(_from, bt, ttl, workToProve);
}

Loading…
Cancel
Save