Browse Source

Allow data to be passed in old way.

cl-refactor
Gav Wood 10 years ago
parent
commit
85e3bd4939
  1. 11
      libweb3jsonrpc/WebThreeStubServer.cpp

11
libweb3jsonrpc/WebThreeStubServer.cpp

@ -310,9 +310,16 @@ static TransactionSkeleton toTransaction(Json::Value const& _json)
else if (_json["gasPrice"].isInt())
ret.gas = u256(_json["gas"].asInt());
}
if (_json["data"].isString())
if (!_json["data"].empty())
{
if (_json["data"].isString()) // ethereum.js has preconstructed the data array
ret.data = jsToBytes(_json["data"].asString());
else if (_json["code"].isString())
else if (_json["data"].isArray()) // old style: array of 32-byte-padded values. TODO: remove PoC-8
for (auto i: _json["data"])
dev::operator +=(ret.data, padded(jsToBytes(i.asString()), 32));
}
if (_json["code"].isString())
ret.data = jsToBytes(_json["code"].asString());
return ret;
}

Loading…
Cancel
Save