|
@ -99,11 +99,12 @@ static Json::Value toJson(dev::eth::Transaction const& _t, std::pair<h256, unsig |
|
|
return res; |
|
|
return res; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
static Json::Value toJson(dev::eth::BlockInfo const& _bi, UncleHashes const& _us, Transactions const& _ts) |
|
|
static Json::Value toJson(dev::eth::BlockInfo const& _bi, BlockDetails const& _bd, UncleHashes const& _us, Transactions const& _ts) |
|
|
{ |
|
|
{ |
|
|
Json::Value res = toJson(_bi); |
|
|
Json::Value res = toJson(_bi); |
|
|
if (_bi) |
|
|
if (_bi) |
|
|
{ |
|
|
{ |
|
|
|
|
|
res["totalDifficulty"] = toJS(_bd.totalDifficulty); |
|
|
res["uncles"] = Json::Value(Json::arrayValue); |
|
|
res["uncles"] = Json::Value(Json::arrayValue); |
|
|
for (h256 h: _us) |
|
|
for (h256 h: _us) |
|
|
res["uncles"].append(toJS(h)); |
|
|
res["uncles"].append(toJS(h)); |
|
@ -114,11 +115,12 @@ static Json::Value toJson(dev::eth::BlockInfo const& _bi, UncleHashes const& _us |
|
|
return res; |
|
|
return res; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
static Json::Value toJson(dev::eth::BlockInfo const& _bi, UncleHashes const& _us, TransactionHashes const& _ts) |
|
|
static Json::Value toJson(dev::eth::BlockInfo const& _bi, BlockDetails const& _bd, UncleHashes const& _us, TransactionHashes const& _ts) |
|
|
{ |
|
|
{ |
|
|
Json::Value res = toJson(_bi); |
|
|
Json::Value res = toJson(_bi); |
|
|
if (_bi) |
|
|
if (_bi) |
|
|
{ |
|
|
{ |
|
|
|
|
|
res["totalDifficulty"] = toJS(_bd.totalDifficulty); |
|
|
res["uncles"] = Json::Value(Json::arrayValue); |
|
|
res["uncles"] = Json::Value(Json::arrayValue); |
|
|
for (h256 h: _us) |
|
|
for (h256 h: _us) |
|
|
res["uncles"].append(toJS(h)); |
|
|
res["uncles"].append(toJS(h)); |
|
@ -602,9 +604,9 @@ Json::Value WebThreeStubServerBase::eth_getBlockByHash(string const& _blockHash, |
|
|
{ |
|
|
{ |
|
|
auto h = jsToFixed<32>(_blockHash); |
|
|
auto h = jsToFixed<32>(_blockHash); |
|
|
if (_includeTransactions) |
|
|
if (_includeTransactions) |
|
|
return toJson(client()->blockInfo(h), client()->uncleHashes(h), client()->transactions(h)); |
|
|
return toJson(client()->blockInfo(h), client()->blockDetails(h), client()->uncleHashes(h), client()->transactions(h)); |
|
|
else |
|
|
else |
|
|
return toJson(client()->blockInfo(h), client()->uncleHashes(h), client()->transactionHashes(h)); |
|
|
return toJson(client()->blockInfo(h), client()->blockDetails(h), client()->uncleHashes(h), client()->transactionHashes(h)); |
|
|
} |
|
|
} |
|
|
catch (...) |
|
|
catch (...) |
|
|
{ |
|
|
{ |
|
@ -618,9 +620,9 @@ Json::Value WebThreeStubServerBase::eth_getBlockByNumber(string const& _blockNum |
|
|
{ |
|
|
{ |
|
|
auto h = jsToBlockNumber(_blockNumber); |
|
|
auto h = jsToBlockNumber(_blockNumber); |
|
|
if (_includeTransactions) |
|
|
if (_includeTransactions) |
|
|
return toJson(client()->blockInfo(h), client()->uncleHashes(h), client()->transactions(h)); |
|
|
return toJson(client()->blockInfo(h), client()->blockDetails(h), client()->uncleHashes(h), client()->transactions(h)); |
|
|
else |
|
|
else |
|
|
return toJson(client()->blockInfo(h), client()->uncleHashes(h), client()->transactionHashes(h)); |
|
|
return toJson(client()->blockInfo(h), client()->blockDetails(h), client()->uncleHashes(h), client()->transactionHashes(h)); |
|
|
} |
|
|
} |
|
|
catch (...) |
|
|
catch (...) |
|
|
{ |
|
|
{ |
|
|