From d395b82f1b5705807048162430f4d3d28c504169 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Thu, 6 Nov 2014 15:47:19 +0000 Subject: [PATCH] Nicer uncle info. Fix for fromAscii/toAscii and asBytes usage. --- alethzero/MainWin.cpp | 7 +++++++ libjsqrc/main.js | 4 +++- libweb3jsonrpc/WebThreeStubServer.cpp | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/alethzero/MainWin.cpp b/alethzero/MainWin.cpp index 56a9e35bc..6d91767b8 100644 --- a/alethzero/MainWin.cpp +++ b/alethzero/MainWin.cpp @@ -1243,6 +1243,13 @@ void Main::on_blocks_currentItemChanged() s << "
Log Bloom: " << info.logBloom << ""; s << "
Transactions: " << block[1].itemCount() << " @" << info.transactionsRoot << ""; s << "
Uncles: " << block[2].itemCount() << " @" << info.sha3Uncles << ""; + for (auto u: block[2]) + { + BlockInfo uncle = BlockInfo::fromHeader(u.data()); + s << "
 Hash: " << uncle.hash << ""; + s << "
 Parent: " << uncle.parentHash << ""; + s << "
 Number: " << uncle.number << ""; + } if (info.parentHash) s << "
Pre: " << BlockInfo(ethereum()->blockChain().block(info.parentHash)).stateRoot << ""; else diff --git a/libjsqrc/main.js b/libjsqrc/main.js index 3e0a62c40..821de6382 100644 --- a/libjsqrc/main.js +++ b/libjsqrc/main.js @@ -217,6 +217,8 @@ // Find termination var str = ""; var i = 0, l = hex.length; + if (hex.substring(0, 2) == '0x') + i = 2; for(; i < l; i+=2) { var code = hex.charCodeAt(i) if(code == 0) { @@ -238,7 +240,7 @@ var hex = this.toHex(str); while(hex.length < pad*2) hex += "00"; - return hex + return "0x" + hex }, eth: { diff --git a/libweb3jsonrpc/WebThreeStubServer.cpp b/libweb3jsonrpc/WebThreeStubServer.cpp index 031fc907a..5b7b56a19 100644 --- a/libweb3jsonrpc/WebThreeStubServer.cpp +++ b/libweb3jsonrpc/WebThreeStubServer.cpp @@ -228,7 +228,7 @@ static shh::Envelope toSealed(Json::Value const& _json, shh::Message const& _m, if (!_json["topic"].empty()) { if (_json["topic"].isString()) - bt.shift(jsToBytes(_json["topic"])); + bt.shift(jsToBytes(_json["topic"].asString())); else if (_json["topic"].isArray()) for (auto i: _json["topic"]) bt.shift(jsToBytes(i.asString()));