From c94a25d573c30ac1bcb1afad54b38d94391febc5 Mon Sep 17 00:00:00 2001 From: Paul Puey Date: Fri, 11 Jul 2025 18:10:35 -0700 Subject: [PATCH] Fix crash when memletConfig not provided This is necessary on NodeJS deployments when there's no nativeIo --- CHANGELOG.md | 2 ++ src/common/plugin/CurrencyPlugin.ts | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 709bd469..0f62e498 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +- fixed: Crash when running under NodeJS due to missing memletConfig + ## 3.8.2 (2025-06-09) - changed: Remove NOWNodes blockbook connection for Firo. diff --git a/src/common/plugin/CurrencyPlugin.ts b/src/common/plugin/CurrencyPlugin.ts index bcb1e7c3..b1985aeb 100644 --- a/src/common/plugin/CurrencyPlugin.ts +++ b/src/common/plugin/CurrencyPlugin.ts @@ -42,14 +42,20 @@ export function makeCurrencyPlugin( }) if (!hasMemletBeenSet) { - const { memletConfig } = nativeIo[ + const pluginConfig = nativeIo[ 'edge-currency-plugins' ] as EdgeCurrencyPluginNativeIo + const memletConfig = pluginConfig?.memletConfig + if (memletConfig != null) { - hasMemletBeenSet = true setMemletConfig(memletConfig) + } else { + setMemletConfig({ + maxMemoryUsage: 50 * 1024 * 1024 // 50MB + }) } + hasMemletBeenSet = true } const instance: EdgeCurrencyPlugin = {