diff --git a/lbrynet/dht/node.py b/lbrynet/dht/node.py index 39e8291b0..a3681b604 100644 --- a/lbrynet/dht/node.py +++ b/lbrynet/dht/node.py @@ -518,7 +518,9 @@ class Node(MockKademliaHelper): if originalPublisherID is None: originalPublisherID = rpc_contact.id compact_ip = rpc_contact.compact_ip() - if not self.verify_token(token, compact_ip): + if self.clock.seconds() - self._protocol.started_listening_time < constants.tokenSecretChangeInterval: + pass + elif not self.verify_token(token, compact_ip): raise ValueError("Invalid token") if 0 <= port <= 65536: compact_port = str(struct.pack('>H', port)) diff --git a/lbrynet/dht/protocol.py b/lbrynet/dht/protocol.py index 73b81bc2c..40407d191 100644 --- a/lbrynet/dht/protocol.py +++ b/lbrynet/dht/protocol.py @@ -103,6 +103,7 @@ class KademliaProtocol(protocol.DatagramProtocol): self._listening = defer.Deferred(None) self._ping_queue = PingQueue(self._node) self._protocolVersion = constants.protocolVersion + self.started_listening_time = 0 def _migrate_incoming_rpc_args(self, contact, method, *args): if method == 'store' and contact.protocolVersion == 0: @@ -202,6 +203,7 @@ class KademliaProtocol(protocol.DatagramProtocol): if self._listening.called: self._listening = defer.Deferred() self._listening.callback(True) + self.started_listening_time = self._node.clock.seconds() return self._ping_queue.start() def datagramReceived(self, datagram, address):