From 62c10bd7ab9030595e971cac953acffe0e197532 Mon Sep 17 00:00:00 2001 From: Forrest Voight Date: Sun, 4 Nov 2012 17:34:11 -0500 Subject: [PATCH] limit remote_tx_hashes set to 10000 items --- p2pool/p2p.py | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/p2pool/p2p.py b/p2pool/p2p.py index 697fd06..102990e 100644 --- a/p2pool/p2p.py +++ b/p2pool/p2p.py @@ -325,13 +325,15 @@ class Protocol(p2protocol.Protocol): ('tx_hashes', pack.ListType(pack.IntType(256))), ]) def handle_have_tx(self, tx_hashes): - assert self.remote_tx_hashes.isdisjoint(tx_hashes) + #assert self.remote_tx_hashes.isdisjoint(tx_hashes) self.remote_tx_hashes.update(tx_hashes) + while len(self.remote_tx_hashes) > 10000: + self.remote_tx_hashes.pop() message_losing_tx = pack.ComposedType([ ('tx_hashes', pack.ListType(pack.IntType(256))), ]) def handle_losing_tx(self, tx_hashes): - assert self.remote_tx_hashes.issuperset(tx_hashes) + #assert self.remote_tx_hashes.issuperset(tx_hashes) self.remote_tx_hashes.difference_update(tx_hashes) -- 1.7.1