From 807fce71682386f7f6fb366a78e6d0f056f28d45 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Wed, 23 Apr 2014 18:04:46 +0100 Subject: [PATCH] Change in network protocol. Fixes for QEthereum. --- libethereum/PeerSession.cpp | 4 ++-- libqethereum/QEthereum.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libethereum/PeerSession.cpp b/libethereum/PeerSession.cpp index f9283b887..c2ddc513d 100644 --- a/libethereum/PeerSession.cpp +++ b/libethereum/PeerSession.cpp @@ -164,7 +164,7 @@ bool PeerSession::interpret(RLP const& _r) for (auto i: peers) { clogS(NetMessageDetail) << "Sending peer " << toHex(i.first.ref().cropped(0, 4)) << i.second; - s.appendList(3) << i.second.address().to_v4().to_bytes() << i.second.port() << i.first; + s.appendList(3) << bytesConstRef(i.second.address().to_v4().to_bytes().data(), 4) << i.second.port() << i.first; } sealAndSend(s); break; @@ -173,7 +173,7 @@ bool PeerSession::interpret(RLP const& _r) clogS(NetMessageSummary) << "Peers (" << dec << (_r.itemCount() - 1) << " entries)"; for (unsigned i = 1; i < _r.itemCount(); ++i) { - bi::address_v4 peerAddress(_r[i][0].toArray()); + bi::address_v4 peerAddress(_r[i][0].toHash>().asArray()); auto ep = bi::tcp::endpoint(peerAddress, _r[i][1].toInt()); Public id = _r[i][2].toHash(); if (isPrivateAddress(peerAddress)) diff --git a/libqethereum/QEthereum.h b/libqethereum/QEthereum.h index 295307372..de35aaaa8 100644 --- a/libqethereum/QEthereum.h +++ b/libqethereum/QEthereum.h @@ -196,7 +196,7 @@ public: Q_INVOKABLE QString stringOf(QVariant _t) const { return QString::fromStdString(eth::toString(in(_t))); } Q_INVOKABLE QByteArray bytesOf(QVariant _t) const { eth::h256 b = in(_t); return QByteArray((char const*)&b, sizeof(eth::h256)); } - Q_INVOKABLE QVariant fromHex(QString _s) const { return out(eth::u256(_s.toStdString())); } + Q_INVOKABLE QVariant fromHex(QString _s) const { return out((eth::u256)eth::h256(_s.toStdString())); } Q_INVOKABLE QVariant fromAddress(QVariant/*eth::Address*/ _a) const { return out((eth::u160)to(_a)); } Q_INVOKABLE QVariant toAddress(QVariant/*eth::Address*/ _a) const { return toQJS((eth::u160)in(_a)); }