From b9b4e5f18278d11e6f1882441e9bf5ccf4a26114 Mon Sep 17 00:00:00 2001 From: Daniel McNally Date: Fri, 20 Oct 2017 21:49:31 -0400 Subject: [PATCH] Catch 'already exists' error in importAddress --- lib/wallet/rpc.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/wallet/rpc.js b/lib/wallet/rpc.js index aef5fea3..37e2d0d7 100644 --- a/lib/wallet/rpc.js +++ b/lib/wallet/rpc.js @@ -756,7 +756,12 @@ RPC.prototype.importAddress = async function importAddress(args, help) { addr = parseAddress(addr, this.network); } - await wallet.importAddress(0, addr); + try { + await wallet.importAddress(0, addr); + } catch (err) { + if (err.message !== 'Address already exists.') + throw err; + } if (rescan) await this.wdb.rescan(0);