test px and backoff

This commit is contained in:
Khwahish29
2025-06-23 00:41:13 +05:30
parent 24e73207d2
commit ea6eef6ed5
3 changed files with 119 additions and 2 deletions

View File

@ -735,7 +735,7 @@ class GossipSub(IPubsubRouter, Service):
:param topic: topic to check
:return: True if the peer is in back off, False otherwise
"""
if topic not in self.back_off:
if topic not in self.back_off or peer not in self.back_off[topic]:
return False
if self.back_off[topic].get(peer, 0) > int(time.time()):
return True