From ac06bdc5bbccda08220a8bb28a0bcc9be9038ef3 Mon Sep 17 00:00:00 2001 From: Daniel McNally Date: Thu, 20 Jul 2023 11:18:38 -0400 Subject: [PATCH] Catch duplicate loadWallet error --- lib/bitcoin/BitcoinClient.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/bitcoin/BitcoinClient.ts b/lib/bitcoin/BitcoinClient.ts index af32a64..9145a49 100644 --- a/lib/bitcoin/BitcoinClient.ts +++ b/lib/bitcoin/BitcoinClient.ts @@ -320,7 +320,9 @@ export default class BitcoinClient { } catch (e) { // using error message because bitcoin core error code is not reliable as a single code can contain multiple errors const duplicateLoadString = 'already loaded'; - if (e.toString().toLowerCase().includes(duplicateLoadString)) { + // this error is seen on some versions of bitcoin core when loading a loaded wallet, including v0.20.1 + const alternateDuplicateLoadString = 'Duplicate -wallet filename specified'; + if (e.toString().toLowerCase().includes(duplicateLoadString) || e.toString().includes(alternateDuplicateLoadString)) { Logger.info(`Wallet with name ${this.walletNameToUse} already loaded.`); } else { throw e;