From d942cb48a5a34b14837c9de30d12d2e88332f3b8 Mon Sep 17 00:00:00 2001 From: softsimon Date: Fri, 2 Apr 2021 11:47:13 +0400 Subject: [PATCH] Catch getMempoolInfo errors gracefully to not break general main loop fixes #411 --- backend/src/index.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/backend/src/index.ts b/backend/src/index.ts index ff32c915b..82608b8d5 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -111,7 +111,16 @@ class Server { async runMainUpdateLoop() { try { - await memPool.$updateMemPoolInfo(); + try { + await memPool.$updateMemPoolInfo(); + } catch (e) { + const msg = `updateMempoolInfo: ${(e.message || e)}`; + if (config.CORE_RPC_MINFEE.ENABLED) { + logger.warn(msg); + } else { + logger.debug(msg); + } + } await blocks.$updateBlocks(); await memPool.$updateMempool(); setTimeout(this.runMainUpdateLoop.bind(this), config.MEMPOOL.POLL_RATE_MS);