Skip to content

Commit

Permalink
Catch duplicate loadWallet error
Browse files Browse the repository at this point in the history
  • Loading branch information
sangaman committed Jul 22, 2023
1 parent 40cc7cc commit ac06bdc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/bitcoin/BitcoinClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ac06bdc

Please sign in to comment.