From f08107cd039fd5ffe2418bf750fcfef7999e4377 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Wed, 7 Mar 2012 09:14:38 -0800 Subject: [PATCH] Punish a peer that sends us unwanted ledger data. --- Peer.cpp | 2 ++ Peer.h | 1 + 2 files changed, 3 insertions(+) diff --git a/Peer.cpp b/Peer.cpp index 6c5072064..8f48dd86b 100644 --- a/Peer.cpp +++ b/Peer.cpp @@ -510,6 +510,8 @@ void Peer::recvGetLedger(newcoin::TMGetLedger& packet) void Peer::recvLedger(newcoin::TMLedgerData& packet) { + if(!theApp->getMasterLedgerAcquire().gotLedgerData(packet)) + punishPeer(PP_UNWANTED_DATA); } void Peer::sendHello() diff --git a/Peer.h b/Peer.h index f874bbd46..0ddda232b 100644 --- a/Peer.h +++ b/Peer.h @@ -16,6 +16,7 @@ enum PeerPunish { PP_INVALID_REQUEST=1, // The peer sent a request that makes no sense PP_UNKNOWN_REQUEST=2, // The peer sent a request that might be garbage + PP_UNWANTED_DATA=3, // The peer sent us data we didn't want/need }; class Peer : public boost::enable_shared_from_this