From 02f40f5036d974ce6fac82fed92676ceea0d8b90 Mon Sep 17 00:00:00 2001 From: coffeedogs Date: Thu, 14 Jun 2018 11:47:46 +0100 Subject: [PATCH] Fixed: ERROR - Too many items in inv message! Closes 1274 --- src/network/bmproto.py | 2 +- src/network/tcp.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/network/bmproto.py b/src/network/bmproto.py index aff6cd0c..1f1c67bd 100644 --- a/src/network/bmproto.py +++ b/src/network/bmproto.py @@ -300,7 +300,7 @@ class BMProto(AdvancedDispatcher, ObjectTracker): def _command_inv(self, dandelion=False): items = self.decode_payload_content("l32s") - if len(items) >= BMProto.maxObjectCount: + if len(items) > BMProto.maxObjectCount: logger.error("Too many items in %sinv message!", "d" if dandelion else "") raise BMProtoExcessiveDataError() else: diff --git a/src/network/tcp.py b/src/network/tcp.py index 163cbd85..6cba566f 100644 --- a/src/network/tcp.py +++ b/src/network/tcp.py @@ -180,7 +180,11 @@ class TCPConnection(BMProto, TLSDispatcher): for hash, storedValue in bigInvList.items(): payload += hash objectCount += 1 - if objectCount >= BMProto.maxObjectCount: + + # Remove -1 below when sufficient time has passed for users to + # upgrade to versions of PyBitmessage that accept inv with 50,000 + # items + if objectCount >= BMProto.maxObjectCount - 1: sendChunk() payload = b'' objectCount = 0