JoinMarket-Org / joinmarket

CoinJoin implementation with incentive structure to convince people to take part
398 stars 119 forks source link

JsonRpcError (response["error"]) on master pull #628

Open bobberb opened 7 years ago

bobberb commented 7 years ago

`2016-10-07 15:13:15,645 [MainThread ] [DEBUG] requesting wallet history

2016-10-07 15:13:15,807 [MainThread ] [DEBUG] rpc: getaddressesbyaccount ['joi nmarket-wallet-5a28f4']

Traceback (most recent call last): File "wallet-tool.py", line 107, in jm_single().bc_interface.sync_wallet(wallet) File "/home/josh/working/joinmarket/joinmarket/blockchaininterface.py", line 7 8, in sync_wallet self.sync_addresses(wallet) File "/home/josh/working/joinmarket/joinmarket/blockchaininterface.py", line 6 40, in sync_addresses imported_addr_list = self.rpc('getaddressesbyaccount', [wallet_name]) File "/home/josh/working/joinmarket/joinmarket/blockchaininterface.py", line 5 77, in rpc res = self.jsonRpc.call(method, args) File "/home/josh/working/joinmarket/joinmarket/jsonrpc.py", line 117, in call raise JsonRpcError(response["error"]) joinmarket.jsonrpc.JsonRpcError`

Bitcoin.conf unchanged

AdamISZ commented 7 years ago

This tends to happen if you haven't configured rpc access to your Bitcoin Core node correctly. The sanity check is to try to run an rpc command with the same username and password as set in joinmarket.cfg, but do it on the command line. You can come on #joinmarket on freenode or cgan if you need more help debugging.

bobberb commented 7 years ago

Dear @AdamISZ

bitcoin-cli runs fine, passing this sanity check yes? (and I do feel like I'm going insane :( )

AdamISZ commented 7 years ago

@bobberb Was debugging a similar scenario for another user on IRC, we discovered: if you have previously imported one of the addresses in your Joinmarket wallet to your Bitcoin Core wallet (i.e. the default account "") (this could happen if you used -p to extract the private key, and then imported that key into Bitcoin Core), then attempting to sync your Joinmarket wallet will cause this error, because it will complain that you already own this address+private key (the error is {u'id': 3, u'result': None, u'error': {u'message': u'The wallet already contains the private key for this address or script', u'code': -4}}, although that's hidden), so you can't also import it as watch-only.

The only easy solution I saw, if this is the case, is to create a fresh wallet.dat for running Joinmarket separately to your normal wallet. I don't like this solution, it's a bit clunky, also you may find that you need to -rescan again (not sure). Your JM wallet should recognize then that that address has been used, and will not try to use it again for receiving, although if it has funds, it may (will, eventually) spend those funds. Depending on your situation, it might be easier to make a fresh JM wallet.

Relevant perhaps is this pull request to Bitcoin Core: https://github.com/bitcoin/bitcoin/pull/8694