diff --git a/src/neo/Network/P2P/RemoteNode.ProtocolHandler.cs b/src/neo/Network/P2P/RemoteNode.ProtocolHandler.cs index 91b3921326..4df1b56b80 100644 --- a/src/neo/Network/P2P/RemoteNode.ProtocolHandler.cs +++ b/src/neo/Network/P2P/RemoteNode.ProtocolHandler.cs @@ -30,6 +30,7 @@ protected override UInt256 GetKeyForItem((UInt256, DateTime) item) private readonly HashSetCache knownHashes = new HashSetCache(Blockchain.Singleton.MemPool.Capacity * 2 / 5); private readonly HashSetCache sentHashes = new HashSetCache(Blockchain.Singleton.MemPool.Capacity * 2 / 5); private bool verack = false; + private bool memPoolWasSent = false; private BloomFilter bloom_filter; private static readonly TimeSpan TimerInterval = TimeSpan.FromSeconds(30); @@ -314,6 +315,14 @@ private void OnInvMessageReceived(InvPayload payload) private void OnMemPoolMessageReceived() { + if (memPoolWasSent) + { + Disconnect(true); + return; + } + + memPoolWasSent = true; + foreach (InvPayload payload in InvPayload.CreateGroup(InventoryType.TX, Blockchain.Singleton.MemPool.GetVerifiedTransactions().Select(p => p.Hash).ToArray())) EnqueueMessage(Message.Create(MessageCommand.Inv, payload)); }