From 3d0f7d6855dd68e65511151ca58d93a692f7cd32 Mon Sep 17 00:00:00 2001 From: Mononaut Date: Thu, 4 May 2023 19:10:53 -0400 Subject: [PATCH] add missing rbf eviction --- backend/src/api/rbf-cache.ts | 2 +- backend/src/api/websocket-handler.ts | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/src/api/rbf-cache.ts b/backend/src/api/rbf-cache.ts index d75fb0ba8..6c5afc146 100644 --- a/backend/src/api/rbf-cache.ts +++ b/backend/src/api/rbf-cache.ts @@ -163,7 +163,7 @@ class RbfCache { } // flag a transaction as removed from the mempool - public evict(txid, fast: boolean = false): void { + public evict(txid: string, fast: boolean = false): void { if (this.txs.has(txid) && (fast || !this.expiring.has(txid))) { this.expiring.set(txid, fast ? Date.now() + (1000 * 60 * 10) : Date.now() + (1000 * 86400)); // 24 hours } diff --git a/backend/src/api/websocket-handler.ts b/backend/src/api/websocket-handler.ts index f28f284c7..dc773742a 100644 --- a/backend/src/api/websocket-handler.ts +++ b/backend/src/api/websocket-handler.ts @@ -301,6 +301,9 @@ class WebsocketHandler { rbfReplacements = rbfCache.getRbfTrees(false); fullRbfReplacements = rbfCache.getRbfTrees(true); } + for (const deletedTx of deletedTransactions) { + rbfCache.evict(deletedTx.txid); + } const recommendedFees = feeApi.getRecommendedFee(); this.wss.clients.forEach(async (client) => {