From 4395c6862e14e58c14a175363e49ea5cb8abf72d Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Fri, 17 Oct 2014 15:19:40 +0200 Subject: [PATCH] fixed numberOrHash method --- libqethereum/QEthereum.cpp | 10 +++++----- libqethereum/QEthereum.h | 1 - 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/libqethereum/QEthereum.cpp b/libqethereum/QEthereum.cpp index e0525dee9..43f73ae1b 100644 --- a/libqethereum/QEthereum.cpp +++ b/libqethereum/QEthereum.cpp @@ -400,14 +400,14 @@ static QString toJson(dev::eth::Transaction const& _bi) return QString::fromUtf8(QJsonDocument(v).toJson()); } -dev::FixedHash<32> QEthereum::numberOrHash(QString const& _json) const +static dev::FixedHash<32>toHash(QString const & _json, dev::eth::Interface* _client) { QJsonObject f = QJsonDocument::fromJson(_json.toUtf8()).object(); dev::FixedHash<32> hash; if (f.contains("hash")) hash = ::toFixed<32>(f["hash"].toString()); else if (f.contains("number")) - hash = client()->hashFromNumber((unsigned)f["number"].toInt()); + hash =_client->hashFromNumber((unsigned)f["number"].toInt()); return hash; } @@ -416,7 +416,7 @@ QString QEthereum::getBlockImpl(QString _json) const if (!client()) return ""; - auto hash = numberOrHash(_json); + auto hash = toHash(_json, client()); return toJson(client()->blockInfo(hash), client()->blockDetails(hash)); } @@ -425,7 +425,7 @@ QString QEthereum::getTransactionImpl(QString _json, int _i) const if (!client()) return ""; - auto hash = numberOrHash(_json); + auto hash = toHash(_json, client()); return toJson(client()->transaction(hash, _i)); } @@ -434,7 +434,7 @@ QString QEthereum::getUncleImpl(QString _json, int _i) const if (!client()) return ""; - auto hash = numberOrHash(_json); + auto hash = toHash(_json, client()); return toJson(client()->uncle(hash, _i)); } diff --git a/libqethereum/QEthereum.h b/libqethereum/QEthereum.h index 57c4a77a4..28a3c46d7 100644 --- a/libqethereum/QEthereum.h +++ b/libqethereum/QEthereum.h @@ -208,7 +208,6 @@ private: dev::eth::Interface* m_client; std::vector m_watches; QList m_accounts; - dev::FixedHash<32> numberOrHash(QString const& _json) const; }; class QPeer2Peer : public QObject