twallet_db: migrate to upfront shutdown scripts - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit e5458bb5348be6d73ff834f7db3cd4a993c7ed6a DIR parent cf6e3e4efa45c2df33a2c5453296f1e7a0a6b81d HTML Author: bitromortac <bitromortac@protonmail.com> Date: Fri, 18 Dec 2020 11:05:36 +0100 wallet_db: migrate to upfront shutdown scripts Diffstat: M electrum/wallet_db.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) --- DIR diff --git a/electrum/wallet_db.py b/electrum/wallet_db.py t@@ -52,7 +52,7 @@ if TYPE_CHECKING: OLD_SEED_VERSION = 4 # electrum versions < 2.0 NEW_SEED_VERSION = 11 # electrum versions >= 2.0 -FINAL_SEED_VERSION = 33 # electrum >= 2.7 will set this to prevent +FINAL_SEED_VERSION = 34 # electrum >= 2.7 will set this to prevent # old versions from overwriting new format t@@ -181,6 +181,7 @@ class WalletDB(JsonDB): self._convert_version_31() self._convert_version_32() self._convert_version_33() + self._convert_version_34() self.put('seed_version', FINAL_SEED_VERSION) # just to be sure self._after_upgrade_tasks() t@@ -710,6 +711,18 @@ class WalletDB(JsonDB): self.data['seed_version'] = 33 + def _convert_version_34(self): + if not self._is_upgrade_method_needed(33, 33): + return + + channels = self.data.get('channels', {}) + for key, item in channels.items(): + item['local_config']['upfront_shutdown_script'] = \ + item['local_config'].get('upfront_shutdown_script') or "" + item['remote_config']['upfront_shutdown_script'] = \ + item['remote_config'].get('upfront_shutdown_script') or "" + self.data['seed_version'] = 34 + def _convert_imported(self): if not self._is_upgrade_method_needed(0, 13): return