greenaddress / garecovery

GreenAddress recovery tool for 2of2 and 2of3 wallets
MIT License
109 stars 53 forks source link

Can't handle alternate datadir for bitcoin core #43

Open winchip2 opened 2 years ago

winchip2 commented 2 years ago

After confirming the mnemonic, this error will occur if the bitcoin core is installed but the datadir is in a different location than the default of /home/[USERNAME]/.bitcoin/

This error will occur even if you make a symbolic link from the alternate datadir to /home/[USERNAME]/.bitcoin/ and even if bitcoind is running with the datadir specified.

Please provide a method to specify the Bitcoin core data directory if it does not reside in the default path.

WARNING:root:[Errno 2] No such file or directory: '/home/[USERNAME]/.bitcoin/.cookie'
Traceback (most recent call last):
  File "/home/[USERNAME]/Downloads/garecovery-master/venv/lib/python3.8/site-packages/garecovery/bitcoincore.py", line 127, in __init__
    http_auth_header = Connection.get_http_auth_header(config, args.network)
  File "/home/[USERNAME]/Downloads/garecovery-master/venv/lib/python3.8/site-packages/garecovery/bitcoincore.py", line 90, in get_http_auth_header
    auth_data = open(rpccookiefile, "r").read().strip().encode("ascii")
FileNotFoundError: [Errno 2] No such file or directory: '/home/[USERNAME]/.bitcoin/.cookie'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/[USERNAME]/Downloads/garecovery-master/venv/bin/garecovery-cli", line 7, in <module>
    sys.exit(recoverycli.main(sys.argv))
  File "/home/[USERNAME]/Downloads/garecovery-master/venv/lib/python3.8/site-packages/garecovery/recoverycli.py", line 98, in main
    txs = recovery.get_transactions()
  File "/home/[USERNAME]/Downloads/garecovery-master/venv/lib/python3.8/site-packages/garecovery/two_of_two_csv.py", line 198, in get_transactions
    utxos = self.scan_subaccount(subaccount_pointer, clargs.args.key_search_depth)
  File "/home/[USERNAME]/Downloads/garecovery-master/venv/lib/python3.8/site-packages/garecovery/two_of_two_csv.py", line 94, in scan_subaccount
    new_utxos = self.get_utxos(outputs)
  File "/home/[USERNAME]/Downloads/garecovery-master/venv/lib/python3.8/site-packages/garecovery/two_of_two_csv.py", line 29, in get_utxos
    core = bitcoincore.Connection(clargs.args)
  File "/home/[USERNAME]/Downloads/garecovery-master/venv/lib/python3.8/site-packages/garecovery/bitcoincore.py", line 153, in __init__
    raise exceptions.BitcoinCoreConnectionError(CORE_CONNECT_ERR.format(connstr))
UnboundLocalError: local variable 'connstr' referenced before assignment
LeoComandini commented 2 years ago

Hi @winchip2 , if the cookie file or conf file does not reside in the default location you can use --rpccookiefile RPCCOOKIEFILE, --config-filename CONFIG_FILENAME or --rpcuser RPCUSER --rpcpassword RPCPASSWORD to specify the authentication credentials.