diff --git a/lib/p2p/Pool.ts b/lib/p2p/Pool.ts index 1b1d7aef4..d4cc7c0c2 100644 --- a/lib/p2p/Pool.ts +++ b/lib/p2p/Pool.ts @@ -728,7 +728,9 @@ class Pool extends EventEmitter { const orderInvalidationPacket = new packets.OrderInvalidationPacket({ id, pairId, quantity }); this.peers.forEach(async (peer) => { if (!nodeToExclude || peer.nodePubKey !== nodeToExclude) { - await peer.sendPacket(orderInvalidationPacket); + if (peer.isPairActive(pairId)) { + await peer.sendPacket(orderInvalidationPacket); + } } }); @@ -786,8 +788,12 @@ class Pool extends EventEmitter { } case PacketType.OrderInvalidation: { const orderInvalidation = (packet as packets.OrderInvalidationPacket).body!; - this.logger.trace(`received order invalidation from ${peer.label}: ${JSON.stringify(orderInvalidation)}`); - this.emit('packet.orderInvalidation', orderInvalidation, peer.nodePubKey as string); + if (peer.isPairActive(orderInvalidation.pairId)) { + this.logger.trace(`received order invalidation from ${peer.label}: ${JSON.stringify(orderInvalidation)}`); + this.emit('packet.orderInvalidation', orderInvalidation, peer.nodePubKey as string); + } else { + this.logger.trace(`received order invalidation for inactive pair from ${peer.label}: ${JSON.stringify(orderInvalidation)}`); + } break; } case PacketType.GetOrders: {