From 3a89ee4542a49f233aac33f81252913156dac06c Mon Sep 17 00:00:00 2001 From: undeath Date: Sun, 19 Aug 2018 13:13:47 +0200 Subject: [PATCH] move wallet upgrade docs and improve wallet opening error handling --- docs/release-notes/release-notes-future.md | 29 ---------------------- docs/wallet-upgrade.md | 14 +++++++++++ jmclient/jmclient/wallet_utils.py | 11 +++++++- 3 files changed, 24 insertions(+), 30 deletions(-) delete mode 100644 docs/release-notes/release-notes-future.md create mode 100644 docs/wallet-upgrade.md diff --git a/docs/release-notes/release-notes-future.md b/docs/release-notes/release-notes-future.md deleted file mode 100644 index 695c3b2..0000000 --- a/docs/release-notes/release-notes-future.md +++ /dev/null @@ -1,29 +0,0 @@ -Joinmarket-clientserver future: -=============================== - - -Upgrading -========= - -To upgrade: run the `install.sh` script as mentioned in the README. When prompted to overwrite the directory `jmvenv`, accept. - -A new wallet format has been introduced. Old wallets require conversion. In order to convert your existing wallet to the new format you can use the included conversion tool at `scripts/convert_old_wallet.py`. - -usage: - - python convert_old_wallet.py full/path/to/wallets/wallet.json - -This will place the newly converted `wallet.jmdat` file in the existing joinmarket `wallets/` directory. The wallet name will be adopted accordingly if it differs from `wallet`. - - -Notable changes -=============== - - -Credits -======= - -Thanks to everyone who directly contributed to this release - - - -And thanks also to those who submitted bug reports, tested and otherwise helped out. diff --git a/docs/wallet-upgrade.md b/docs/wallet-upgrade.md new file mode 100644 index 0000000..8fe479d --- /dev/null +++ b/docs/wallet-upgrade.md @@ -0,0 +1,14 @@ +A new wallet format has been introduced. Old wallets require conversion. +In order to convert your existing wallet to the new format you can use the +included conversion tool at `scripts/convert_old_wallet.py`. + +usage: + + python convert_old_wallet.py full/path/to/wallets/wallet.json + +This will place the newly converted `wallet.jmdat` file in the existing +joinmarket `wallets/` directory. The wallet name will be adopted accordingly +if it differs from `wallet`. + +There is no need to move funds to the new wallet. All your funds, addresses, +private keys, history and also your seed will be retained. \ No newline at end of file diff --git a/jmclient/jmclient/wallet_utils.py b/jmclient/jmclient/wallet_utils.py index 053eba6..a054808 100644 --- a/jmclient/jmclient/wallet_utils.py +++ b/jmclient/jmclient/wallet_utils.py @@ -907,7 +907,16 @@ def open_wallet(path, ask_for_password=True, password=None, read_only=False, returns: wallet object """ - if ask_for_password: + if not os.path.isfile(path): + raise Exception("Failed to open wallet at '{}': not a file".format(path)) + + if not Storage.is_storage_file(path): + raise Exception("Failed to open wallet at '{}': not a valid joinmarket" + " wallet.\n\nIf this wallet is in the old json format " + "you need to convert it using the conversion script" + "at `scripts/convert_old_wallet.py`".format(path)) + + if ask_for_password and Storage.is_encrypted_storage_file(path): while True: try: # do not try empty password, assume unencrypted on empty password