wallet db upgrade: rm support of "legacy" lightning channels
("legacy" as in pre-static-remote-key channels)
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 = 48 # electrum >= 2.7 will set this to prevent
|
||||
FINAL_SEED_VERSION = 49 # electrum >= 2.7 will set this to prevent
|
||||
# old versions from overwriting new format
|
||||
|
||||
|
||||
@@ -197,6 +197,7 @@ class WalletDB(JsonDB):
|
||||
self._convert_version_46()
|
||||
self._convert_version_47()
|
||||
self._convert_version_48()
|
||||
self._convert_version_49()
|
||||
self.put('seed_version', FINAL_SEED_VERSION) # just to be sure
|
||||
|
||||
self._after_upgrade_tasks()
|
||||
@@ -953,6 +954,22 @@ class WalletDB(JsonDB):
|
||||
item['amount_msat'] = "!"
|
||||
self.data['seed_version'] = 48
|
||||
|
||||
def _convert_version_49(self):
|
||||
if not self._is_upgrade_method_needed(48, 48):
|
||||
return
|
||||
channels = self.data.get('channels', {})
|
||||
legacy_chans = [chan_dict for chan_dict in channels.values()
|
||||
if chan_dict['channel_type'] == ChannelType.OPTION_LEGACY_CHANNEL]
|
||||
if legacy_chans:
|
||||
raise WalletFileException(
|
||||
f"This wallet contains {len(legacy_chans)} lightning channels of type 'LEGACY'. "
|
||||
f"These channels were created using unreleased development versions of Electrum "
|
||||
f"before the first lightning-capable release of 4.0, and are not supported anymore. "
|
||||
f"Please use Electrum 4.3.0 to open this wallet, close the channels, "
|
||||
f"and delete them from the wallet."
|
||||
)
|
||||
self.data['seed_version'] = 49
|
||||
|
||||
def _convert_imported(self):
|
||||
if not self._is_upgrade_method_needed(0, 13):
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user