Don't send requests for 0 objects

This commit is contained in:
Peter Šurda 2017-01-16 23:37:25 +01:00
parent 749bb628c0
commit ca8550a206
Signed by untrusted user: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87

View File

@ -415,6 +415,8 @@ class receiveDataThread(threading.Thread):
# Send a getdata message to our peer to request the object with the given # Send a getdata message to our peer to request the object with the given
# hash # hash
def sendgetdata(self, hashes): def sendgetdata(self, hashes):
if len(hashes) == 0:
return
logger.debug('sending getdata to retrieve %i objects', len(hashes)) logger.debug('sending getdata to retrieve %i objects', len(hashes))
payload = encodeVarint(len(hashes)) + ''.join(hashes) payload = encodeVarint(len(hashes)) + ''.join(hashes)
self.sendDataThreadQueue.put((0, 'sendRawData', protocol.CreatePacket('getdata', payload)), False) self.sendDataThreadQueue.put((0, 'sendRawData', protocol.CreatePacket('getdata', payload)), False)