Browse Source

Merge pull request #3 from ethereum/develop

Update from upstream
cl-refactor
AronVanAmmers 10 years ago
parent
commit
e30f57f397
  1. 14
      libethereum/EthereumPeer.cpp
  2. 4
      libp2p/Session.cpp
  3. 2
      libp2p/Session.h

14
libethereum/EthereumPeer.cpp

@ -95,7 +95,7 @@ void EthereumPeer::tryGrabbingHashChain()
if (td >= m_totalDifficulty)
{
clogS(NetAllDetail) << "No. Our chain is better.";
m_grabbing = Grabbing::Nothing;
setGrabbing(Grabbing::Nothing);
return; // All good - we have the better chain.
}
@ -104,7 +104,7 @@ void EthereumPeer::tryGrabbingHashChain()
clogS(NetAllDetail) << "Yes. Their chain is better.";
host()->updateGrabbing(Grabbing::Hashes);
m_grabbing = Grabbing::Hashes;
setGrabbing(Grabbing::Hashes);
RLPStream s;
prep(s).appendList(3);
s << GetBlockHashesPacket << m_latestHash << c_maxHashesAsk;
@ -144,12 +144,14 @@ bool EthereumPeer::interpret(RLP const& _r)
if (genesisHash != host()->m_chain.genesisHash())
disable("Invalid genesis hash");
if (m_protocolVersion != host()->protocolVersion())
else if (m_protocolVersion != host()->protocolVersion())
disable("Invalid protocol version.");
if (m_networkId != host()->networkId())
else if (m_networkId != host()->networkId())
disable("Invalid network identifier.");
startInitialSync();
else if (session()->info().clientVersion.find("/v0.6.9/") != string::npos)
disable("Blacklisted client version.");
else
startInitialSync();
break;
}
case GetTransactionsPacket:

4
libp2p/Session.cpp

@ -40,7 +40,7 @@ Session::Session(Host* _s, bi::tcp::socket _socket, bi::address _peerAddress, un
{
m_disconnect = std::chrono::steady_clock::time_point::max();
m_connect = std::chrono::steady_clock::now();
m_info = PeerInfo({"?", _peerAddress.to_string(), m_listenPort, std::chrono::steady_clock::duration(0), set<string>(), 0});
m_info = PeerInfo({"?", _peerAddress.to_string(), m_listenPort, std::chrono::steady_clock::duration(0), set<string>(), 0, map<string, string>()});
}
Session::~Session()
@ -102,7 +102,7 @@ bool Session::interpret(RLP const& _r)
return false;
}
try
{ m_info = PeerInfo({clientVersion, m_socket.remote_endpoint().address().to_string(), m_listenPort, std::chrono::steady_clock::duration(), _r[3].toSet<string>(), (unsigned)m_socket.native_handle()}); }
{ m_info = PeerInfo({clientVersion, m_socket.remote_endpoint().address().to_string(), m_listenPort, std::chrono::steady_clock::duration(), _r[3].toSet<string>(), (unsigned)m_socket.native_handle(), map<string, string>() }); }
catch (...)
{
disconnect(BadProtocol);

2
libp2p/Session.h

@ -73,6 +73,8 @@ public:
void addNote(std::string const& _k, std::string const& _v) { m_info.notes[_k] = _v; }
PeerInfo const& info() const { return m_info; }
private:
void dropped();
void doRead();

Loading…
Cancel
Save