tremove broken payment requests. fixes #6350 - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 3cb68b10b94abd6cd8ca9442b6f9ef5773f88557 DIR parent 66d31305e4f90f6abf0a5c078b1913f62a80c65e HTML Author: ThomasV <thomasv@electrum.org> Date: Tue, 12 Jan 2021 14:57:31 +0100 remove broken payment requests. fixes #6350 Diffstat: M electrum/wallet_db.py | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) --- 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 = 34 # electrum >= 2.7 will set this to prevent +FINAL_SEED_VERSION = 35 # electrum >= 2.7 will set this to prevent # old versions from overwriting new format t@@ -182,6 +182,7 @@ class WalletDB(JsonDB): self._convert_version_32() self._convert_version_33() self._convert_version_34() + self._convert_version_35() self.put('seed_version', FINAL_SEED_VERSION) # just to be sure self._after_upgrade_tasks() t@@ -689,8 +690,7 @@ class WalletDB(JsonDB): def _convert_version_32(self): if not self._is_upgrade_method_needed(31, 31): return - - from .invoices import PR_TYPE_ONCHAIN + PR_TYPE_ONCHAIN = 0 invoices_old = self.data.get('invoices', {}) invoices_new = {k: item for k, item in invoices_old.items() if not (item['type'] == PR_TYPE_ONCHAIN and item['outputs'] is None)} t@@ -700,21 +700,18 @@ class WalletDB(JsonDB): def _convert_version_33(self): if not self._is_upgrade_method_needed(32, 32): return - - from .invoices import PR_TYPE_ONCHAIN + PR_TYPE_ONCHAIN = 0 requests = self.data.get('payment_requests', {}) invoices = self.data.get('invoices', {}) for d in [invoices, requests]: for key, item in list(d.items()): if item['type'] == PR_TYPE_ONCHAIN: item['height'] = item.get('height') or 0 - 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'] = \ t@@ -723,6 +720,17 @@ class WalletDB(JsonDB): item['remote_config'].get('upfront_shutdown_script') or "" self.data['seed_version'] = 34 + def _convert_version_35(self): + # same as 32, but for payment_requests + if not self._is_upgrade_method_needed(34, 34): + return + PR_TYPE_ONCHAIN = 0 + requests_old = self.data.get('payment_requests', {}) + requests_new = {k: item for k, item in requests_old.items() + if not (item['type'] == PR_TYPE_ONCHAIN and item['outputs'] is None)} + self.data['payment_requests'] = requests_new + self.data['seed_version'] = 35 + def _convert_imported(self): if not self._is_upgrade_method_needed(0, 13): return