From b08c904ebf1928e6a75b517d3a8d1657bd0a807c Mon Sep 17 00:00:00 2001 From: Yostra Date: Thu, 27 Jan 2022 02:19:42 +0100 Subject: [PATCH] migration (#9948) --- chia/util/default_root.py | 1 + chia/wallet/wallet_node.py | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/chia/util/default_root.py b/chia/util/default_root.py index 7e9727af0769..960be0d1c7ce 100644 --- a/chia/util/default_root.py +++ b/chia/util/default_root.py @@ -2,5 +2,6 @@ import os from pathlib import Path DEFAULT_ROOT_PATH = Path(os.path.expanduser(os.getenv("CHIA_ROOT", "~/.chia/mainnet"))).resolve() +STANDALONE_ROOT_PATH = Path(os.path.expanduser(os.getenv("CHIA_ROOT", "~/.chia/standalone_wallet"))).resolve() DEFAULT_KEYS_ROOT_PATH = Path(os.path.expanduser(os.getenv("CHIA_KEYS_ROOT", "~/.chia_keys"))).resolve() diff --git a/chia/wallet/wallet_node.py b/chia/wallet/wallet_node.py index 9b278591d112..f10cfa07ebdc 100644 --- a/chia/wallet/wallet_node.py +++ b/chia/wallet/wallet_node.py @@ -56,6 +56,7 @@ from chia.types.peer_info import PeerInfo from chia.types.weight_proof import WeightProof, SubEpochData from chia.util.byte_types import hexstr_to_bytes from chia.util.config import WALLET_PEERS_PATH_KEY_DEPRECATED +from chia.util.default_root import STANDALONE_ROOT_PATH from chia.util.ints import uint32, uint64 from chia.util.keychain import KeyringIsLocked, Keychain from chia.util.network import get_host_addr @@ -189,6 +190,11 @@ class WalletNode: .replace("KEY", db_path_key_suffix) ) path = path_from_root(self.root_path, f"{db_path_replaced}_new") + standalone_path = path_from_root(STANDALONE_ROOT_PATH, f"{db_path_replaced}_new") + if not path.exists(): + if standalone_path.exists(): + path.write_bytes(standalone_path.read_bytes()) + mkdir(path.parent) self.new_peak_lock = asyncio.Lock() assert self.server is not None