diff --git a/pytoniq/adnl/overlay/overlay.py b/pytoniq/adnl/overlay/overlay.py index 170822f..e554eb9 100644 --- a/pytoniq/adnl/overlay/overlay.py +++ b/pytoniq/adnl/overlay/overlay.py @@ -138,10 +138,12 @@ async def _process_custom_message(self, message: dict, peer: Node): if data['@type'] == 'overlay.broadcast': from .broadcast import BroadcastSimple await BroadcastSimple(self, data).run() + self.bcast_gc() return if data['@type'] == 'overlay.broadcastFec': from .fec_broadcast import BroadcastFecPart await BroadcastFecPart(self, data).run() + self.bcast_gc() return await self._process_custom_message_handler(data, peer) @@ -238,7 +240,7 @@ async def get_capabilities(self, peer: OverlayNode): return await self.send_query_message(tl_schema_name='tonNode.getCapabilities', data={}, peer=peer) def bcast_gc(self): - i = iter(self.broadcasts) + i = iter(self.broadcasts.copy()) while len(self.broadcasts) > 1000: brcst = next(i) del self.broadcasts[brcst]