From 67ea59c5c475fdd0b0dc4be894dac000a95b13e4 Mon Sep 17 00:00:00 2001 From: Maddiaa0 <47148561+Maddiaa0@users.noreply.github.com> Date: Sat, 30 Nov 2024 15:58:39 +0000 Subject: [PATCH] fmt --- yarn-project/p2p/src/client/p2p_client.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/yarn-project/p2p/src/client/p2p_client.ts b/yarn-project/p2p/src/client/p2p_client.ts index 9fcb8dd1f69..8e6e86f1761 100644 --- a/yarn-project/p2p/src/client/p2p_client.ts +++ b/yarn-project/p2p/src/client/p2p_client.ts @@ -623,6 +623,7 @@ export class P2PClient extends WithTracer implements P2P { const lastBlockNum = blocks[blocks.length - 1].number; const lastBlockSlot = blocks[blocks.length - 1].header.globalVariables.slotNumber.toBigInt(); + // If keepProvenTxsFor is 0, we delete all txs from all proven blocks. if (this.keepProvenTxsFor === 0) { await this.deleteTxsFromBlocks(blocks); } else if (lastBlockNum - this.keepProvenTxsFor >= INITIAL_L2_BLOCK_NUM) { @@ -634,8 +635,9 @@ export class P2PClient extends WithTracer implements P2P { } // We delete attestations older than the last block slot minus the number of slots we want to keep in the pool. - if (lastBlockSlot - BigInt(this.keepAttestationsInPoolFor) >= BigInt(INITIAL_L2_BLOCK_NUM)) { - await this.attestationPool.deleteAttestationsOlderThan(lastBlockSlot - BigInt(this.keepAttestationsInPoolFor)); + const lastBlockSlotMinusKeepAttestationsInPoolFor = lastBlockSlot - BigInt(this.keepAttestationsInPoolFor); + if (lastBlockSlotMinusKeepAttestationsInPoolFor >= BigInt(INITIAL_L2_BLOCK_NUM)) { + await this.attestationPool.deleteAttestationsOlderThan(lastBlockSlotMinusKeepAttestationsInPoolFor); } await this.synchedProvenBlockNumber.set(lastBlockNum);