Skip to content
This repository has been archived by the owner on May 13, 2022. It is now read-only.

Prevent RPC error when adding a watchonly address already in another bitcoin-core account #753

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion joinmarket/blockchaininterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,12 @@ def add_watchonly_addresses(self, addr_list, wallet_name):
log.info('importing ' + str(len(addr_list)) +
' addresses into account ' + wallet_name)
for addr in addr_list:
self.rpc('importaddress', [addr, wallet_name, False])
addr_account = self.rpc('getaccount', [addr])
if addr_account:
log.info('Moving address ' + addr + ' into the correct wallet')
self.rpc('setaccount', [addr, wallet_name])
else:
self.rpc('importaddress', [addr, wallet_name, False])
if jm_single().config.get("BLOCKCHAIN",
"blockchain_source") != 'regtest':
print('restart Bitcoin Core with -rescan if you\'re '
Expand Down