wallet_db: migrate to upfront shutdown scripts
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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()
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user