From a8025b02c68d5883fafc69c4d53eafa33aef163a Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Tue, 27 Mar 2018 14:59:39 -0400 Subject: [PATCH] log invalid vs missing token --- lbrynet/dht/node.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lbrynet/dht/node.py b/lbrynet/dht/node.py index 00ec2924b..c7dbdf119 100644 --- a/lbrynet/dht/node.py +++ b/lbrynet/dht/node.py @@ -515,18 +515,20 @@ class Node(object): else: raise TypeError, 'No contact info available' - if ((self_store is False) and - ('token' not in value or not self.verify_token(value['token'], compact_ip))): - raise ValueError('Invalid or missing token') + if not self_store: + if 'token' not in value: + raise ValueError("Missing token") + if not self.verify_token(value['token'], compact_ip): + raise ValueError("Invalid token") if 'port' in value: port = int(value['port']) if 0 <= port <= 65536: compact_port = str(struct.pack('>H', port)) else: - raise TypeError, 'Invalid port' + raise TypeError('Invalid port') else: - raise TypeError, 'No port available' + raise TypeError('No port available') if 'lbryid' in value: if len(value['lbryid']) != constants.key_bits / 8: @@ -535,7 +537,7 @@ class Node(object): else: compact_address = compact_ip + compact_port + value['lbryid'] else: - raise TypeError, 'No lbryid given' + raise TypeError('No lbryid given') now = int(time.time()) originallyPublished = now # - age