From 0b771c16ba058d3919b2bac482f4d725473a72fa Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Tue, 24 Oct 2017 14:55:20 -0400 Subject: [PATCH] fix lbry id for dead contact to replace in _IterativeFindHelper --- lbrynet/dht/node.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lbrynet/dht/node.py b/lbrynet/dht/node.py index 2dfa71fea..c77dc27c8 100644 --- a/lbrynet/dht/node.py +++ b/lbrynet/dht/node.py @@ -753,10 +753,11 @@ class _IterativeFindHelper(object): if testContact not in self.shortlist: self.shortlist.append(testContact) - def removeFromShortlist(self, failure): + def removeFromShortlist(self, failure, deadContactID): """ @type failure: twisted.python.failure.Failure """ failure.trap(protocol.TimeoutError) - deadContactID = failure.getErrorMessage() + if len(deadContactID) != constants.key_bits / 8: + raise ValueError("invalid lbry id") if deadContactID in self.shortlist: self.shortlist.remove(deadContactID) return deadContactID @@ -826,7 +827,7 @@ class _IterativeFindHelper(object): rpcMethod = getattr(contact, self.rpc) df = rpcMethod(self.key, rawResponse=True) df.addCallback(self.extendShortlist) - df.addErrback(self.removeFromShortlist) + df.addErrback(self.removeFromShortlist, contact.id) df.addCallback(self.cancelActiveProbe) df.addErrback(lambda _: log.exception('Failed to contact %s', contact)) self.already_contacted.append(contact.id)