Browse Source

Diagnostics for peer ban issues.

cl-refactor
Gav Wood 10 years ago
parent
commit
f300862149
  1. 9
      libethereum/DownloadMan.h
  2. 6
      libethereum/EthereumHost.cpp

9
libethereum/DownloadMan.h

@ -134,6 +134,15 @@ public:
return m_blocksGot.full(); return m_blocksGot.full();
} }
h256s remaining() const
{
h256s ret;
ReadGuard l(m_lock);
for (auto i: m_blocksGot.inverted())
ret.push_back(m_chain[i]);
return ret;
}
h256s chain() const { ReadGuard l(m_lock); return m_chain; } h256s chain() const { ReadGuard l(m_lock); return m_chain; }
void foreachSub(std::function<void(DownloadSub const&)> const& _f) const { ReadGuard l(x_subs); for(auto i: m_subs) _f(*i); } void foreachSub(std::function<void(DownloadSub const&)> const& _f) const { ReadGuard l(x_subs); for(auto i: m_subs) _f(*i); }
unsigned subCount() const { ReadGuard l(x_subs); return m_subs.size(); } unsigned subCount() const { ReadGuard l(x_subs); return m_subs.size(); }

6
libethereum/EthereumHost.cpp

@ -132,9 +132,9 @@ void EthereumHost::noteDoneBlocks(EthereumPeer* _who, bool _clemency)
else else
{ {
// Done our chain-get. // Done our chain-get.
clog(NetNote) << "Chain download failed. Peer with blocks didn't have them all. This peer is bad and should be punished."; clog(NetWarn) << "Chain download failed. Peer with blocks didn't have them all. This peer is bad and should be punished.";
clog(NetNote) << "TODO: PUNISH."; clog(NetWarn) << m_man.remaining();
clog(NetWarn) << "WOULD BAN.";
// m_banned.insert(_who->session()->id()); // We know who you are! // m_banned.insert(_who->session()->id()); // We know who you are!
// _who->disable("Peer sent hashes but was unable to provide the blocks."); // _who->disable("Peer sent hashes but was unable to provide the blocks.");
} }

Loading…
Cancel
Save