tstorage: fix convert_version_17 and add new test case - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 9ecb50473924e89d3792086a078bd34ec2db8458 DIR parent ef8d7e3227a11995bc3278e69229538b47cc31a8 HTML Author: SomberNight <somber.night@protonmail.com> Date: Fri, 1 Mar 2019 19:46:23 +0100 storage: fix convert_version_17 and add new test case follow-up 121b8048b056e797a8a46899e137c277082a66aa Diffstat: M electrum/json_db.py | 6 ++---- M electrum/tests/test_storage_upgradā¦ | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 4 deletions(-) --- DIR diff --git a/electrum/json_db.py b/electrum/json_db.py t@@ -399,11 +399,9 @@ class JsonDB(PrintError): self.put('pruned_txo', None) - from .transaction import Transaction - transactions = self.get('transactions', {}) # txid -> raw_tx + transactions = self.get('transactions', {}) # txid -> Transaction spent_outpoints = defaultdict(dict) - for txid, raw_tx in transactions.items(): - tx = Transaction(raw_tx) + for txid, tx in transactions.items(): for txin in tx.inputs(): if txin['type'] == 'coinbase': continue DIR diff --git a/electrum/tests/test_storage_upgrade.py b/electrum/tests/test_storage_upgrade.py t@@ -3,10 +3,22 @@ import tempfile from electrum.storage import WalletStorage from electrum.wallet import Wallet +from electrum import constants from .test_wallet import WalletTestCase +def testnet_wallet(func): + # note: it's ok to modify global network constants in subclasses of SequentialTestCase + def wrapper(self, *args, **kwargs): + constants.set_testnet() + try: + return func(self, *args, **kwargs) + finally: + constants.set_mainnet() + return wrapper + + # TODO add other wallet types: 2fa, xpub-only # TODO hw wallet with client version 2.6.x (single-, and multiacc) class TestStorageUpgrade(WalletTestCase): t@@ -235,6 +247,11 @@ class TestStorageUpgrade(WalletTestCase): parazyd.org:70 /git/electrum/commit/9ecb50473924e89d3792086a078bd34ec2db8458.gph:63: line too long