Browse Source

Change in network protocol.

Fixes for QEthereum.
cl-refactor
Gav Wood 11 years ago
parent
commit
807fce7168
  1. 4
      libethereum/PeerSession.cpp
  2. 2
      libqethereum/QEthereum.h

4
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<byte, 4>());
bi::address_v4 peerAddress(_r[i][0].toHash<FixedHash<4>>().asArray());
auto ep = bi::tcp::endpoint(peerAddress, _r[i][1].toInt<short>());
Public id = _r[i][2].toHash<Public>();
if (isPrivateAddress(peerAddress))

2
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<eth::Address>(_a)); }
Q_INVOKABLE QVariant toAddress(QVariant/*eth::Address*/ _a) const { return toQJS<eth::Address>((eth::u160)in(_a)); }

Loading…
Cancel
Save