import shutil
import tempfile
import os

from electrum_sum.storage import WalletStorage
from electrum_sum.wallet import Wallet
from electrum_sum import constants

from .test_wallet import WalletTestCase


# TODO add other wallet types: 2fa, xpub-only
# TODO hw wallet with client version 2.6.x (single-, and multiacc)
class TestStorageUpgrade(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

##########

    def test_upgrade_from_client_1_9_8_seeded(self):
        wallet_str = "{'addr_history':{'LRLeVkmShS9bXwbFJxXxrMxQgBJb1CxRW4':[],'LPi4d5i97ayJLNvgWdFJHrmnrmkr3BAgdS':[],'LXupCaL8GsoAAC3c6ayRuQiF6oKd6jzvF2':[],'LbGiejb64pNXrjPZfiauVkchFQksBnFjrz':[],'LXxqjQvF2cEDJ58YLFJvPAT8155Q4q6D63':[],'LhVBwnh66BYu2i8tGGG7BpxGrm7Uz9RSMq':[],'LhPe5cGcQiGM4rJg8uRxuDmA43dzQUckM4':[],'Lc2ZerD7r4iMufWnkUFRVoqj8zaUdra9gy':[]},'accounts_expanded':{},'master_public_key':'756d1fe6ded28d43d4fea902a9695feb785447514d6e6c3bdf369f7c3432fdde4409e4efbffbcf10084d57c5a98d1f34d20ac1f133bdb64fa02abf4f7bde1dfb','use_encryption':False,'seed':'2605aafe50a45bdf2eb155302437e678','accounts':{0:{0:['LXxqjQvF2cEDJ58YLFJvPAT8155Q4q6D63','LhPe5cGcQiGM4rJg8uRxuDmA43dzQUckM4','LRLeVkmShS9bXwbFJxXxrMxQgBJb1CxRW4','LhVBwnh66BYu2i8tGGG7BpxGrm7Uz9RSMq','LPi4d5i97ayJLNvgWdFJHrmnrmkr3BAgdS'],1:['LbGiejb64pNXrjPZfiauVkchFQksBnFjrz','Lc2ZerD7r4iMufWnkUFRVoqj8zaUdra9gy','LXupCaL8GsoAAC3c6ayRuQiF6oKd6jzvF2']}},'seed_version':4}"
        self._upgrade_storage(wallet_str)

    # TODO pre-2.0 mixed wallets are not split currently
    #def test_upgrade_from_client_1_9_8_mixed(self):
    #    wallet_str = "{'addr_history':{'LPi4d5i97ayJLNvgWdFJHrmnrmkr3BAgdS':[],'LRLeVkmShS9bXwbFJxXxrMxQgBJb1CxRW4':[],'LXxqjQvF2cEDJ58YLFJvPAT8155Q4q6D63':[],'LhVBwnh66BYu2i8tGGG7BpxGrm7Uz9RSMq':[],'LhPe5cGcQiGM4rJg8uRxuDmA43dzQUckM4':[],'LXupCaL8GsoAAC3c6ayRuQiF6oKd6jzvF2':[],'LbGiejb64pNXrjPZfiauVkchFQksBnFjrz':[],'Lc2ZerD7r4iMufWnkUFRVoqj8zaUdra9gy':[]},'accounts_expanded':{},'master_public_key':'756d1fe6ded28d43d4fea902a9695feb785447514d6e6c3bdf369f7c3432fdde4409e4efbffbcf10084d57c5a98d1f34d20ac1f133bdb64fa02abf4f7bde1dfb','use_encryption':False,'seed':'2605aafe50a45bdf2eb155302437e678','accounts':{0:{0:['LXxqjQvF2cEDJ58YLFJvPAT8155Q4q6D63','LhPe5cGcQiGM4rJg8uRxuDmA43dzQUckM4','LRLeVkmShS9bXwbFJxXxrMxQgBJb1CxRW4','LhVBwnh66BYu2i8tGGG7BpxGrm7Uz9RSMq','LPi4d5i97ayJLNvgWdFJHrmnrmkr3BAgdS'],1:['LbGiejb64pNXrjPZfiauVkchFQksBnFjrz','Lc2ZerD7r4iMufWnkUFRVoqj8zaUdra9gy','LXupCaL8GsoAAC3c6ayRuQiF6oKd6jzvF2'],'mpk':'756d1fe6ded28d43d4fea902a9695feb785447514d6e6c3bdf369f7c3432fdde4409e4efbffbcf10084d57c5a98d1f34d20ac1f133bdb64fa02abf4f7bde1dfb'}},'imported_keys':{'LPRvUteVjy7MwDYro7o6XJ8SzhaYBJQhoM':'6vHESf1YF8tPdqpGyEiNvibJPRZzKsB4ijYsywkUaz3SfUAnidY','LZBc9EVXNXW1aGdrxodATNp9kYeCxufeWb':'T96yXyhXKvujT4sMAPihoJJ2sXNTwDircc7WnT2qqXTdBs433uZ5','LMK1a5LKLkLFCEKukwwTrGxPboNvZjDbcY':'T8hVerMmMsVnq7mkXpEw4krEhXJ5BZNVv7mb4C7LoV8Ni8iywME1'},'seed_version':4}"
    #    self._upgrade_storage(wallet_str, accounts=2)

    def test_upgrade_from_client_2_0_4_seeded(self):
        wallet_str = '{"accounts":{"0":{"change":["03d8e267e8de7769b52a8727585b3c44b4e148b86b2c90e3393f78a75bd6aab83f","03f09b3562bec870b4eb8626c20d449ee85ef17ea896a6a82b454e092eef91b296","02df953880df9284715e8199254edcf3708c635adc92a90dbf97fbd64d1eb88a36"],"receiving":["02cd4d73d5e335dafbf5c9338f88ceea3d7511ab0f9b8910745ac940ff40913a30","0243ed44278a178101e0fb14d36b68e6e13d00fe3434edb56e4504ea6f5db2e467","0367c0aa3681ec3635078f79f8c78aa339f19e38d9e1c9e2853e30e66ade02cac3","0237d0fe142cff9d254a3bdd3254f0d5f72676b0099ba799764a993a0d0ba80111","020a899fd417527b3929c8f625c93b45392244bab69ff91b582ed131977d5cd91e","039e84264920c716909b88700ef380336612f48237b70179d0b523784de28101f7","03125452df109a51be51fe21e71c3a4b0bba900c9c0b8d29b4ee2927b51f570848","0291fa554217090bab96eeff63e1c6fdec37358ed597d18fa32c60c02a48878c8c","030b6354a4365bab55e86269fb76241fd69716f02090ead389e1fce13d474aa569","023dcba431d8887ab63595f0df1e978e4a5f1c3aac6670e43d03956448a229f740","0332a61cbe04fe027033369ce7569b860c24462878bdd8c0332c22a3f5fdcc1790","021249480422d93dba2aafcd4575e6f630c4e3a2a832dd8a15f884e1052b6836e4","02516e91dede15d3a15dd648591bb92e107b3a53d5bc34b286ab389ce1af3130aa","02e1da3dddd81fa6e4895816da9d4b8ab076d6ea8034b1175169c0f247f002f4cf","0390ef1e3fdbe137767f8b5abad0088b105eee8c39e075305545d405be3154757a","03fca30eb33c6e1ffa071d204ccae3060680856ae9b93f31f13dd11455e67ee85d","034f6efdbbe1bfa06b32db97f16ff3a0dd6cf92769e8d9795c465ff76d2fbcb794","021e2901009954f23d2bf3429d4a531c8ca3f68e9598687ef816f20da08ff53848","02d3ccf598939ff7919ee23d828d229f85e3e58842582bf054491c59c8b974aa6e","03a1daffa39f42c1aaae24b859773a170905c6ee8a6dab8c1bfbfc93f09b88f4db"],"xpub":"xpub661MyMwAqRbcFsrzES8RWNiD7RxDqT4p8NjvTY9mLi8xdphQ9x1TiY8GnqCpQx4LqJBdcGeXrsAa2b2G7ZcjJcest9wHcqYfTqXmQja6vfV"}},"accounts_expanded":{},"master_private_keys":{"x/":"xprv9s21ZrQH143K3PnX8QbR9EmUZQ7jRzLxm9pKf9k9nNbym2NFcQhDAjonwZ39jtWLYp6qk5UHotj13p2y7w1ZhhvvyV5eCcaPUrKofs9CXQ9"},"master_public_keys":{"x/":"xpub661MyMwAqRbcFsrzES8RWNiD7RxDqT4p8NjvTY9mLi8xdphQ9x1TiY8GnqCpQx4LqJBdcGeXrsAa2b2G7ZcjJcest9wHcqYfTqXmQja6vfV"},"seed":"seven direct thunder glare prevent please fatal blush buzz artefact gate vendor above","seed_version":11,"use_encryption":false,"wallet_type":"standard"}'
        self._upgrade_storage(wallet_str)

    def test_upgrade_from_client_2_0_4_importedkeys(self):
        wallet_str = '{"accounts":{"/x":{"imported":{"LMK1a5LKLkLFCEKukwwTrGxPboNvZjDbcY":["0344b1588589958b0bcab03435061539e9bcf54677c104904044e4f8901f4ebdf5","T8hVerMmMsVnq7mkXpEw4krEhXJ5BZNVv7mb4C7LoV8Ni8iywME1"],"LPRvUteVjy7MwDYro7o6XJ8SzhaYBJQhoM":["04575f52b82f159fa649d2a4c353eb7435f30206f0a6cb9674fbd659f45082c37d559ffd19bea9c0d3b7dcc07a7b79f4cffb76026d5d4dff35341efe99056e22d2","6vHESf1YF8tPdqpGyEiNvibJPRZzKsB4ijYsywkUaz3SfUAnidY"],"LZBc9EVXNXW1aGdrxodATNp9kYeCxufeWb":["0389508c13999d08ffae0f434a085f4185922d64765c0bff2f66e36ad7f745cc5f","T96yXyhXKvujT4sMAPihoJJ2sXNTwDircc7WnT2qqXTdBs433uZ5"]}}},"accounts_expanded":{},"use_encryption":false,"wallet_type":"imported"}'
        self._upgrade_storage(wallet_str)

    def test_upgrade_from_client_2_0_4_watchaddresses(self):
        wallet_str = '{"accounts":{"/x":{"imported":{"LXupCaL8GsoAAC3c6ayRuQiF6oKd6jzvF2":[null,null],"LbGiejb64pNXrjPZfiauVkchFQksBnFjrz":[null,null],"Lc2ZerD7r4iMufWnkUFRVoqj8zaUdra9gy":[null,null]}}},"accounts_expanded":{},"wallet_type":"imported"}'
        self._upgrade_storage(wallet_str)

    def test_upgrade_from_client_2_0_4_trezor_singleacc(self):
        wallet_str = '''{"accounts":{"0":{"change":["033608f89d381bcb9964df9da428d706d3eb30c14433af8de21bee2601e7392a80","0295c3905730d987ae9a9c09ad85c9c22c28aa414448f9d3450d8afb3da0d78890","038cf10bcf2bd3384f05974295fc83fc4e9cb48c0105995ad86d3ea237edb7e1d1"],"receiving":["020be78fa1a35e44fb1ee3141b40bd8d68330f12f98fdef5ba249b4d8c52a6a1ae","03f23e9a3b5337f322f720f533653349f6e97228d1c4a6feca36d4d1554aa19f74","03d3e7cfde0117561856e6e43d87852480c512910bfd1988c2ff1e6f6d795f7046","02ec56fc0bfe6a1466a783737919edbe83c8907af29a5ae672919ffcb1bb96303f","031b1d151f6584f9926614a7c335ee61606ff7a9769ca6e175ad99f9c7b5e9fb4d","03d782be0ace089e02529029b08ca9107b0e58302306de30bd9f9a3a1ed40c3717","0325784a4290eeeea1f99a928cf6c75c33417659dbd50a3a2850136dc3138ba631","035b7c1176926a54cdeb0342df5ecc7bb3fe1820fce99491fb50c091e3093f200f","02e0a2d615bff26a57754afa0e8ac8b692a79b399f6d04647398f377dcac4116be","026c7cee5bce1ae9e2fa930001ece81c35442a461fc9ef1266ac3d41b9f13e3bd5","0217b1d5066708e0cdaee99087c407db684131e34578adc7800dc66f329576c457","03ec0ed891b0ead00f1eaca7a4736d6816e348731d995bd4e77acbc8c582f68429","028cb4c682dde9692de47f71f3b16755cc440d722b84eed68db2b3d80bce83d50a","03d5d770a58d32b5d59b12861bbda37560fe7b789181b3349abf56223ea61b39c4","0250b6aee8338ac0497f2106b0ed014f5a2419c7bf429eb2b17a70bec77e6ff482","02565da9be6fc66a1e354638dcd8a4244e8733f38599c91c4f1ab0fb8d5d94fd2f","02e6c88509ff676b686afc2326370684bbc6edc0b31e09f312df4f7a17fe379e31","02224fef0921e61adcb2cd14ef45dbe4b859f1fcdc62eba26c6a7ce386c0a8f4b1","034c63da9c2a20132d9fd1088028de18f7ccd72458f9eb07a72452bd9994d28b1f","032bfe2fc88a55e19ba2338155b79e67b7d061d5fd1844bc8edc1808d998f8ba2c"],"xpub":"xpub6D77dkWgEcSNBq7xDA1RUysGvD64QNy2TykC9UuRK6fEzqy3512HR2p2spstKCybkhDqkNStPWZKcnhwdD6kDYWJxsTQJhg9RCwifzcfJN9"}},"accounts_expanded":{},"labels":{"0":"Main account"},"master_public_keys":{"x/0'":"xpub6D77dkWgEcSNBq7xDA1RUysGvD64QNy2TykC9UuRK6fEzqy3512HR2p2spstKCybkhDqkNStPWZKcnhwdD6kDYWJxsTQJhg9RCwifzcfJN9","x/1'":"xpub6D77dkWgEcSNFtXV2CQgsbfG33VyGMaUtUdpbdfMMHsS4WDzLtRapchQWcVBMFFjdRYjhkvQwGnJeKWPP3C2e1DevATAEUzL258Lhfkd7KG"},"next_account2":["1","xpub6D77dkWgEcSNFtXV2CQgsbfG33VyGMaUtUdpbdfMMHsS4WDzLtRapchQWcVBMFFjdRYjhkvQwGnJeKWPP3C2e1DevATAEUzL258Lhfkd7KG","03571f041921078b153a496638d703dfd1cee75e73c42653bbe0650ab6168d6a5b","LSvzG3x2mkWo9bpAW4UsvTQtkPqSoUkJop"],"wallet_type":"trezor"}'''
        self._upgrade_storage(wallet_str)

    def test_upgrade_from_client_2_0_4_trezor_multiacc(self):
        wallet_str = '''{"accounts":{"0":{"change":["03143bc04f007c454e03caf9d59b61e27f527b5e6723e167b50197ce45e2071902","03157710459a8213a79060e2f2003fe0eb7a7ed173ac3f846309de52269dd44740","028ec4bbbf4ac9edfabb704bd82acb0840f2166312929ce01af2b2e99059b16dee"],"receiving":["03d27c0f5594d8df0616d64a735c909098eb867d01c6f1588f04ca2cf353837ec0","024d299f21e9ee9cc3eb425d04f45110eff46e45abcab24a3e594645860518fb97","03f6bc650e5f118ab4a63359a9cde4ab8382fe16e7d1b36b0a459145a79bef674b","028bed00a2fbd03f1ff43e0150ec1018458f7b39f3e4e602e089b1f47f8f607136","02108b15014d53f2e4e1b5b2d8f5eaf82006bbc4f273dbfbaef91eff08f9d10ea5","02a9a59a529818f3ba7a37ebe34454eac2bcbe4da0e8566b13f369e03bb020c4c4","023fde4ecf7fbdffb679d92f58381066cf2d840d34cb2d8bef63f7c5182d278d53","02ad8bf6dc0ff3c39bd20297d77fbd62073d7bf2fa44bf716cdd026db0819bb2b4","029c8352118800beaef1f3fa9c12afe30d329e7544bea9b136b717b88c24d95d92","02c42c251392674e2c2768ccd6224e04298bd5479436f02e9867ecc288dd2eb066","0316f3c82d9fce97e267b82147d56a4b170d39e6cf01bfaff6c2ae6bcc79a14447","0398554ee8e333061391b3e866505bbc5e130304ae09b198444bcd31c4ba7846ea","02e69d21aadb502e9bd93c5536866eff8ca6b19664545ccc4e77f3508e0cbe2027","0270fb334407a53a23ad449389e2cb055fae5017ca4d79ec8e082038db2d749c50","03d91a8f47453f9da51e0194e3aacff88bf79a625df82ceee73c71f3a7099a5459","0306b2d3fd06c4673cc90374b7db0c152ba7960be382440cecc4cdad7642e0537c","028020dd6062f080e1e2b49ca629faa1407978adab13b74875a9de93b16accf804","03907061c5f6fde367aafe27e1d53b39ff9c2babffe8ab7cf8c3023acba5c39736","029749462dba9af034455f5e0f170aac67fe9365ce7126092b4d24ced979b5381f","02f001d35308833881b3440670d25072256474c6c4061daf729055bf9563134105"],"xpub":"xpub6BycoSLDNcWjBQMuYgSaEoinupMjma8Cu2uj4XiRCZkecLHXXmzcxbyR1gdfrZpiZDVSs92MEGGNhF78BEbbYi2b5U2oPnaUPRhjriWz85y"},"1":{"change":["03b0df486b4e1baa03ad565622820d692089b059c8f9fefa3567c3fa26d0cbaa34","0294c76c062c865873dccab84d51682f880e0197b64789c61bff85e1be2506925e","036f900d0c6bafbbcac0fbc95bed44954007faa182655cf69dc84d50c22e6edce8"],"receiving":["02106878f6aefd9a81e1ca4a5f30ea0e1851aa36404fb62d19bd2325e180112b58","039e95f369e8d65aa7a7bf6a5d7d3259b827c1549c77c9b502b75a18f7708a9aa9","0273197861097be131542f8b7e03bc912934da51bc957d425be5bc7c1b69fb44ec","02b4c829b6a20815c5e1eef7ffd5d55c99505a7afeac5135ec2c97cfaae3483604","0312b1285272f1005c5834de2eec830ce9f9163c842d728c3921ae790716d8503f","0354059948c709c777a49a37e150271a3377f7aaee17798253d5240e4119f2a1c6","03800d87cc3878912d22a42a79db7ddbff3efec727d29ae1c0165730e5314483cd","03cafa35ad9adb41cff39e3bc2e0592d88c8b91981e73f068397e6c863c42c7b00","028668f734a4927e03621e319ab385919e891d248c86aea07ab922492d3d414ad3","02e42d46823893978ae7be9e032be21ce3e613cecb5ffe687b534795f90dc8ef85","03b86914af797e7b68940bc4ee2dec134036781a8e23ffaf4189ca7637e0afe898","021221ae9be51a9747aa7ebc2213a42a2364ce790ee86255277dc5f9beeb0bf6b4","03c8d58183f5d8102f8eb5f6db0f60add0a51ec6737097c46fc8a6b7c840d7571f","0304de0806b299cef4be3a162bac78f811d4adacc6a229ffdaeb7333bce72d88ff","03e08262e18616a3a9b9aecbfb8a860ccee147820a3c60050695ef72ff2cedc4a7","02caf4d61bb5deec29a39e5a1cc6d5987ec71d61d57c57bb5c2a47dd9266130bec","0252d429002d9c06f0befbef6c389bdd021969b416dd83d220394e414bd5d83c0a","024e23ce58533163df3e1d5766295144beb8f9729b1ac41e80ba485f39c483dfe6","026de9e7e6b11fbecd88b7b49915b5df64d672ef900aa043a8cac3bc79eb414089","02aaac08fc100014ec692efa0f3b408bf741e1dc68ebe28ce41837662810f40986","03e0d2b426705dcc5cb62c6113b10153f10624c926a3fe86142fd9020e7d6a2129"],"xpub":"xpub6BycoSLDNcWjFs4B6T82q4zCbJBJdzQLwburAtBAwTLPyDPtkotGUWbef1t8D6XuCs6Yz5FUgFaL2hNzCTGe8F1bf9vNyXFMgLyKV65C9BH"}},"accounts_expanded":{},"addr_history":{"LM9TfCciLzZUpYUhg2VkBgoC81bQwrav4C":[["a242aeff746aa481c5d8a496111039262f2a3fbde6038124301522539fa06837",490002]]},"labels":{"0":"Main account","1":"acc1"},"master_public_keys":{"x/0'":"xpub6BycoSLDNcWjBQMuYgSaEoinupMjma8Cu2uj4XiRCZkecLHXXmzcxbyR1gdfrZpiZDVSs92MEGGNhF78BEbbYi2b5U2oPnaUPRhjriWz85y","x/1'":"xpub6BycoSLDNcWjFs4B6T82q4zCbJBJdzQLwburAtBAwTLPyDPtkotGUWbef1t8D6XuCs6Yz5FUgFaL2hNzCTGe8F1bf9vNyXFMgLyKV65C9BH","x/2'":"xpub6BycoSLDNcWjHWrJyJJYmq9dDwBxSkFbWeaFFcrB6zBH9JTvyRVbAoWcmbPRmxicUkiutGQWqfsom9CbKSVG8Zh5HqHyR25xHE1xxmHeNYa"},"next_account2":["2","xpub6BycoSLDNcWjHWrJyJJYmq9dDwBxSkFbWeaFFcrB6zBH9JTvyRVbAoWcmbPRmxicUkiutGQWqfsom9CbKSVG8Zh5HqHyR25xHE1xxmHeNYa","031b68cff8114df7677c4fe80619b701ea966428ecbeba55c9224cd8149cc5f05e","LcVc1FUxfhcwJcjK8A6hb6YYU6k4e4MLdT"],"transactions":{"a242aeff746aa481c5d8a496111039262f2a3fbde6038124301522539fa06837":"01000000018394dfaba83ca6f510f622ecf95b445e856eab3193cb0dad53e1262841149d5f00000000da0047304402207761cdbf009c0bd3864c6a457288cadfa565601f782cc09f0046926d54a1b68b022060b73a7babb5dfd5188c4697cfcab6c15c4dd3de8507d39722e3a6b728f697dc01483045022100a540921229b02c4cfbf2d57222a455cbb4a5bd09bff063749fb71292f720850a02204dd18369213ec4cb033cbf222e8439eb8a9dd0a1b864bfeefa44cfe0c0066ee401475221025966a0193194a071e71501f9f8987111f7364bd8105a006f908b1f743da8d353210397c83f4963bdf333f129ab8000d89536bfea0971fc7578fdff5c2104b296c4d252aefdffffff0288130000000000001976a9141516b5e9653ab1fb09180186077fc2d7dfa07e5788aca0ba09000000000017a9148132c19d6b9abba9ec978ca5269d577ae104541e8700000000"},"verified_tx3":{"a242aeff746aa481c5d8a496111039262f2a3fbde6038124301522539fa06837":[490002,1508090436,607]},"wallet_type":"trezor"}'''
        self._upgrade_storage(wallet_str, accounts=2)

    def test_upgrade_from_client_2_0_4_multisig(self):
        wallet_str = '{"accounts":{"0":{"change":[["03c3a8549f35d7842192e7e00afa25ef1c779d05f1c891ba7c30de968fb29e3e78","02e191e105bccf1b4562d216684632b9ec22c87e1457b537eb27516afa75c56831"],["03793397f02b3bd3d0f6f0dafc7d42b9701234a269805d89efbbc2181683368e4b","02153705b8e4df41dc9d58bc0360c79a9209b3fc289ec54118f0b149d5a3b3546d"],["02511e8cfb39c8ce1c790f26bcab68ba5d5f79845ec1c6a92b0ac9f331648d866a","02c29c1ea70e23d866204a11ec8d8ecd70d6f51f58dd8722824cacb1985d4d1870"]],"receiving":[["0283ce4f0f12811e1b27438a3edb784aeb600ca7f4769c9c49c3e704e216421d3e","03a1bbada7401cade3b25a23e354186c772e2ba4ac0d9c0447627f7d540eb9891d"],["0286b45a0bcaa215716cbc59a22b6b1910f9ebad5884f26f55c2bb38943ee8fdb6","02799680336c6bd19005588fad12256223cb8a416649d60ea5d164860c0872b931"],["039e2bf377709e41bba49fb1f3f873b9b87d50ae3b574604cd9b96402211ea1f36","02ef9ceaaf754ba46f015e1d704f1a06157cc4441da0cfaf096563b22ec225ca5f"],["025220baaca5bff1a5ffbf4d36e9fcc6f5d05f4af750ef29f6d88d9b5f95fef79a","02350c81bebfa3a894df69302a6601175731d443948a12d8ec7860981988e3803e"],["028fd6411534d722b625482659de54dd609f5b5c935ae8885ca24bfd3266210527","03b9c7780575f17e64f9dfd5947945b1dbdb65aecef562ac076335fd7aa09844e4"],["0353066065985ec06dbef33e7a081d9240023891a51c4e9eda7b3eb1b4af165e04","028c3fa7622e4c8bac07a2c549885a045532e67a934ca10e20729d0fdfe3a75339"],["02253b4eabf2834af86b409d5ca8e671de9a75c3937bff2dac9521c377ca195668","02d5e83c445684eb502049f48e621e1ca16e07e5dc4013c84d661379635f58877b"],["030d38e4c7a5c7c9551adcace3b70dcaa02bf841febd6dc308f3abd7b7bf2bdc49","0375a0b50cd7f3af51550207a766c5db326b2294f5a4b456a90190e4fbeb720d97"],["0327280215ba4a0d8c404085c4f6091906a9e1ada7ce4202a640ac701446095954","037cd9b5e6664d28a61e01626056cdb7e008815b365c8b65fa50ac44d6c1ad126e"],["02f80a80146674da828fc67a062d1ab47fb0714cf40ec5c517ee23ea71d3033474","03fd8ab9bc9458b87e0b7b2a46ea6b46de0a5f6ecaf1a204579698bfa881ff93ce"],["034965bd56c6ca97e0e5ffa79cdc1f15772fa625b76da84cc8adb1707e2e101775","033e13cb19d930025bfc801b829e64d12934f9f19df718f4ea6160a4fb61320a9c"],["034de271009a06d733de22601c3d3c6fe8b3ec5a44f49094ac002dc1c90a3b096d","023f0b2f653c0fdbdc292040fee363ceaa5828cfd8e012abcf6cd9bad2eaa3dc72"],["022aec8931c5b17bdcdd6637db34718db6f267cb0a55a611eb6602e15deb6ed4df","021de5d4bbb73b6dfab2c0df6970862b08130902ff3160f31681f34aecf39721f6"],["02a0e3b52293ec73f89174ff6e5082fcfebc45f2fdd9cfe12a6981aa120a7c1fa7","0371d41b5f18e8e1990043c1e52f998937bc7e81b8ace4ddfc5cd0d029e4c81894"],["030bc1cbe4d750067254510148e3af9bc84925cdd17db3b54d9bbf4a409b83719a","0371c4800364a8a32bfbda7ea7724c1f5bdbd794df8a6080a3bd3b52c52cf32402"],["0318c5cd5f19ff037e3dec3ce5ac1a48026f5a58c4129271b12ae22f8542bcd718","03b5c70db71d520d04f810742e7a5f42d810e94ec6cbf4b48fa6dd7b4d425e76c1"],["0213f68b86a8c4a0840fa88d9a06904c59292ec50172813b8cca62768f3b708811","0353037209eb400ba7fcfa9f296a8b2745e1bbcbfb28c4adebf74de2e0e6a58c00"],["028decff8a7f5a7982402d95b050fbc9958e449f154990bbfe0f553a1d4882fd03","025ecd14812876e885d8f54cab30d1c2a8ae6c6ed0847e96abd65a3700148d94e2"],["0267f8dab8fdc1df4231414f31cfeb58ce96f3471ba78328cd429263d151c81fed","03e0d01df1fd9e958a7324d29afefbc76793a40447a2625c494355c577727d69ba"],["03de3c4d173b27cdfdd8e56fbf3cd6ee8729b94209c20e5558ddd7a76281a37e2e","0218ccb595d7fa559f0bae1ea76d19526980b027fb9be009b6b486d8f8eb0e00d5"]],"xpub":"xpub661MyMwAqRbcFUEYv1psxyPnjiHhTYe85AwFRs5jShbpgrfQ9UXBmxantqgGT3oAVLiHDYoR3ruT3xRGcxsmBMJxyg94FGcxF86QnzYDc6e","xpub2":"xpub661MyMwAqRbcGFd5DccFn4YW2HEdPhVZ2NEBAn416bvDFBi8HN5udmB6DkWpuXFtXaXZdq9UvMoiHxaauk6R1CZgKUR8vpng4LoudP4YVXA"}},"master_private_keys":{"x1/":"xprv9s21ZrQH143K2zA5ozHsbqT4BgTD45vGhx1edUg7tN4qp4LFbwCwEAGK3ZVaBaCRQnuy7AJ7qbPGxKiynNtGd7CzjBXEV4mEwStnPo98Xve"},"master_public_keys":{"x1/":"xpub661MyMwAqRbcFUEYv1psxyPnjiHhTYe85AwFRs5jShbpgrfQ9UXBmxantqgGT3oAVLiHDYoR3ruT3xRGcxsmBMJxyg94FGcxF86QnzYDc6e","x2/":"xpub661MyMwAqRbcGFd5DccFn4YW2HEdPhVZ2NEBAn416bvDFBi8HN5udmB6DkWpuXFtXaXZdq9UvMoiHxaauk6R1CZgKUR8vpng4LoudP4YVXA"},"seed":"start accuse bounce inhale crucial infant october radar enforce stage dumb spot account","seed_version":11,"use_encryption":false,"wallet_type":"2of2"}'
        self._upgrade_storage(wallet_str)

    def test_upgrade_from_client_2_1_1_seeded(self):
        wallet_str = '{"accounts":{"0":{"change":["03cbd39265f007d39045ccab5833e1ae16c357f9d35e67099d8e41940bf63ec330","03c94e9590d9bcd579caae15d062053e2820fe2a405c153dd4dca4618b7172ea6f","028a875b6f7e56f8cba66a1cec5dc1dfca9df79b7c92702d0a551c6c1b49d0f59b"],"receiving":["02fa100994f912df3e9538c244856828531f84e707f4d9eccfdd312c2e3ef7cf10","02fe230740aa27ace4f4b2e8b330cd57792051acf03652ae1622704d7eb7d4e5e4","03e3f65a991f417d69a732e040090c8c2f18baf09c3a9dc8aa465949aeb0b3271f","0382aa34a9cb568b14ebae35e69b3be6462d9ed8f30d48e0a6983e5af74fa441d3","03dfd8638e751e48fd42bf020874f49fbb5f54e96eff67d72eeeda3aa2f84f01c6","033904139de555bdf978e45931702c27837312ed726736eeff340ca6e0a439d232","03c6ca845d5bd9055f8889edcd53506cf714ac1042d9e059db630ec7e1af34133d","030b3bafc8a4ff8822951d4983f65b9bc43552c8181937188ba8c26e4c1d1be3ab","03828c371d3984ca5a248997a3e096ce21f9aeeb2f2a16457784b92a55e2aef288","033f42b4fbc434a587f6c6a0d10ac401f831a77c9e68453502a50fe278b6d9265c","0384e2c23268e2eb88c674c860519217af42fd6816273b299f0a6c39ddcc05bfa2","0257c60adde9edca8c14b6dd804004abc66bac17cc2acbb0490fcab8793289b921","02e2a67b1618a3a449f45296ea72a8fa9d8be6c58759d11d038c2fe034981efa73","02a9ef53a502b3a38c2849b130e2b20de9e89b023274463ea1a706ed92719724eb","037fc8802a11ba7ef06682908c24bcaedca1e2240111a1dd229bf713e2aa1d65a1","03ea0685fbd134545869234d1f219fff951bc3ec9e3e7e41d8b90283cd3f445470","0296bbe06cdee522b6ee654cc3592fce1795e9ff4dc0e2e2dea8acaf6d2d6b953b","036beac563bc85f9bc479a15d1937ea8e2c20637825a134c01d257d43addab217a","03389a4a6139de61a2e0e966b07d7b25b0c5f3721bf6fdcad20e7ae11974425bd9","026cffa2321319433518d75520c3a852542e0fa8b95e2cf4af92932a7c48ee9dbd"],"xpub":"xpub661MyMwAqRbcGDxKhL5YS1kaB5B7q8H6xPZwCrgZ1iE2XXaiUeqD9MFEYRAuX7UNfdAED9yhAZdCB4ZS8dFrGDVU3x9ZK8uej8u8Pa2DLMq"}},"accounts_expanded":{},"master_private_keys":{"x/":"xprv9s21ZrQH143K3jsrbJYY4soqd3LdRfZFbAeLQUGwTNh3ejFZw7WxbYvkhAmPM88Swt1JwFX6DVGjPXeUcGcqa1XFuJPeiQaC9wiZ16PTKgQ"},"master_public_keys":{"x/":"xpub661MyMwAqRbcGDxKhL5YS1kaB5B7q8H6xPZwCrgZ1iE2XXaiUeqD9MFEYRAuX7UNfdAED9yhAZdCB4ZS8dFrGDVU3x9ZK8uej8u8Pa2DLMq"},"pruned_txo":{},"seed":"flat toe story egg tide casino leave liquid strike cat busy knife absorb","seed_version":11,"transactions":{},"txi":{},"txo":{},"use_encryption":false,"wallet_type":"standard"}'
        self._upgrade_storage(wallet_str)

    def test_upgrade_from_client_2_1_1_importedkeys(self):
        wallet_str = '{"accounts":{"/x":{"imported":{"LMK1a5LKLkLFCEKukwwTrGxPboNvZjDbcY":["0344b1588589958b0bcab03435061539e9bcf54677c104904044e4f8901f4ebdf5","T8hVerMmMsVnq7mkXpEw4krEhXJ5BZNVv7mb4C7LoV8Ni8iywME1"],"LPRvUteVjy7MwDYro7o6XJ8SzhaYBJQhoM":["04575f52b82f159fa649d2a4c353eb7435f30206f0a6cb9674fbd659f45082c37d559ffd19bea9c0d3b7dcc07a7b79f4cffb76026d5d4dff35341efe99056e22d2","6vHESf1YF8tPdqpGyEiNvibJPRZzKsB4ijYsywkUaz3SfUAnidY"],"LZBc9EVXNXW1aGdrxodATNp9kYeCxufeWb":["0389508c13999d08ffae0f434a085f4185922d64765c0bff2f66e36ad7f745cc5f","T96yXyhXKvujT4sMAPihoJJ2sXNTwDircc7WnT2qqXTdBs433uZ5"]}}},"accounts_expanded":{},"pruned_txo":{},"transactions":{},"txi":{},"txo":{},"use_encryption":false,"wallet_type":"imported"}'
        self._upgrade_storage(wallet_str)

    def test_upgrade_from_client_2_1_1_watchaddresses(self):
        wallet_str = '{"accounts":{"/x":{"imported":{"LXupCaL8GsoAAC3c6ayRuQiF6oKd6jzvF2":[null,null],"LbGiejb64pNXrjPZfiauVkchFQksBnFjrz":[null,null],"Lc2ZerD7r4iMufWnkUFRVoqj8zaUdra9gy":[null,null]}}},"accounts_expanded":{},"pruned_txo":{},"transactions":{},"txi":{},"txo":{},"wallet_type":"imported"}'
        self._upgrade_storage(wallet_str)

    def test_upgrade_from_client_2_1_1_trezor_singleacc(self):
        wallet_str = '''{"accounts":{"0":{"change":["033608f89d381bcb9964df9da428d706d3eb30c14433af8de21bee2601e7392a80","0295c3905730d987ae9a9c09ad85c9c22c28aa414448f9d3450d8afb3da0d78890","038cf10bcf2bd3384f05974295fc83fc4e9cb48c0105995ad86d3ea237edb7e1d1"],"receiving":["020be78fa1a35e44fb1ee3141b40bd8d68330f12f98fdef5ba249b4d8c52a6a1ae","03f23e9a3b5337f322f720f533653349f6e97228d1c4a6feca36d4d1554aa19f74","03d3e7cfde0117561856e6e43d87852480c512910bfd1988c2ff1e6f6d795f7046","02ec56fc0bfe6a1466a783737919edbe83c8907af29a5ae672919ffcb1bb96303f","031b1d151f6584f9926614a7c335ee61606ff7a9769ca6e175ad99f9c7b5e9fb4d","03d782be0ace089e02529029b08ca9107b0e58302306de30bd9f9a3a1ed40c3717","0325784a4290eeeea1f99a928cf6c75c33417659dbd50a3a2850136dc3138ba631","035b7c1176926a54cdeb0342df5ecc7bb3fe1820fce99491fb50c091e3093f200f","02e0a2d615bff26a57754afa0e8ac8b692a79b399f6d04647398f377dcac4116be","026c7cee5bce1ae9e2fa930001ece81c35442a461fc9ef1266ac3d41b9f13e3bd5","0217b1d5066708e0cdaee99087c407db684131e34578adc7800dc66f329576c457","03ec0ed891b0ead00f1eaca7a4736d6816e348731d995bd4e77acbc8c582f68429","028cb4c682dde9692de47f71f3b16755cc440d722b84eed68db2b3d80bce83d50a","03d5d770a58d32b5d59b12861bbda37560fe7b789181b3349abf56223ea61b39c4","0250b6aee8338ac0497f2106b0ed014f5a2419c7bf429eb2b17a70bec77e6ff482","02565da9be6fc66a1e354638dcd8a4244e8733f38599c91c4f1ab0fb8d5d94fd2f","02e6c88509ff676b686afc2326370684bbc6edc0b31e09f312df4f7a17fe379e31","02224fef0921e61adcb2cd14ef45dbe4b859f1fcdc62eba26c6a7ce386c0a8f4b1","034c63da9c2a20132d9fd1088028de18f7ccd72458f9eb07a72452bd9994d28b1f","032bfe2fc88a55e19ba2338155b79e67b7d061d5fd1844bc8edc1808d998f8ba2c"],"xpub":"xpub6D77dkWgEcSNBq7xDA1RUysGvD64QNy2TykC9UuRK6fEzqy3512HR2p2spstKCybkhDqkNStPWZKcnhwdD6kDYWJxsTQJhg9RCwifzcfJN9"}},"accounts_expanded":{},"labels":{"0":"Main account"},"master_public_keys":{"x/0'":"xpub6D77dkWgEcSNBq7xDA1RUysGvD64QNy2TykC9UuRK6fEzqy3512HR2p2spstKCybkhDqkNStPWZKcnhwdD6kDYWJxsTQJhg9RCwifzcfJN9","x/1'":"xpub6D77dkWgEcSNFtXV2CQgsbfG33VyGMaUtUdpbdfMMHsS4WDzLtRapchQWcVBMFFjdRYjhkvQwGnJeKWPP3C2e1DevATAEUzL258Lhfkd7KG"},"next_account2":["1","xpub6D77dkWgEcSNFtXV2CQgsbfG33VyGMaUtUdpbdfMMHsS4WDzLtRapchQWcVBMFFjdRYjhkvQwGnJeKWPP3C2e1DevATAEUzL258Lhfkd7KG","03571f041921078b153a496638d703dfd1cee75e73c42653bbe0650ab6168d6a5b","LSvzG3x2mkWo9bpAW4UsvTQtkPqSoUkJop"],"pruned_txo":{},"transactions":{},"txi":{},"txo":{},"wallet_type":"trezor"}'''
        self._upgrade_storage(wallet_str)

    def test_upgrade_from_client_2_1_1_trezor_multiacc(self):
        wallet_str = '''{"accounts":{"0":{"change":["03143bc04f007c454e03caf9d59b61e27f527b5e6723e167b50197ce45e2071902","03157710459a8213a79060e2f2003fe0eb7a7ed173ac3f846309de52269dd44740","028ec4bbbf4ac9edfabb704bd82acb0840f2166312929ce01af2b2e99059b16dee"],"receiving":["03d27c0f5594d8df0616d64a735c909098eb867d01c6f1588f04ca2cf353837ec0","024d299f21e9ee9cc3eb425d04f45110eff46e45abcab24a3e594645860518fb97","03f6bc650e5f118ab4a63359a9cde4ab8382fe16e7d1b36b0a459145a79bef674b","028bed00a2fbd03f1ff43e0150ec1018458f7b39f3e4e602e089b1f47f8f607136","02108b15014d53f2e4e1b5b2d8f5eaf82006bbc4f273dbfbaef91eff08f9d10ea5","02a9a59a529818f3ba7a37ebe34454eac2bcbe4da0e8566b13f369e03bb020c4c4","023fde4ecf7fbdffb679d92f58381066cf2d840d34cb2d8bef63f7c5182d278d53","02ad8bf6dc0ff3c39bd20297d77fbd62073d7bf2fa44bf716cdd026db0819bb2b4","029c8352118800beaef1f3fa9c12afe30d329e7544bea9b136b717b88c24d95d92","02c42c251392674e2c2768ccd6224e04298bd5479436f02e9867ecc288dd2eb066","0316f3c82d9fce97e267b82147d56a4b170d39e6cf01bfaff6c2ae6bcc79a14447","0398554ee8e333061391b3e866505bbc5e130304ae09b198444bcd31c4ba7846ea","02e69d21aadb502e9bd93c5536866eff8ca6b19664545ccc4e77f3508e0cbe2027","0270fb334407a53a23ad449389e2cb055fae5017ca4d79ec8e082038db2d749c50","03d91a8f47453f9da51e0194e3aacff88bf79a625df82ceee73c71f3a7099a5459","0306b2d3fd06c4673cc90374b7db0c152ba7960be382440cecc4cdad7642e0537c","028020dd6062f080e1e2b49ca629faa1407978adab13b74875a9de93b16accf804","03907061c5f6fde367aafe27e1d53b39ff9c2babffe8ab7cf8c3023acba5c39736","029749462dba9af034455f5e0f170aac67fe9365ce7126092b4d24ced979b5381f","02f001d35308833881b3440670d25072256474c6c4061daf729055bf9563134105"],"xpub":"xpub6BycoSLDNcWjBQMuYgSaEoinupMjma8Cu2uj4XiRCZkecLHXXmzcxbyR1gdfrZpiZDVSs92MEGGNhF78BEbbYi2b5U2oPnaUPRhjriWz85y"},"1":{"change":["03b0df486b4e1baa03ad565622820d692089b059c8f9fefa3567c3fa26d0cbaa34","0294c76c062c865873dccab84d51682f880e0197b64789c61bff85e1be2506925e","036f900d0c6bafbbcac0fbc95bed44954007faa182655cf69dc84d50c22e6edce8"],"receiving":["02106878f6aefd9a81e1ca4a5f30ea0e1851aa36404fb62d19bd2325e180112b58","039e95f369e8d65aa7a7bf6a5d7d3259b827c1549c77c9b502b75a18f7708a9aa9","0273197861097be131542f8b7e03bc912934da51bc957d425be5bc7c1b69fb44ec","02b4c829b6a20815c5e1eef7ffd5d55c99505a7afeac5135ec2c97cfaae3483604","0312b1285272f1005c5834de2eec830ce9f9163c842d728c3921ae790716d8503f","0354059948c709c777a49a37e150271a3377f7aaee17798253d5240e4119f2a1c6","03800d87cc3878912d22a42a79db7ddbff3efec727d29ae1c0165730e5314483cd","03cafa35ad9adb41cff39e3bc2e0592d88c8b91981e73f068397e6c863c42c7b00","028668f734a4927e03621e319ab385919e891d248c86aea07ab922492d3d414ad3","02e42d46823893978ae7be9e032be21ce3e613cecb5ffe687b534795f90dc8ef85","03b86914af797e7b68940bc4ee2dec134036781a8e23ffaf4189ca7637e0afe898","021221ae9be51a9747aa7ebc2213a42a2364ce790ee86255277dc5f9beeb0bf6b4","03c8d58183f5d8102f8eb5f6db0f60add0a51ec6737097c46fc8a6b7c840d7571f","0304de0806b299cef4be3a162bac78f811d4adacc6a229ffdaeb7333bce72d88ff","03e08262e18616a3a9b9aecbfb8a860ccee147820a3c60050695ef72ff2cedc4a7","02caf4d61bb5deec29a39e5a1cc6d5987ec71d61d57c57bb5c2a47dd9266130bec","0252d429002d9c06f0befbef6c389bdd021969b416dd83d220394e414bd5d83c0a","024e23ce58533163df3e1d5766295144beb8f9729b1ac41e80ba485f39c483dfe6","026de9e7e6b11fbecd88b7b49915b5df64d672ef900aa043a8cac3bc79eb414089","02aaac08fc100014ec692efa0f3b408bf741e1dc68ebe28ce41837662810f40986","03e0d2b426705dcc5cb62c6113b10153f10624c926a3fe86142fd9020e7d6a2129"],"xpub":"xpub6BycoSLDNcWjFs4B6T82q4zCbJBJdzQLwburAtBAwTLPyDPtkotGUWbef1t8D6XuCs6Yz5FUgFaL2hNzCTGe8F1bf9vNyXFMgLyKV65C9BH"}},"accounts_expanded":{},"addr_history":{"LM6NBhqWiUD5f2W1WpqLA7MtWiNFjW5Gpf":[],"LM9TfCciLzZUpYUhg2VkBgoC81bQwrav4C":[["a242aeff746aa481c5d8a496111039262f2a3fbde6038124301522539fa06837",490002]],"LNKgMdfRbUZbVNxcoeVHr4nRFp9ULZX4bT":[],"LNRkHQjKykMaazy1PCQnmqeQ71ttwUuuQK":[],"LPYB6U1Tc3Ld2sE3UdUnxbm4Kq5DDkPCEX":[],"LQDkeaPgZyTG88UietSqaXKgGthudu92c8":[],"LRmMnkbdJVrssuy5gW8UpLC1zSEFp7omPC":[],"LSgH66JcXMp7k639zdaC4sHwr6t2yTKAwQ":[],"LW1dXPAmnVEZz17PhgQjHvmEV6MUcd6Zhi":[],"LYNthwkLpuYsJ6Ajf8TYRfaaQxqqtYWC1P":[],"LKTPPv5imBVPgTeGBLYbB99NYTnpPpF5wV":[],"LZrSPCcvWHfDaeNCnkFaYL8mzWhm89qZxo":[],"LaxCqVGpuyF5cpwGLw3T28dgZPBUoRcMSZ":[],"LbyEUdYYci1Cj1ejcJYY42xd1nQvM6eiXw":[],"LcFKtey5o4am16ZBPdxV3C7sZxTMyRqyoN":[],"Le1MnHWuYaGxL1fg13WsvNBy98GmHpurMG":[],"Les27ji39QbL8cM3ENGRmJ4eHhw1nkrHLf":[],"Lf3SJTKupNcZjw4BbXNJtoP2u36qoUPFJ4":[],"LfrnPoo5Wqudu5n5uiWa1jTVBKCfbNbeG4":[],"Lg57GijtoArWz9YwcyMg6Z4D3HsR6N1tGr":[],"LgUeokVX6eTKtbXNBJv6RheFhLiCzwSPaE":[],"LgahVvDJdYCWTZMzL8xFUUskXak7rKY76R":[],"LggNWLqwSZKAtCqcS5TTR9JPzCxSgoznXZ":[],"LL5B1VZe55MoSv47bra4E4pwrgNY1zHv1o":[]},"labels":{},"master_public_keys":{"x/0'":"xpub6BycoSLDNcWjBQMuYgSaEoinupMjma8Cu2uj4XiRCZkecLHXXmzcxbyR1gdfrZpiZDVSs92MEGGNhF78BEbbYi2b5U2oPnaUPRhjriWz85y","x/1'":"xpub6BycoSLDNcWjFs4B6T82q4zCbJBJdzQLwburAtBAwTLPyDPtkotGUWbef1t8D6XuCs6Yz5FUgFaL2hNzCTGe8F1bf9vNyXFMgLyKV65C9BH","x/2'":"xpub6BycoSLDNcWjHWrJyJJYmq9dDwBxSkFbWeaFFcrB6zBH9JTvyRVbAoWcmbPRmxicUkiutGQWqfsom9CbKSVG8Zh5HqHyR25xHE1xxmHeNYa"},"next_account2":["2","xpub6BycoSLDNcWjHWrJyJJYmq9dDwBxSkFbWeaFFcrB6zBH9JTvyRVbAoWcmbPRmxicUkiutGQWqfsom9CbKSVG8Zh5HqHyR25xHE1xxmHeNYa","031b68cff8114df7677c4fe80619b701ea966428ecbeba55c9224cd8149cc5f05e","LcVc1FUxfhcwJcjK8A6hb6YYU6k4e4MLdT"],"pruned_txo":{},"transactions":{"a242aeff746aa481c5d8a496111039262f2a3fbde6038124301522539fa06837":"01000000018394dfaba83ca6f510f622ecf95b445e856eab3193cb0dad53e1262841149d5f00000000da0047304402207761cdbf009c0bd3864c6a457288cadfa565601f782cc09f0046926d54a1b68b022060b73a7babb5dfd5188c4697cfcab6c15c4dd3de8507d39722e3a6b728f697dc01483045022100a540921229b02c4cfbf2d57222a455cbb4a5bd09bff063749fb71292f720850a02204dd18369213ec4cb033cbf222e8439eb8a9dd0a1b864bfeefa44cfe0c0066ee401475221025966a0193194a071e71501f9f8987111f7364bd8105a006f908b1f743da8d353210397c83f4963bdf333f129ab8000d89536bfea0971fc7578fdff5c2104b296c4d252aefdffffff0288130000000000001976a9141516b5e9653ab1fb09180186077fc2d7dfa07e5788aca0ba09000000000017a9148132c19d6b9abba9ec978ca5269d577ae104541e8700000000"},"txi":{"a242aeff746aa481c5d8a496111039262f2a3fbde6038124301522539fa06837":{}},"txo":{"a242aeff746aa481c5d8a496111039262f2a3fbde6038124301522539fa06837":{"LM9TfCciLzZUpYUhg2VkBgoC81bQwrav4C":[[0,5000,false]]}},"verified_tx3":{"a242aeff746aa481c5d8a496111039262f2a3fbde6038124301522539fa06837":[490002,1508090436,607]},"wallet_type":"trezor"}'''
        self._upgrade_storage(wallet_str, accounts=2)

    def test_upgrade_from_client_2_1_1_multisig(self):
        wallet_str = '{"accounts":{"0":{"change":[["03b5ca15f87baa1bb9d2508a9cf7cb596915a2749a6932bd71a5f353d72e2ff51e","03069d12bb7dc9fe7b8dab9ab2c7828173a4a4a5bacb10b9004854aef2ada2e440"],["036d7aeef82d50520f7d30d20a6b58a5e61c40949af4c147a105a8724478ba6339","021208a4a6c76934fbc2eed72a4a71713a5a093fb203ec3197edd1e4be8d9fb342"],["03ee5bd2bc7f9800b85f6f0a3fe8c23c797fa90d832f0332dfc72532e298dce54e","03474b76f33036673e1df73800b06d2df4b3617768c2b6a4f8a7f7d17c2b08cec3"]],"receiving":[["0288d4cc7e83b7028b8d2197c4efb490cb3dd248ee8683c715d9c59eb1884b2696","02c8ffee4ef168237f4a303dfe4957e328a8163c827cbe8ad07dcc24304b343869"],["022770e608e45981a31bad39a747a827ff4ce1eb28348fbe29ab776bdbf39346b4","03ebd247971aced7e2f49c495658ac5c32f764ebc4df5d033505e665f8d3f87b56"],["0256ede358326a99878d9de6c2c6a156548c266195fecea7906ddbb170da740f8d","02a500e7438d672c374713a9179fef03cbf075dd4c854566d6d9f4d899c01a4cf4"],["03fe2f59f10f6703bd3a43d0ae665ab72fb8b73b14f3a389b92e735e825fffdbe9","0255dd91624ba62481e432b9575729757b046501b8310b1dee915df6c4472f7979"],["0262c7c02f83196f6e3b9dd29e1bcad4834891b69ece12f628eea4379af6e701f8","0319ce2894fdf42bc87d45167a64b24ee2acdb5d45b6e4aadce4154a1479c8c58a"],["03bfb9ca9edab6650a908ffdcc0514f784aaccac466ba26c15340bc89a158d0b4c","03bcce80eed7b494f793b38b55cc25ae62e462ec7bf4d8ff6e4d583e8d04a4ac6d"],["0301dc9a41a44189e40c786048a0b6c13cc8865f3674fdf8e6cb2ab041eb71c0c7","020ded564880e7298068cf1498efcfb0f2306c6003e3de09f89030477ff7d02e18"],["03baffd970ecba170c31f48a95694a1063d14c834ccf2fdce0df46c3b81ab8edfb","0243ec650fc7c6642f7fb3b98e1df62f8b28b2e8722e79ccb271badba3545e8fc2"],["024be204a4bd321a727fb4a427189ae2f761f2a2c9898e9c37072e8a01026736d4","0239dc233c3e9e7c32287fdd7932c248650a36d8ab033875d272281297fadf292a"],["02197190b214c0215511d17e54e3e82cbe09f08e5ba2fb47aeafe01d8a88a8cb25","034a13cf01e26e9aa574f9ba37e75f6df260958154b0f6425e0242eacd5a3979c5"],["0226660fce4351019be974959b6b7dcf18d5aa280c6315af362ab60374b5283746","0304e49d2337a529ed8a647eceb555cd82e7e2546073568e30254530a61c174100"],["0324bb7d892dbe30930eb8de4b021f6d5d7e7da0c4ac9e3b95e1a2c684258d5d6c","02487aa272f0d3a86358064e080daf209ee501654e083f0917ad2aff3bbeb43424"],["03678b52056416da4baa8d51dca8eea534e38bd1d9328c8d01d5774c7107a0f9c1","0331deff043d709fc8171e08625a9adffba1bb614417b589a206c3a80eff86eddd"],["023a94d91c08c8c574199bc16e12789630c97cb990aeb5a54d938ff3c86786aabf","02d139837e34858f733e7e1b7d61b51d2730c57c274ed644ab80aff6e9e2fdef73"],["032f92dc11020035cd16995cfdc4bc6bef92bc4a06eb70c43474e6f7a782c9c0e1","0307d2c32713f010a0d0186e47670c6e46d7a7e623026f9ed99eb27cdae2ae4b49"],["02f66a91a024628d6f6969af2ed9ded087a88e9be86e4b3e5830868643244ec1ae","02f2a83ebb1fbbd04e59a93284e35320c74347176c0592512411a15efa7bf5fa44"],["03585bae6f04f2d3f927d79321b819cccf2bcd1d28d616aac9407c6c13d590dfbd","021f48f02b485b9b3223fca4fbc4dd823a8151053b8640b3766c37dfa99ba78006"],["02b28e2d6f1ac3fde4b34c938e83c0ef0d85fd540d8c33b33a109f4ebbc4a36a4d","030a25a960e28e751a95d3c0167fad496f9ec4bc307637c69b3bd6682930532736"],["03782c0dee8d279c547d26853e31d90bc7d098e16015c2cc334f2cc2a2964f2118","021fe4d6392dba40f1aa35fa9ec3ebfde710423f036482f6a5b3c47d0e149dfe47"],["0379b464b4f9cced0c71ee66c4fca1e61190bac9a6294242aabd4108f6a986a029","030a5802c5997ebae590147cb5eeba1690455c5d2a87306345586e808167072b50"]],"xpub":"xpub661MyMwAqRbcErzzVC45mcZaZM7gpxh4iwfsQVuyTma3qpWuRi9ZRdL8ACqu25LP2jssmKmpEbnGohH9XnoZ1etW3TKaiy5dWnUuiN6LvD9","xpub2":"xpub661MyMwAqRbcH4DqLo2tRYzSnnqjXk21aqNz3oAuYkr66YxucWgc2X8oLdS2KLPSKqrfZwStQYEpUp5jVxQfTBmEwtw3JaPRf6mq6JLD3Qr"}},"accounts_expanded":{},"master_private_keys":{"x1/":"xprv9s21ZrQH143K2NvXPAX5QUcr1KHCRVyDMikGc7WMuS34y2BktAqJsq1eJvk7JWroKM8PdGa2FHWiTpAvH9nj6BkQos5XhJU5mfS12tdtBYy"},"master_public_keys":{"x1/":"xpub661MyMwAqRbcErzzVC45mcZaZM7gpxh4iwfsQVuyTma3qpWuRi9ZRdL8ACqu25LP2jssmKmpEbnGohH9XnoZ1etW3TKaiy5dWnUuiN6LvD9","x2/":"xpub661MyMwAqRbcH4DqLo2tRYzSnnqjXk21aqNz3oAuYkr66YxucWgc2X8oLdS2KLPSKqrfZwStQYEpUp5jVxQfTBmEwtw3JaPRf6mq6JLD3Qr"},"pruned_txo":{},"seed":"snack oxygen clock very envelope staff table bus sense fiscal cereal pilot abuse","seed_version":11,"transactions":{},"txi":{},"txo":{},"use_encryption":false,"wallet_type":"2of2"}'
        self._upgrade_storage(wallet_str)

    def test_upgrade_from_client_2_2_0_seeded(self):
        wallet_str = '{"accounts":{"0":{"change":["038f4bae4a901fe5f2a30a06a09681fff6678e8efda4e881f71dcdc0fdb36dd1b8","032c628bec66fe98c3921b4fea6f18d241e6b23f4baf9e56c78b7a5262cd4cc412","0232b68a11cde50a49fb3155fe2c9e9cf7aa9f4bcb0f51c3963b13c997e40de40d"],"receiving":["0237246e68c6916c43c7c5aca1031df0c442439b80ceda07eaf72645a0597ed6aa","03f35bee973012909d839c9999137b7f2f3296c02791764da3f55561425bb1d53c","02fdbe9f95e2279045e6ef5f04172c6fe9476ba09d70aa0a8483347bfc10dee65e","026bc52dc91445594bb639c7a996d682ac74a4564381874b9d36cc5feea103d7a4","0319182796c6377447234eeee9fe62ce6b25b83a9c46965d9a02c579a23f9fa57a","02e23d202a45515ce509c8b9548a251de3ad8e64c92b24bb74b354c8d4d0dc85af","0307d7ccb51aa6860606bcbe008acc1aae5b53d19d0752a20a327b6ec164399b52","038a2362fde711e1a4b9c5f8fe1090a0a38aec3643c0c3d69b00660b213dc4bfb8","0396255ef7b75e5d8ffc18d01b9012a98141ee5458a68cde8b25c492c569a22ab8","02c7edf03d215b7d3478fb26e9375d541440f4a8b5c562c0eb98fab6215dbea731","024286902b95da3daf6ffb571d5465537dae5b4e00139e6465e440d6a26892158e","03aa0d3fa1fe190a24e14d6aabd9c163c7fe70707b00f7e0f9fa6b4d3a4e441149","03995d433093a2ae9dc305fe8664f6ab9143b2f7eaf6f31bc5fefdacb183699808","033c5da7c4c7a3479ddb569fecbcbb8725867370746c04ff5d2a84d1706607bbab","036a097331c285c83c4dab7d454170b60a94d8d9daa152b0af6af81dbd7f0cc440","033ed002ddf99c1e21cb8468d0f5512d71466ac5ba4003b33d71a181e3a696e3c5","02a6a0f30d1a341063a57a0549a3d16d9487b1d4e0d4bffadabdc62d1ad1a43f8f","02dcae71fc2e31013cf12ad78f9e16672eeb7c75e536f4f7d36adb54f9682884eb","028ef32bc57b95697dacdb29b724e3d0fa860ffdc33c295962b680d31b23232090","0314afd1ac2a4bf324d6e73f466a60f511d59088843f93c895507e7af1ccdb5a3b"],"xpub":"xpub661MyMwAqRbcEuc5dCRqgPpGX2bKStk4g2cbZ96SSmKsQmLUrhaQEtrfnBMsXSUSyKWuCtjLiZ8zXrxcNeC2LR8gnZPrQJdmUEeofS2yuux"}},"accounts_expanded":{},"master_private_keys":{"x/":"xprv9s21ZrQH143K2RXcXAtqKFsXxzkq3S2DJogzkkgptRntXy1LKAG9h6YBvw8JjSUogF1UNneyYgS5uYshMBemqr41XsC7bTr8Fjx1uAyLbPC"},"master_public_keys":{"x/":"xpub661MyMwAqRbcEuc5dCRqgPpGX2bKStk4g2cbZ96SSmKsQmLUrhaQEtrfnBMsXSUSyKWuCtjLiZ8zXrxcNeC2LR8gnZPrQJdmUEeofS2yuux"},"pruned_txo":{},"seed":"agree tongue gas total hollow clip wasp slender dolphin rebel ozone omit achieve","seed_version":11,"stored_height":0,"transactions":{},"txi":{},"txo":{},"use_encryption":false,"wallet_type":"standard"}'
        self._upgrade_storage(wallet_str)

    def test_upgrade_from_client_2_2_0_importedkeys(self):
        wallet_str = '{"accounts":{"/x":{"imported":{"LMK1a5LKLkLFCEKukwwTrGxPboNvZjDbcY":["0344b1588589958b0bcab03435061539e9bcf54677c104904044e4f8901f4ebdf5","T8hVerMmMsVnq7mkXpEw4krEhXJ5BZNVv7mb4C7LoV8Ni8iywME1"],"LPRvUteVjy7MwDYro7o6XJ8SzhaYBJQhoM":["04575f52b82f159fa649d2a4c353eb7435f30206f0a6cb9674fbd659f45082c37d559ffd19bea9c0d3b7dcc07a7b79f4cffb76026d5d4dff35341efe99056e22d2","6vHESf1YF8tPdqpGyEiNvibJPRZzKsB4ijYsywkUaz3SfUAnidY"],"LZBc9EVXNXW1aGdrxodATNp9kYeCxufeWb":["0389508c13999d08ffae0f434a085f4185922d64765c0bff2f66e36ad7f745cc5f","T96yXyhXKvujT4sMAPihoJJ2sXNTwDircc7WnT2qqXTdBs433uZ5"]}}},"accounts_expanded":{},"pruned_txo":{},"stored_height":489714,"transactions":{},"txi":{},"txo":{},"use_encryption":false,"wallet_type":"imported"}'
        self._upgrade_storage(wallet_str)

    def test_upgrade_from_client_2_2_0_watchaddresses(self):
        wallet_str = '{"accounts":{"/x":{"imported":{"LXupCaL8GsoAAC3c6ayRuQiF6oKd6jzvF2":[null,null],"LbGiejb64pNXrjPZfiauVkchFQksBnFjrz":[null,null],"Lc2ZerD7r4iMufWnkUFRVoqj8zaUdra9gy":[null,null]}}},"accounts_expanded":{},"pruned_txo":{},"stored_height":0,"transactions":{},"txi":{},"txo":{},"wallet_type":"imported"}'
        self._upgrade_storage(wallet_str)

    def test_upgrade_from_client_2_2_0_trezor_singleacc(self):
        wallet_str = '''{"accounts":{"0":{"change":["033608f89d381bcb9964df9da428d706d3eb30c14433af8de21bee2601e7392a80","0295c3905730d987ae9a9c09ad85c9c22c28aa414448f9d3450d8afb3da0d78890","038cf10bcf2bd3384f05974295fc83fc4e9cb48c0105995ad86d3ea237edb7e1d1"],"receiving":["020be78fa1a35e44fb1ee3141b40bd8d68330f12f98fdef5ba249b4d8c52a6a1ae","03f23e9a3b5337f322f720f533653349f6e97228d1c4a6feca36d4d1554aa19f74","03d3e7cfde0117561856e6e43d87852480c512910bfd1988c2ff1e6f6d795f7046","02ec56fc0bfe6a1466a783737919edbe83c8907af29a5ae672919ffcb1bb96303f","031b1d151f6584f9926614a7c335ee61606ff7a9769ca6e175ad99f9c7b5e9fb4d","03d782be0ace089e02529029b08ca9107b0e58302306de30bd9f9a3a1ed40c3717","0325784a4290eeeea1f99a928cf6c75c33417659dbd50a3a2850136dc3138ba631","035b7c1176926a54cdeb0342df5ecc7bb3fe1820fce99491fb50c091e3093f200f","02e0a2d615bff26a57754afa0e8ac8b692a79b399f6d04647398f377dcac4116be","026c7cee5bce1ae9e2fa930001ece81c35442a461fc9ef1266ac3d41b9f13e3bd5","0217b1d5066708e0cdaee99087c407db684131e34578adc7800dc66f329576c457","03ec0ed891b0ead00f1eaca7a4736d6816e348731d995bd4e77acbc8c582f68429","028cb4c682dde9692de47f71f3b16755cc440d722b84eed68db2b3d80bce83d50a","03d5d770a58d32b5d59b12861bbda37560fe7b789181b3349abf56223ea61b39c4","0250b6aee8338ac0497f2106b0ed014f5a2419c7bf429eb2b17a70bec77e6ff482","02565da9be6fc66a1e354638dcd8a4244e8733f38599c91c4f1ab0fb8d5d94fd2f","02e6c88509ff676b686afc2326370684bbc6edc0b31e09f312df4f7a17fe379e31","02224fef0921e61adcb2cd14ef45dbe4b859f1fcdc62eba26c6a7ce386c0a8f4b1","034c63da9c2a20132d9fd1088028de18f7ccd72458f9eb07a72452bd9994d28b1f","032bfe2fc88a55e19ba2338155b79e67b7d061d5fd1844bc8edc1808d998f8ba2c"],"xpub":"xpub6D77dkWgEcSNBq7xDA1RUysGvD64QNy2TykC9UuRK6fEzqy3512HR2p2spstKCybkhDqkNStPWZKcnhwdD6kDYWJxsTQJhg9RCwifzcfJN9"}},"accounts_expanded":{},"labels":{"0":"Main account"},"master_public_keys":{"x/0'":"xpub6D77dkWgEcSNBq7xDA1RUysGvD64QNy2TykC9UuRK6fEzqy3512HR2p2spstKCybkhDqkNStPWZKcnhwdD6kDYWJxsTQJhg9RCwifzcfJN9","x/1'":"xpub6D77dkWgEcSNFtXV2CQgsbfG33VyGMaUtUdpbdfMMHsS4WDzLtRapchQWcVBMFFjdRYjhkvQwGnJeKWPP3C2e1DevATAEUzL258Lhfkd7KG"},"next_account2":["1","xpub6D77dkWgEcSNFtXV2CQgsbfG33VyGMaUtUdpbdfMMHsS4WDzLtRapchQWcVBMFFjdRYjhkvQwGnJeKWPP3C2e1DevATAEUzL258Lhfkd7KG","03571f041921078b153a496638d703dfd1cee75e73c42653bbe0650ab6168d6a5b","LSvzG3x2mkWo9bpAW4UsvTQtkPqSoUkJop"],"pruned_txo":{},"stored_height":0,"transactions":{},"txi":{},"txo":{},"wallet_type":"trezor"}'''
        self._upgrade_storage(wallet_str)

    def test_upgrade_from_client_2_2_0_trezor_multiacc(self):
        wallet_str = '''{"accounts":{"0":{"change":["03143bc04f007c454e03caf9d59b61e27f527b5e6723e167b50197ce45e2071902","03157710459a8213a79060e2f2003fe0eb7a7ed173ac3f846309de52269dd44740","028ec4bbbf4ac9edfabb704bd82acb0840f2166312929ce01af2b2e99059b16dee"],"receiving":["03d27c0f5594d8df0616d64a735c909098eb867d01c6f1588f04ca2cf353837ec0","024d299f21e9ee9cc3eb425d04f45110eff46e45abcab24a3e594645860518fb97","03f6bc650e5f118ab4a63359a9cde4ab8382fe16e7d1b36b0a459145a79bef674b","028bed00a2fbd03f1ff43e0150ec1018458f7b39f3e4e602e089b1f47f8f607136","02108b15014d53f2e4e1b5b2d8f5eaf82006bbc4f273dbfbaef91eff08f9d10ea5","02a9a59a529818f3ba7a37ebe34454eac2bcbe4da0e8566b13f369e03bb020c4c4","023fde4ecf7fbdffb679d92f58381066cf2d840d34cb2d8bef63f7c5182d278d53","02ad8bf6dc0ff3c39bd20297d77fbd62073d7bf2fa44bf716cdd026db0819bb2b4","029c8352118800beaef1f3fa9c12afe30d329e7544bea9b136b717b88c24d95d92","02c42c251392674e2c2768ccd6224e04298bd5479436f02e9867ecc288dd2eb066","0316f3c82d9fce97e267b82147d56a4b170d39e6cf01bfaff6c2ae6bcc79a14447","0398554ee8e333061391b3e866505bbc5e130304ae09b198444bcd31c4ba7846ea","02e69d21aadb502e9bd93c5536866eff8ca6b19664545ccc4e77f3508e0cbe2027","0270fb334407a53a23ad449389e2cb055fae5017ca4d79ec8e082038db2d749c50","03d91a8f47453f9da51e0194e3aacff88bf79a625df82ceee73c71f3a7099a5459","0306b2d3fd06c4673cc90374b7db0c152ba7960be382440cecc4cdad7642e0537c","028020dd6062f080e1e2b49ca629faa1407978adab13b74875a9de93b16accf804","03907061c5f6fde367aafe27e1d53b39ff9c2babffe8ab7cf8c3023acba5c39736","029749462dba9af034455f5e0f170aac67fe9365ce7126092b4d24ced979b5381f","02f001d35308833881b3440670d25072256474c6c4061daf729055bf9563134105"],"xpub":"xpub6BycoSLDNcWjBQMuYgSaEoinupMjma8Cu2uj4XiRCZkecLHXXmzcxbyR1gdfrZpiZDVSs92MEGGNhF78BEbbYi2b5U2oPnaUPRhjriWz85y"},"1":{"change":["03b0df486b4e1baa03ad565622820d692089b059c8f9fefa3567c3fa26d0cbaa34","0294c76c062c865873dccab84d51682f880e0197b64789c61bff85e1be2506925e","036f900d0c6bafbbcac0fbc95bed44954007faa182655cf69dc84d50c22e6edce8"],"receiving":["02106878f6aefd9a81e1ca4a5f30ea0e1851aa36404fb62d19bd2325e180112b58","039e95f369e8d65aa7a7bf6a5d7d3259b827c1549c77c9b502b75a18f7708a9aa9","0273197861097be131542f8b7e03bc912934da51bc957d425be5bc7c1b69fb44ec","02b4c829b6a20815c5e1eef7ffd5d55c99505a7afeac5135ec2c97cfaae3483604","0312b1285272f1005c5834de2eec830ce9f9163c842d728c3921ae790716d8503f","0354059948c709c777a49a37e150271a3377f7aaee17798253d5240e4119f2a1c6","03800d87cc3878912d22a42a79db7ddbff3efec727d29ae1c0165730e5314483cd","03cafa35ad9adb41cff39e3bc2e0592d88c8b91981e73f068397e6c863c42c7b00","028668f734a4927e03621e319ab385919e891d248c86aea07ab922492d3d414ad3","02e42d46823893978ae7be9e032be21ce3e613cecb5ffe687b534795f90dc8ef85","03b86914af797e7b68940bc4ee2dec134036781a8e23ffaf4189ca7637e0afe898","021221ae9be51a9747aa7ebc2213a42a2364ce790ee86255277dc5f9beeb0bf6b4","03c8d58183f5d8102f8eb5f6db0f60add0a51ec6737097c46fc8a6b7c840d7571f","0304de0806b299cef4be3a162bac78f811d4adacc6a229ffdaeb7333bce72d88ff","03e08262e18616a3a9b9aecbfb8a860ccee147820a3c60050695ef72ff2cedc4a7","02caf4d61bb5deec29a39e5a1cc6d5987ec71d61d57c57bb5c2a47dd9266130bec","0252d429002d9c06f0befbef6c389bdd021969b416dd83d220394e414bd5d83c0a","024e23ce58533163df3e1d5766295144beb8f9729b1ac41e80ba485f39c483dfe6","026de9e7e6b11fbecd88b7b49915b5df64d672ef900aa043a8cac3bc79eb414089","02aaac08fc100014ec692efa0f3b408bf741e1dc68ebe28ce41837662810f40986","03e0d2b426705dcc5cb62c6113b10153f10624c926a3fe86142fd9020e7d6a2129"],"xpub":"xpub6BycoSLDNcWjFs4B6T82q4zCbJBJdzQLwburAtBAwTLPyDPtkotGUWbef1t8D6XuCs6Yz5FUgFaL2hNzCTGe8F1bf9vNyXFMgLyKV65C9BH"}},"accounts_expanded":{},"addr_history":{"LM6NBhqWiUD5f2W1WpqLA7MtWiNFjW5Gpf":[],"LM9TfCciLzZUpYUhg2VkBgoC81bQwrav4C":[["a242aeff746aa481c5d8a496111039262f2a3fbde6038124301522539fa06837",490002]],"LNKgMdfRbUZbVNxcoeVHr4nRFp9ULZX4bT":[],"LNRkHQjKykMaazy1PCQnmqeQ71ttwUuuQK":[],"LPYB6U1Tc3Ld2sE3UdUnxbm4Kq5DDkPCEX":[],"LQDkeaPgZyTG88UietSqaXKgGthudu92c8":[],"LRmMnkbdJVrssuy5gW8UpLC1zSEFp7omPC":[],"LSgH66JcXMp7k639zdaC4sHwr6t2yTKAwQ":[],"LW1dXPAmnVEZz17PhgQjHvmEV6MUcd6Zhi":[],"LYNthwkLpuYsJ6Ajf8TYRfaaQxqqtYWC1P":[],"LKTPPv5imBVPgTeGBLYbB99NYTnpPpF5wV":[],"LZrSPCcvWHfDaeNCnkFaYL8mzWhm89qZxo":[],"LaxCqVGpuyF5cpwGLw3T28dgZPBUoRcMSZ":[],"LbyEUdYYci1Cj1ejcJYY42xd1nQvM6eiXw":[],"LcFKtey5o4am16ZBPdxV3C7sZxTMyRqyoN":[],"Le1MnHWuYaGxL1fg13WsvNBy98GmHpurMG":[],"Les27ji39QbL8cM3ENGRmJ4eHhw1nkrHLf":[],"Lf3SJTKupNcZjw4BbXNJtoP2u36qoUPFJ4":[],"LfrnPoo5Wqudu5n5uiWa1jTVBKCfbNbeG4":[],"Lg57GijtoArWz9YwcyMg6Z4D3HsR6N1tGr":[],"LgUeokVX6eTKtbXNBJv6RheFhLiCzwSPaE":[],"LgahVvDJdYCWTZMzL8xFUUskXak7rKY76R":[],"LggNWLqwSZKAtCqcS5TTR9JPzCxSgoznXZ":[],"LL5B1VZe55MoSv47bra4E4pwrgNY1zHv1o":[]},"labels":{},"master_public_keys":{"x/0'":"xpub6BycoSLDNcWjBQMuYgSaEoinupMjma8Cu2uj4XiRCZkecLHXXmzcxbyR1gdfrZpiZDVSs92MEGGNhF78BEbbYi2b5U2oPnaUPRhjriWz85y","x/1'":"xpub6BycoSLDNcWjFs4B6T82q4zCbJBJdzQLwburAtBAwTLPyDPtkotGUWbef1t8D6XuCs6Yz5FUgFaL2hNzCTGe8F1bf9vNyXFMgLyKV65C9BH","x/2'":"xpub6BycoSLDNcWjHWrJyJJYmq9dDwBxSkFbWeaFFcrB6zBH9JTvyRVbAoWcmbPRmxicUkiutGQWqfsom9CbKSVG8Zh5HqHyR25xHE1xxmHeNYa"},"next_account2":["2","xpub6BycoSLDNcWjHWrJyJJYmq9dDwBxSkFbWeaFFcrB6zBH9JTvyRVbAoWcmbPRmxicUkiutGQWqfsom9CbKSVG8Zh5HqHyR25xHE1xxmHeNYa","031b68cff8114df7677c4fe80619b701ea966428ecbeba55c9224cd8149cc5f05e","LcVc1FUxfhcwJcjK8A6hb6YYU6k4e4MLdT"],"pruned_txo":{},"stored_height":490006,"transactions":{"a242aeff746aa481c5d8a496111039262f2a3fbde6038124301522539fa06837":"01000000018394dfaba83ca6f510f622ecf95b445e856eab3193cb0dad53e1262841149d5f00000000da0047304402207761cdbf009c0bd3864c6a457288cadfa565601f782cc09f0046926d54a1b68b022060b73a7babb5dfd5188c4697cfcab6c15c4dd3de8507d39722e3a6b728f697dc01483045022100a540921229b02c4cfbf2d57222a455cbb4a5bd09bff063749fb71292f720850a02204dd18369213ec4cb033cbf222e8439eb8a9dd0a1b864bfeefa44cfe0c0066ee401475221025966a0193194a071e71501f9f8987111f7364bd8105a006f908b1f743da8d353210397c83f4963bdf333f129ab8000d89536bfea0971fc7578fdff5c2104b296c4d252aefdffffff0288130000000000001976a9141516b5e9653ab1fb09180186077fc2d7dfa07e5788aca0ba09000000000017a9148132c19d6b9abba9ec978ca5269d577ae104541e8700000000"},"txi":{"a242aeff746aa481c5d8a496111039262f2a3fbde6038124301522539fa06837":{}},"txo":{"a242aeff746aa481c5d8a496111039262f2a3fbde6038124301522539fa06837":{"LM9TfCciLzZUpYUhg2VkBgoC81bQwrav4C":[[0,5000,false]]}},"verified_tx3":{"a242aeff746aa481c5d8a496111039262f2a3fbde6038124301522539fa06837":[490002,1508090436,607]},"wallet_type":"trezor"}'''
        self._upgrade_storage(wallet_str, accounts=2)

    def test_upgrade_from_client_2_2_0_multisig(self):
        wallet_str = '{"accounts":{"0":{"change":[["037ba2d9d7446d54f1b46c902427e58a4b63915745de40f31db52e95e2eb8c559c","03aab9d4cb98fec92e1a9fc93b93f439b30cdb47cb3fae113779d0d26e85ceca7b"],["036c6cb5ed99f4d3c8d2dd594c0a791e266a443d57a51c3c7320e0e90cf040dad0","03f777561f36c795911e1e42b3b4babe473bcce32463eb9340b48d86fded8a226a"],["03de4acea515b1b3b6a2b574d08539ced475f86fdf00b43bff16ec43f6f8efc8b7","036ebfdd8ba75c94e0cb1819ecba464d04a77bab11c8fc2b7e90dd952092c01f0e"]],"receiving":[["03e768d9de027e4edaf0685abb240dde9af1188f5b5d2aa08773b0083972bdec74","0280eccb8edec0e6de521abba3831f51900e9d0655c59cddf054b72a70b520ddae"],["02f9c0b7e8fe426a45540027abca63c27109db47b5c86886b99db63450444bb460","03cb5cdcc26b0aa326bc895fcc38b63416880cdc404efbeab3ff14f849e4f4bd63"],["024d6267b9348a64f057b8e094649de36e45da586ef8ca5ecb7137f6294f6fd9e3","034c14b014eb28abfeaa0676b195bde158ab9b4c3806428e587a8a3c3c0f2d38bb"],["02bc3d5456aa836e9a155296be6a464dfa45eb2164dd0691c53c8a7a05b2cb7c42","03a374129009d7e407a5f185f74100554937c118faf3bbe4fe1cac31547f46effa"],["024808c2d17387cd6d466d13b278f76d4d04a7d31734f0708a8baf20ae8c363f9a","02e18dfc7f5ea9e8b6afe0853a9aba55861208b32f22c81aa4be0e6aee7951963d"],["0331bef7adca60ae484a12cc3c4b788d4296e0b52500731bf5dff1b935973d4768","025774c45aeac2ae87b7a67e79517ffb8264bdf1b56905a76e7e7579f875cbed55"],["020566e7351b4bfe6c0d7bda3af24267245a856af653dd00c482555f305b71a8e3","036545f66ad2fe95eeb0ec1feb501d552773e0910ec6056d6b827bc0bb970a1ecc"],["038dc34e68a49d2205f4934b739e510dca95961d0f8ab6f6cd9279d68048cfd93b","03810c50d1e2ff0e39179788e8506784bc214768884f6f71dc4323f6c29e25c888"],["035059ff052ab044fd807905067ec79b19177edcf1b1b969051dc0e6957b1e1eab","03d790376a0144860017bea5b5f2f0a9f184a55623e9a1e8f3670bf6aba273f4fb"],["02bb730d880b90e421d9ac97313b3c0eec6b12a8c778388d52a188af7dc026db43","030ae3ae865b805c3c11668b46ec4f324d50f6b5fbc2bb3a9ae0ddc4aea0d1487a"],["0306eeb93a37b7dcbb5c20146cfd3036e9a16e5b35ecfe77261a6e257ee0a7b178","03fb49f5f1d843ca6d62cee86fd4f79b6cc861f692e54576a9c937fdff13714be9"],["03f4c358e03bd234055c1873e77f451bea6b54167d36c005abeb704550fbe7bee1","03fc36f11d726fd4321f99177a0fff9b924ec6905d581a16436417d2ea884d3c80"],["024d68322a93f2924d6a0290ebe7481e29215f1c182bd8fdeb514ade8563321c87","02aa5502de7b402e064dfebc28cb09316a0f90eec333104c981f571b8bc69279e2"],["03cbda5b33a72be05b0e50ef7a9872e28d82d5a883e78a73703f53e40a5184f7a5","02ebf10a631436aa0fdef9c61e1f7d645aa149c67d3cb8d94d673eb3a994c36f86"],["0285891a0f1212efff208baf289fd6316f08615bee06c0b9385cc0baad60ebc08a","0356a6c4291f26a5b0c798f3d0b9837d065a50c9af7708f928c540017f150c40b6"],["02403988346d00e9b949a230647edbe5c03ce36b06c4c64da774a13aca0f49ce92","02717944f0bb32067fb0f858f7a7b422984c33d42fd5de9a055d00c33b72731426"],["02161a510f42bcc7cdd24e7541a0bdbcac08b1c63b491df1974c6d5cd977d57750","03006d73c0ab9fdd8867690d9282031995cfd094b5bdc3ff66f3832c5b8a9ca7f9"],["03d80ea710e1af299f1079dd528d6cdc5797faa310bafa90ca7c45ea44d5ba64f3","02b29e1170d6bec16ace70536565f1dff1480cba2a7545cfec7b522568a6ab5c38"],["02c3f6e8dea3cace7aab89d8258751827cb5791424c71fa82ae30192251ca11a28","02a43d2d952e1f3fb58c56dadabb39cf5ed437c566f504a79f2ade243abd2c9139"],["0308e96e38eb89ca5abaa6776a1968a1cbb33197ec91d40bb44bede61cb11a517f","034d0545444e5a5410872a3384cedd3fb198a8211bb391107e8e2c0b0b67932b20"]],"xpub":"xpub661MyMwAqRbcFCKg479EAwb6KLrQNcFSQKNjQRJpRFSiFRnp87cpntXkDUEvRtFTEARirm9584ML8sLBkF3gDBcyYgknnxCCrBMwPDDMQwC","xpub2":"xpub661MyMwAqRbcFaEDoCANCiY9dhXvA8GgXFSLXYADmxmatLidGTxnVL6vuoFAMg9ugX8MTKjZPiP9uUPXusUji11LnWWLCw8Lzgx7pM5sg1s"}},"accounts_expanded":{},"master_private_keys":{"x1/":"xprv9s21ZrQH143K2iFCx5cDooeMmK1uy9Xb36T8c2uCruujNdTfaaJaF6DGNDcDKkX1U4V1XiEcvCqoNsQhMQUnp8ZvMgxDBDErtMACo2HtGgQ"},"master_public_keys":{"x1/":"xpub661MyMwAqRbcFCKg479EAwb6KLrQNcFSQKNjQRJpRFSiFRnp87cpntXkDUEvRtFTEARirm9584ML8sLBkF3gDBcyYgknnxCCrBMwPDDMQwC","x2/":"xpub661MyMwAqRbcFaEDoCANCiY9dhXvA8GgXFSLXYADmxmatLidGTxnVL6vuoFAMg9ugX8MTKjZPiP9uUPXusUji11LnWWLCw8Lzgx7pM5sg1s"},"pruned_txo":{},"seed":"such duck column calm verb sock used message army suffer humble olive abstract","seed_version":11,"stored_height":490033,"transactions":{},"txi":{},"txo":{},"use_encryption":false,"wallet_type":"2of2"}'
        self._upgrade_storage(wallet_str)

    def test_upgrade_from_client_2_3_2_seeded(self):
        wallet_str = '{"accounts":{"0":{"change":["03b37d18c0c52da686e8fd3cc5d242e62036ac2b38f101439227f9e15b46f88c42","026f946e309e64dcb4e62b00a12aee9ee14d26989880e690d8c307f45385958875","03c75552e48d1d44f966fb9cfe483b9479cc882edcf81e2faf92fba27c7bbecbc1","020965e9f1468ebda183fea500856c7e2afcc0ccdc3da9ccafc7548658d35d1fb3","03da778470ee52e0e22b34505a7cc4a154e67de67175e609a6466db4833a4623ed","0243f6bbb6fea8e0da750645b18973bc4bd107c224d136f26c7219aab6359c2705"],"receiving":["0376bf85c1bf8960947fe575adc0a3f3ba08f6172336a1099793efd0483b19e089","03f0fe0412a3710a5a8a1c2e01fe6065b7a902f1ccbf38cd7669806423860ad111","03eacb81482ba01a741b5ee8d52bb6e48647107ef9a638ca9a7b09f6d98964a456","03c8b598f6153a87fc37f693a148a7c1d32df30597404e6a162b3b5198d0f2ba33","03fefef3ee4f918e9cd3e56501018bcededc48090b33c15bf1a4c3155c8059610a","0390562881078a8b0d54d773d6134091e2da43c8a97f4f3088a92ca64d21fcf549","0366a0977bb35903390e6b86bbb6faa818e603954042e98fe954a4b8d81d815311","025d176af6047d959cfdd9842f35d31837034dd4269324dc771c698d28ad9ae3d6","02667adce009891ee872612f31cd23c5e94604567140b81d0eae847f5539c906d6","03de40832017ba85e8131c2af31079ab25a72646d28c8d2b6a39c98c4d1253ae2f","02854c17fdef156b1681f494dfc7a10c6a8033d0c577b287947b72ecada6e6386b","0283ff8f775ba77038f787b9bf667f538f186f861b003833600065b4ad8fd84362","03b0a4e9a6ffecd955bd0e2b169113b544a7cba1688dca6fce204552403dc28391","02445465cf40603506dbe7fa853bc1aae0d79ca90e57b6a7af6ffc1341c4ca8e2d","0220ea678e2541f809da75552c07f9e64863a254029446d6270e433a4434be2bd7","02640e87aab83bd84fe964eac72657b34d5ad924026f8d2222557c56580607808e","020fa9a0c3b335c6cdc6588b14c596dfae242547dd68e5c6bce6a9347152ff4021","03f7f052076dc35483c91033edef2cc93b54fb054fe3b36546800fa1a76b1d321a","030fd12243e1ffe1fc6ec3cdb7e020a467d3146d55d52af915552f2481a91657cd","02dd1a2becbc344a297b104e4bb41f7de4f5fcff1f3244e4bb124fbb6a70b5eb18"],"xpub":"xpub661MyMwAqRbcEnd8FGgkz7V8iJZ2FvDcg669i7NSS7h7nmq5k5WeHohNqosRSjx9CKiRxMgTidPWA5SJYsjrXhr1azR3boubNp24gZHUeY4"}},"accounts_expanded":{},"master_private_keys":{"x/":"xprv9s21ZrQH143K2JYf9F9kcyYQAGiXrTVmJsAYuixpsnA8uyVwCYCPk1NtzYuNmeLRLKcMYb3UoPgTocYsHsAje3mSjX4jp3Ci17VhuESjsBU"},"master_public_keys":{"x/":"xpub661MyMwAqRbcEnd8FGgkz7V8iJZ2FvDcg669i7NSS7h7nmq5k5WeHohNqosRSjx9CKiRxMgTidPWA5SJYsjrXhr1azR3boubNp24gZHUeY4"},"pruned_txo":{},"seed":"scheme grape nephew hen song purity pizza syrup must dentist bright grit accuse","seed_version":11,"stored_height":0,"transactions":{},"txi":{},"txo":{},"use_encryption":false,"wallet_type":"standard"}'
        self._upgrade_storage(wallet_str)

    def test_upgrade_from_client_2_3_2_importedkeys(self):
        wallet_str = '{"accounts":{"/x":{"imported":{"LMK1a5LKLkLFCEKukwwTrGxPboNvZjDbcY":["0344b1588589958b0bcab03435061539e9bcf54677c104904044e4f8901f4ebdf5","T8hVerMmMsVnq7mkXpEw4krEhXJ5BZNVv7mb4C7LoV8Ni8iywME1"],"LPRvUteVjy7MwDYro7o6XJ8SzhaYBJQhoM":["04575f52b82f159fa649d2a4c353eb7435f30206f0a6cb9674fbd659f45082c37d559ffd19bea9c0d3b7dcc07a7b79f4cffb76026d5d4dff35341efe99056e22d2","6vHESf1YF8tPdqpGyEiNvibJPRZzKsB4ijYsywkUaz3SfUAnidY"],"LZBc9EVXNXW1aGdrxodATNp9kYeCxufeWb":["0389508c13999d08ffae0f434a085f4185922d64765c0bff2f66e36ad7f745cc5f","T96yXyhXKvujT4sMAPihoJJ2sXNTwDircc7WnT2qqXTdBs433uZ5"]}}},"accounts_expanded":{},"pruned_txo":{},"stored_height":489715,"transactions":{},"txi":{},"txo":{},"use_encryption":false,"wallet_type":"imported"}'
        self._upgrade_storage(wallet_str)

    def test_upgrade_from_client_2_3_2_watchaddresses(self):
        wallet_str = '{"accounts":{"/x":{"imported":{"LXupCaL8GsoAAC3c6ayRuQiF6oKd6jzvF2":[null,null],"LbGiejb64pNXrjPZfiauVkchFQksBnFjrz":[null,null],"Lc2ZerD7r4iMufWnkUFRVoqj8zaUdra9gy":[null,null]}}},"accounts_expanded":{},"pruned_txo":{},"stored_height":0,"transactions":{},"txi":{},"txo":{},"wallet_type":"imported"}'
        self._upgrade_storage(wallet_str)

    def test_upgrade_from_client_2_3_2_trezor_singleacc(self):
        wallet_str = '''{"accounts":{"0":{"change":["033608f89d381bcb9964df9da428d706d3eb30c14433af8de21bee2601e7392a80","0295c3905730d987ae9a9c09ad85c9c22c28aa414448f9d3450d8afb3da0d78890","038cf10bcf2bd3384f05974295fc83fc4e9cb48c0105995ad86d3ea237edb7e1d1","029b76e98f87c537165f016cf6840fe40c172ca0dba10278fb10e49a2b718cd156","034f08127c3651e5c5a65803e22dcbb1be10a90a79b699173ed0de82e0ceae862e","036013206a41aa6f782955b5a3b0e67f9a508ecd451796a2aa4ee7a02edef9fb7e"],"receiving":["020be78fa1a35e44fb1ee3141b40bd8d68330f12f98fdef5ba249b4d8c52a6a1ae","03f23e9a3b5337f322f720f533653349f6e97228d1c4a6feca36d4d1554aa19f74","03d3e7cfde0117561856e6e43d87852480c512910bfd1988c2ff1e6f6d795f7046","02ec56fc0bfe6a1466a783737919edbe83c8907af29a5ae672919ffcb1bb96303f","031b1d151f6584f9926614a7c335ee61606ff7a9769ca6e175ad99f9c7b5e9fb4d","03d782be0ace089e02529029b08ca9107b0e58302306de30bd9f9a3a1ed40c3717","0325784a4290eeeea1f99a928cf6c75c33417659dbd50a3a2850136dc3138ba631","035b7c1176926a54cdeb0342df5ecc7bb3fe1820fce99491fb50c091e3093f200f","02e0a2d615bff26a57754afa0e8ac8b692a79b399f6d04647398f377dcac4116be","026c7cee5bce1ae9e2fa930001ece81c35442a461fc9ef1266ac3d41b9f13e3bd5","0217b1d5066708e0cdaee99087c407db684131e34578adc7800dc66f329576c457","03ec0ed891b0ead00f1eaca7a4736d6816e348731d995bd4e77acbc8c582f68429","028cb4c682dde9692de47f71f3b16755cc440d722b84eed68db2b3d80bce83d50a","03d5d770a58d32b5d59b12861bbda37560fe7b789181b3349abf56223ea61b39c4","0250b6aee8338ac0497f2106b0ed014f5a2419c7bf429eb2b17a70bec77e6ff482","02565da9be6fc66a1e354638dcd8a4244e8733f38599c91c4f1ab0fb8d5d94fd2f","02e6c88509ff676b686afc2326370684bbc6edc0b31e09f312df4f7a17fe379e31","02224fef0921e61adcb2cd14ef45dbe4b859f1fcdc62eba26c6a7ce386c0a8f4b1","034c63da9c2a20132d9fd1088028de18f7ccd72458f9eb07a72452bd9994d28b1f","032bfe2fc88a55e19ba2338155b79e67b7d061d5fd1844bc8edc1808d998f8ba2c"],"xpub":"xpub6D77dkWgEcSNBq7xDA1RUysGvD64QNy2TykC9UuRK6fEzqy3512HR2p2spstKCybkhDqkNStPWZKcnhwdD6kDYWJxsTQJhg9RCwifzcfJN9"}},"accounts_expanded":{},"labels":{"0":"Main account"},"master_public_keys":{"x/0'":"xpub6D77dkWgEcSNBq7xDA1RUysGvD64QNy2TykC9UuRK6fEzqy3512HR2p2spstKCybkhDqkNStPWZKcnhwdD6kDYWJxsTQJhg9RCwifzcfJN9","x/1'":"xpub6D77dkWgEcSNFtXV2CQgsbfG33VyGMaUtUdpbdfMMHsS4WDzLtRapchQWcVBMFFjdRYjhkvQwGnJeKWPP3C2e1DevATAEUzL258Lhfkd7KG"},"next_account2":["1","xpub6D77dkWgEcSNFtXV2CQgsbfG33VyGMaUtUdpbdfMMHsS4WDzLtRapchQWcVBMFFjdRYjhkvQwGnJeKWPP3C2e1DevATAEUzL258Lhfkd7KG","03571f041921078b153a496638d703dfd1cee75e73c42653bbe0650ab6168d6a5b","LSvzG3x2mkWo9bpAW4UsvTQtkPqSoUkJop"],"pruned_txo":{},"stored_height":0,"transactions":{},"txi":{},"txo":{},"wallet_type":"trezor"}'''
        self._upgrade_storage(wallet_str)

    def test_upgrade_from_client_2_3_2_trezor_multiacc(self):
        wallet_str = '''{"accounts":{"0":{"change":["03143bc04f007c454e03caf9d59b61e27f527b5e6723e167b50197ce45e2071902","03157710459a8213a79060e2f2003fe0eb7a7ed173ac3f846309de52269dd44740","028ec4bbbf4ac9edfabb704bd82acb0840f2166312929ce01af2b2e99059b16dee","021a9f1201968bd835029daf09ae98745a75bcb8c6143b80610cfc2eb2eee94dd8","031fe8323703fee4a1f6c59f27ceed4e227f5643b1cb387b39619b6b5499a971b4","033199fc62b72ce98e3780684e993f31d520f1da0bf2016ed26153b2efcc86ac1d"],"receiving":["03d27c0f5594d8df0616d64a735c909098eb867d01c6f1588f04ca2cf353837ec0","024d299f21e9ee9cc3eb425d04f45110eff46e45abcab24a3e594645860518fb97","03f6bc650e5f118ab4a63359a9cde4ab8382fe16e7d1b36b0a459145a79bef674b","028bed00a2fbd03f1ff43e0150ec1018458f7b39f3e4e602e089b1f47f8f607136","02108b15014d53f2e4e1b5b2d8f5eaf82006bbc4f273dbfbaef91eff08f9d10ea5","02a9a59a529818f3ba7a37ebe34454eac2bcbe4da0e8566b13f369e03bb020c4c4","023fde4ecf7fbdffb679d92f58381066cf2d840d34cb2d8bef63f7c5182d278d53","02ad8bf6dc0ff3c39bd20297d77fbd62073d7bf2fa44bf716cdd026db0819bb2b4","029c8352118800beaef1f3fa9c12afe30d329e7544bea9b136b717b88c24d95d92","02c42c251392674e2c2768ccd6224e04298bd5479436f02e9867ecc288dd2eb066","0316f3c82d9fce97e267b82147d56a4b170d39e6cf01bfaff6c2ae6bcc79a14447","0398554ee8e333061391b3e866505bbc5e130304ae09b198444bcd31c4ba7846ea","02e69d21aadb502e9bd93c5536866eff8ca6b19664545ccc4e77f3508e0cbe2027","0270fb334407a53a23ad449389e2cb055fae5017ca4d79ec8e082038db2d749c50","03d91a8f47453f9da51e0194e3aacff88bf79a625df82ceee73c71f3a7099a5459","0306b2d3fd06c4673cc90374b7db0c152ba7960be382440cecc4cdad7642e0537c","028020dd6062f080e1e2b49ca629faa1407978adab13b74875a9de93b16accf804","03907061c5f6fde367aafe27e1d53b39ff9c2babffe8ab7cf8c3023acba5c39736","029749462dba9af034455f5e0f170aac67fe9365ce7126092b4d24ced979b5381f","02f001d35308833881b3440670d25072256474c6c4061daf729055bf9563134105"],"xpub":"xpub6BycoSLDNcWjBQMuYgSaEoinupMjma8Cu2uj4XiRCZkecLHXXmzcxbyR1gdfrZpiZDVSs92MEGGNhF78BEbbYi2b5U2oPnaUPRhjriWz85y"},"1":{"change":["03b0df486b4e1baa03ad565622820d692089b059c8f9fefa3567c3fa26d0cbaa34","0294c76c062c865873dccab84d51682f880e0197b64789c61bff85e1be2506925e","036f900d0c6bafbbcac0fbc95bed44954007faa182655cf69dc84d50c22e6edce8","03d1be74f1360ecede61ad1a294b2e53d64d44def67848e407ec835f6639d825ff","03a6a526cfadd510a47da95b074be250f5bb659b857b8432a6d317e978994c30b7","022216da9e351ae57174f93a972b0b09d788f5b240b5d29985174fbd2119a981a9"],"receiving":["02106878f6aefd9a81e1ca4a5f30ea0e1851aa36404fb62d19bd2325e180112b58","039e95f369e8d65aa7a7bf6a5d7d3259b827c1549c77c9b502b75a18f7708a9aa9","0273197861097be131542f8b7e03bc912934da51bc957d425be5bc7c1b69fb44ec","02b4c829b6a20815c5e1eef7ffd5d55c99505a7afeac5135ec2c97cfaae3483604","0312b1285272f1005c5834de2eec830ce9f9163c842d728c3921ae790716d8503f","0354059948c709c777a49a37e150271a3377f7aaee17798253d5240e4119f2a1c6","03800d87cc3878912d22a42a79db7ddbff3efec727d29ae1c0165730e5314483cd","03cafa35ad9adb41cff39e3bc2e0592d88c8b91981e73f068397e6c863c42c7b00","028668f734a4927e03621e319ab385919e891d248c86aea07ab922492d3d414ad3","02e42d46823893978ae7be9e032be21ce3e613cecb5ffe687b534795f90dc8ef85","03b86914af797e7b68940bc4ee2dec134036781a8e23ffaf4189ca7637e0afe898","021221ae9be51a9747aa7ebc2213a42a2364ce790ee86255277dc5f9beeb0bf6b4","03c8d58183f5d8102f8eb5f6db0f60add0a51ec6737097c46fc8a6b7c840d7571f","0304de0806b299cef4be3a162bac78f811d4adacc6a229ffdaeb7333bce72d88ff","03e08262e18616a3a9b9aecbfb8a860ccee147820a3c60050695ef72ff2cedc4a7","02caf4d61bb5deec29a39e5a1cc6d5987ec71d61d57c57bb5c2a47dd9266130bec","0252d429002d9c06f0befbef6c389bdd021969b416dd83d220394e414bd5d83c0a","024e23ce58533163df3e1d5766295144beb8f9729b1ac41e80ba485f39c483dfe6","026de9e7e6b11fbecd88b7b49915b5df64d672ef900aa043a8cac3bc79eb414089","02aaac08fc100014ec692efa0f3b408bf741e1dc68ebe28ce41837662810f40986","03e0d2b426705dcc5cb62c6113b10153f10624c926a3fe86142fd9020e7d6a2129"],"xpub":"xpub6BycoSLDNcWjFs4B6T82q4zCbJBJdzQLwburAtBAwTLPyDPtkotGUWbef1t8D6XuCs6Yz5FUgFaL2hNzCTGe8F1bf9vNyXFMgLyKV65C9BH"}},"accounts_expanded":{},"addr_history":{"LM6NBhqWiUD5f2W1WpqLA7MtWiNFjW5Gpf":[],"LM9TfCciLzZUpYUhg2VkBgoC81bQwrav4C":[["a242aeff746aa481c5d8a496111039262f2a3fbde6038124301522539fa06837",490002]],"LNKgMdfRbUZbVNxcoeVHr4nRFp9ULZX4bT":[],"LNRkHQjKykMaazy1PCQnmqeQ71ttwUuuQK":[],"LPYB6U1Tc3Ld2sE3UdUnxbm4Kq5DDkPCEX":[],"LQ6D1vogMEs8fX1r4gixxjCCerbwTX3srN":[],"LQDkeaPgZyTG88UietSqaXKgGthudu92c8":[],"LRmMnkbdJVrssuy5gW8UpLC1zSEFp7omPC":[],"LSgH66JcXMp7k639zdaC4sHwr6t2yTKAwQ":[],"LW1dXPAmnVEZz17PhgQjHvmEV6MUcd6Zhi":[],"LYNthwkLpuYsJ6Ajf8TYRfaaQxqqtYWC1P":[],"LKTPPv5imBVPgTeGBLYbB99NYTnpPpF5wV":[],"LZrSPCcvWHfDaeNCnkFaYL8mzWhm89qZxo":[],"LaxCqVGpuyF5cpwGLw3T28dgZPBUoRcMSZ":[],"LbyEUdYYci1Cj1ejcJYY42xd1nQvM6eiXw":[],"LcFKtey5o4am16ZBPdxV3C7sZxTMyRqyoN":[],"Le1MnHWuYaGxL1fg13WsvNBy98GmHpurMG":[],"Le2qSFZKLGnxXyBnbW9wJaRmZdc6bfBmDG":[],"Les27ji39QbL8cM3ENGRmJ4eHhw1nkrHLf":[],"Lf3SJTKupNcZjw4BbXNJtoP2u36qoUPFJ4":[],"LfrnPoo5Wqudu5n5uiWa1jTVBKCfbNbeG4":[],"Lg57GijtoArWz9YwcyMg6Z4D3HsR6N1tGr":[],"LgUeokVX6eTKtbXNBJv6RheFhLiCzwSPaE":[],"LgahVvDJdYCWTZMzL8xFUUskXak7rKY76R":[],"LggNWLqwSZKAtCqcS5TTR9JPzCxSgoznXZ":[],"LgnpLBMSPN9okS1biMgszNMTbGvkCxAxom":[],"LL5B1VZe55MoSv47bra4E4pwrgNY1zHv1o":[]},"labels":{},"master_public_keys":{"x/0'":"xpub6BycoSLDNcWjBQMuYgSaEoinupMjma8Cu2uj4XiRCZkecLHXXmzcxbyR1gdfrZpiZDVSs92MEGGNhF78BEbbYi2b5U2oPnaUPRhjriWz85y","x/1'":"xpub6BycoSLDNcWjFs4B6T82q4zCbJBJdzQLwburAtBAwTLPyDPtkotGUWbef1t8D6XuCs6Yz5FUgFaL2hNzCTGe8F1bf9vNyXFMgLyKV65C9BH","x/2'":"xpub6BycoSLDNcWjHWrJyJJYmq9dDwBxSkFbWeaFFcrB6zBH9JTvyRVbAoWcmbPRmxicUkiutGQWqfsom9CbKSVG8Zh5HqHyR25xHE1xxmHeNYa"},"next_account2":["2","xpub6BycoSLDNcWjHWrJyJJYmq9dDwBxSkFbWeaFFcrB6zBH9JTvyRVbAoWcmbPRmxicUkiutGQWqfsom9CbKSVG8Zh5HqHyR25xHE1xxmHeNYa","031b68cff8114df7677c4fe80619b701ea966428ecbeba55c9224cd8149cc5f05e","LcVc1FUxfhcwJcjK8A6hb6YYU6k4e4MLdT"],"pruned_txo":{},"stored_height":490008,"transactions":{"a242aeff746aa481c5d8a496111039262f2a3fbde6038124301522539fa06837":"01000000018394dfaba83ca6f510f622ecf95b445e856eab3193cb0dad53e1262841149d5f00000000da0047304402207761cdbf009c0bd3864c6a457288cadfa565601f782cc09f0046926d54a1b68b022060b73a7babb5dfd5188c4697cfcab6c15c4dd3de8507d39722e3a6b728f697dc01483045022100a540921229b02c4cfbf2d57222a455cbb4a5bd09bff063749fb71292f720850a02204dd18369213ec4cb033cbf222e8439eb8a9dd0a1b864bfeefa44cfe0c0066ee401475221025966a0193194a071e71501f9f8987111f7364bd8105a006f908b1f743da8d353210397c83f4963bdf333f129ab8000d89536bfea0971fc7578fdff5c2104b296c4d252aefdffffff0288130000000000001976a9141516b5e9653ab1fb09180186077fc2d7dfa07e5788aca0ba09000000000017a9148132c19d6b9abba9ec978ca5269d577ae104541e8700000000"},"txi":{"a242aeff746aa481c5d8a496111039262f2a3fbde6038124301522539fa06837":{}},"txo":{"a242aeff746aa481c5d8a496111039262f2a3fbde6038124301522539fa06837":{"LM9TfCciLzZUpYUhg2VkBgoC81bQwrav4C":[[0,5000,false]]}},"verified_tx3":{"a242aeff746aa481c5d8a496111039262f2a3fbde6038124301522539fa06837":[490002,1508090436,607]},"wallet_type":"trezor"}'''
        self._upgrade_storage(wallet_str, accounts=2)

    def test_upgrade_from_client_2_3_2_multisig(self):
        wallet_str = '{"accounts":{"0":{"change":[["03083942fe75c1345833faa4d31a635e088ca173047ddd6ef5b7f1395892ef339d","03c02f486ed1f0e6d1aefbdea293c8cb44b34a3c719849c45e52ef397e6540bbda"],["0326d9adb5488c6aba8238e26c6185f4d2f1b072673e33fb6b495d62dc800ff988","023634ebe9d7448af227be5c85e030656b353df81c7cf9d23bc2c7403b9af7509b"],["0223728d8dd019e2bd2156754c2136049a3d2a39bf2cb65965945f4c598fdb6db6","037b6d4df2dde500789f79aa2549e8a6cb421035cda485581f7851175e0c95d00e"],["03c47ade02def712ebbf142028d304971bec99ca53be8e668e9cf15ff0ef186e19","02e212ad25880f2c9be7dfd1966e4b6ae8b3ea40e09d482378b942ca2e716397b0"],["03dab42b0eaee6b0e0d982fbf03364b378f39a1b3a80e980460ae96930a10bff6c","02baf8778e83fbad7148f3860ce059b3d27002c323eab5957693fb8e529f2d757f"],["02fc3019e886b0ce171242ddedb5f8dcde87d80ad9f707edb8e6db66a4389bea49","0241b4e9394698af006814acf09bf301f79d6feb2e1831a7bc3e8097311b1a96dd"]],"receiving":[["023e2bf49bc40aeed95cb1697d8542354df8572a8f93f5abe1bcec917778cc9fc6","03cf4e80c4bf3779e402b85f268ada2384932651cc41e324e51fc69d6af55ae593"],["02d9ba257aa3aba2517bb889d1d5a2e435d10c9352b2330600decab8c8082db242","03de9e91769733f6943483167602dd3d439e34b7078186066af8e90ec58076c2a7"],["02ccdd5b486cefa658af0c49d85aefa3ab62f808335ffcd4b8d4197a3c50ab073c","03e80dbbd0fb93d01d6446d0af1c18c16d26bdbb2538d8bf7f2f68ce95ba857667"],["031605867287fe3b1fee55e07b2f513792374bb5baf30f316970c5bc095651a789","02c0802b96cee67d6acec5266eb3b491c303cea009d57a6bb7aee83cc602206ad5"],["037d07d30dec97da4ea09d568f96f0eb6cd86d02781a7adff16c1647e1bcd23260","03d856a53bc90be84810ce94c8aac0791c9a63379fd61790c11dae926647aa4eec"],["028887f2d54ffefc98e5a605c83bedba79367c2a4fe11b98ec6582896ffad79216","0259dab6dafe52306fe6e3686f27a36e0650c99789bb19cbcd0907db00957030a9"],["039d83064dd37681eaf7babe333b210685ba9fe63627e2f2d525c1fb9c4d84d772","03381011299678d6b72ff82d6a47ed414b9e35fcf97fc391b3ff1607fb0bf18617"],["03ace6ceb95c93a446ae9ff5211385433c9bbf5785d52b4899e80623586f354004","0369de6b20b87219b3a56ea8007c33091f090698301b89dd6132cf6ef24b7889a0"],["031ec2b1d53da6a162138fb8f4a1ec27d62c45c13dddecebbd55ad8a5d05397382","02417a3320e15c2a5f0345ac927a10d7218883170a9e64837e629d14f8f3de7c78"],["02b85c8b2f33b6a8a882c383368be8e0a91491ea57595b6a690f01041be5bef4fb","0383ad57c7899284e9497e9dccb1de5bf8559b87157f13fee5677dcf2fbeb7b782"],["03eaa9e3ea81b2fa6e636373d860c0014e67ac6363c9284e465384986c2ec77ee2","03b1bd0d6355d99e8cab6d177f10f05eb8ddd3e762871f176d78a79f14ae037826"],["03ecd1b458e7c2b71a6542f8e64c750358c1421542ffe7630cc3ecc6866d379dfe","02d5c5432ca5e4243430f73a69c180c23bda8c7c269d7b824a4463e3ac58850984"],["028098ae6e772460047cdd6694230dcfc44da8ceabcae0624225f2452be7ae26c4","02add86858446c8a59ed3132264a8141292cd4ece6653bf3605895cceb00ba30b9"],["02f580882255cda6fae954294164b26f2c4b6b2744c0930daaa7a9953275f2f410","02c09c5e369910d84057637157bdf1fb721387bb2867c3c2adb2d91711498bbe5e"],["025e628f78c95135669ab8b9178f4396b0b513cbeae9ca631ba5e5e8321a4a05bc","03476f35b4defcc67334a0ff2ce700fb55df39b0f7f4ff993907e21091f6a29a31"],["026fa6f3214dce2ad2325dae3cd8d6728ce62af1903e308797ff071129fe111eca","03d07eb26749caceca56ffe77d9837aaf2f657c028bd3575724b7e2f1a8b3261a5"],["03894311c920ef03295c3f1c8851f5dc9c77e903943940820b084953a0a92efcc3","0368b0b3774f9de81b9f10e884d819ccf22b3c0ed507d12ce2a13efc36d06cdc17"],["024f8a61c23aa4a13a3a9eb9519ed3ec734f54c5e71d55f1805e873c31a125c467","039e9c6708767bd563fcdca049c4d8a1acab4a051d4f804ae31b5e9de07942570f"],["038f9b8f4b9fe6af5ced879a16bb6d56d81831f11987d23b32716ca4331f6cbabf","035453374f020646f6eda9528543ec0363923a3b7bbb40bc9db34740245d0132e7"],["02e30cd68ae23b3b3239d4e98745660b08d7ce30f2f6296647af977268a23b6c86","02ee5e33d164f0ad6b63f0c412734c1960507286ad675a343df9f0479d21a86ecc"]],"xpub":"xpub661MyMwAqRbcGAPwDuNBFdPguAcMFDrUFznD8RsCFkjQqtMPE66H5CDpecMJ9giZ1GVuZUpxhX4nFh1R3fzzr4hjDoxDSHymXVXQa7H1TjG","xpub2":"xpub661MyMwAqRbcFMKuZtmYryCNiNvHAki74TizX3b6dxaREtjLMoqnLJbd1zQKjWwKEThmB4VRtwePAWHNk9G5nHvAEvMHDYemERPQ7bMjQE3"}},"accounts_expanded":{},"master_private_keys":{"x1/":"xprv9s21ZrQH143K3gKU7sqAtVSxM8mrqm8ctmrcL3TahRCRy62EgYn2XPuLoJAGbBGvL4ArbPoAay5jo7L1UbBv15SsmrSKdTQSgDE351WSkm6"},"master_public_keys":{"x1/":"xpub661MyMwAqRbcGAPwDuNBFdPguAcMFDrUFznD8RsCFkjQqtMPE66H5CDpecMJ9giZ1GVuZUpxhX4nFh1R3fzzr4hjDoxDSHymXVXQa7H1TjG","x2/":"xpub661MyMwAqRbcFMKuZtmYryCNiNvHAki74TizX3b6dxaREtjLMoqnLJbd1zQKjWwKEThmB4VRtwePAWHNk9G5nHvAEvMHDYemERPQ7bMjQE3"},"pruned_txo":{},"seed":"brick huge enforce behave cabin cram okay friend sketch actor casual barrel abuse","seed_version":11,"stored_height":490033,"transactions":{},"txi":{},"txo":{},"use_encryption":false,"wallet_type":"2of2"}'
        self._upgrade_storage(wallet_str)

    def test_upgrade_from_client_2_4_3_seeded(self):
        wallet_str = '{"accounts":{"0":{"change":["02707eb483e51d859b52605756aee6773ea74c148d415709467f0b2a965cd78648","0321cddfb60d7ac41fdf866b75e4ad0b85cc478a3a84dc2e8db17d9a2b9f61c3b5","0368b237dea621f6e1d580a264580380da95126e46c7324b601c403339e25a6de9","02334d75548225b421f556e39f50425da8b8a36960cce564db8001f7508fef49f6","02990b264de812802743a378e7846338411c3afab895cff35fb24a430fa6b43733","02bc3b39ca00a777e95d89f773428bad5051272b0df582f52eb8d6ebb5bb849383"],"receiving":["0286c9d9b59daa3845b2d96ce13ac0312baebaf318251bac6d634bcac5ff815d9d","0220b65829b3a030972be34559c4bb1fc91f8dfd7e1703ddb43da9aa28aa224864","02fe34b26938c29faee00d8d704eae92b7c97d487825892290309073dc85ae5374","03ea255ae2ba7169802543cf7af135783f4fca91924fd0285bdbe386d78a0ab87e","027115aeea786e2745812f2ec2ae8fee3d038d96c9556b1324ac50c913b83a9e6a","03627439bb701352e35d0cf8e00617d8e9bf329697e430b0a5d999370097e025b4","034120249c6b15d051525156845aefaa83988adf9ed1dd18b796217dcf9824b617","02dfeb0c89eee66026d7650ee618c2172551f97fdd9ed249e696c54734d26e39a3","037e031bb4e51beb5c739ba6ab64aa696e85457ea63cc56698b7d9b731fd1e8e61","0302ea6818525492adc5ed8cfd2966efd704915199559fe1c06d6651fd36533012","0349394140560d685d455595f697d17b44e832ec453b5a2f02a3f5ed66205f3d30","036815bf2437df00440b15cfa7123544648cf266247989e82540d6b1cae1589892","02f98568e8f0f4b780f005e538a7452a60b2c06a5d2e3a23fa26d88459d118ef56","02e36ccb8b05a2762a08f60541d1a5a136afd6a73119eea8c7c377cc8b07eb2e2f","031566539feb6f0a212cca2604906b1c1f5cfc5bf5d5206e0c695e37ef3a141fd2","025754e770bedeef6f4e932fa231b858b49d28183e1be6da23e597c67dd7785f19","03a29961f5fb9c197cffe743081a761442a3cf9ded0be2fa07ab67023a74c08d28","023184c1995a9f51af566c9c0b4da92d7fd4a5c59ff93c34a323e94671ddbe414a","029efdb15d3aec708b3af2aee34a9157ff731bec94e4f19f634ab43d3101e47bd8","03e16b13fe6bb9aa6dc4e331e19ab4d3d291a2670b97e6040e87a7c7309b243af9"],"xpub":"xpub661MyMwAqRbcF1KGEGXxFTupKQHTTUan1qZMTp4yUxiwF2uRRum7u1TCnaJRjaSBW4d42Fwfi6xfLvfRfgtDixekGDWK9CPWguR7YzXKKeV"}},"accounts_expanded":{},"master_private_keys":{"x/":"xprv9s21ZrQH143K2XEo8EzwtKy5mNSy41rvecdkfRfMvdBxNEaGtNSsMD8iwHsc91UxKtSrDHXex53NkMRRDwnm4PmqS7N35K8BR1KCD2qm5iE"},"master_public_keys":{"x/":"xpub661MyMwAqRbcF1KGEGXxFTupKQHTTUan1qZMTp4yUxiwF2uRRum7u1TCnaJRjaSBW4d42Fwfi6xfLvfRfgtDixekGDWK9CPWguR7YzXKKeV"},"seed":"smart fish version ocean category disagree hospital mystery survey chef kid latin about","seed_version":11,"use_encryption":false,"wallet_type":"standard"}'
        self._upgrade_storage(wallet_str)

    def test_upgrade_from_client_2_4_3_importedkeys(self):
        wallet_str = '{"accounts":{"/x":{"imported":{"LMK1a5LKLkLFCEKukwwTrGxPboNvZjDbcY":["0344b1588589958b0bcab03435061539e9bcf54677c104904044e4f8901f4ebdf5","T8hVerMmMsVnq7mkXpEw4krEhXJ5BZNVv7mb4C7LoV8Ni8iywME1"],"LPRvUteVjy7MwDYro7o6XJ8SzhaYBJQhoM":["04575f52b82f159fa649d2a4c353eb7435f30206f0a6cb9674fbd659f45082c37d559ffd19bea9c0d3b7dcc07a7b79f4cffb76026d5d4dff35341efe99056e22d2","6vHESf1YF8tPdqpGyEiNvibJPRZzKsB4ijYsywkUaz3SfUAnidY"],"LZBc9EVXNXW1aGdrxodATNp9kYeCxufeWb":["0389508c13999d08ffae0f434a085f4185922d64765c0bff2f66e36ad7f745cc5f","T96yXyhXKvujT4sMAPihoJJ2sXNTwDircc7WnT2qqXTdBs433uZ5"]}}},"accounts_expanded":{},"stored_height":477636,"use_encryption":false,"wallet_type":"imported"}'
        self._upgrade_storage(wallet_str)

    def test_upgrade_from_client_2_4_3_watchaddresses(self):
        wallet_str = '{"accounts":{"/x":{"imported":{"LXupCaL8GsoAAC3c6ayRuQiF6oKd6jzvF2":[null,null],"LbGiejb64pNXrjPZfiauVkchFQksBnFjrz":[null,null],"Lc2ZerD7r4iMufWnkUFRVoqj8zaUdra9gy":[null,null]}}},"accounts_expanded":{},"pruned_txo":{},"stored_height":490038,"transactions":{},"txi":{},"txo":{},"wallet_type":"imported"}'
        self._upgrade_storage(wallet_str)

    def test_upgrade_from_client_2_4_3_trezor_singleacc(self):
        wallet_str = '''{"accounts":{"0":{"change":["033608f89d381bcb9964df9da428d706d3eb30c14433af8de21bee2601e7392a80","0295c3905730d987ae9a9c09ad85c9c22c28aa414448f9d3450d8afb3da0d78890","038cf10bcf2bd3384f05974295fc83fc4e9cb48c0105995ad86d3ea237edb7e1d1","029b76e98f87c537165f016cf6840fe40c172ca0dba10278fb10e49a2b718cd156","034f08127c3651e5c5a65803e22dcbb1be10a90a79b699173ed0de82e0ceae862e","036013206a41aa6f782955b5a3b0e67f9a508ecd451796a2aa4ee7a02edef9fb7e"],"receiving":["020be78fa1a35e44fb1ee3141b40bd8d68330f12f98fdef5ba249b4d8c52a6a1ae","03f23e9a3b5337f322f720f533653349f6e97228d1c4a6feca36d4d1554aa19f74","03d3e7cfde0117561856e6e43d87852480c512910bfd1988c2ff1e6f6d795f7046","02ec56fc0bfe6a1466a783737919edbe83c8907af29a5ae672919ffcb1bb96303f","031b1d151f6584f9926614a7c335ee61606ff7a9769ca6e175ad99f9c7b5e9fb4d","03d782be0ace089e02529029b08ca9107b0e58302306de30bd9f9a3a1ed40c3717","0325784a4290eeeea1f99a928cf6c75c33417659dbd50a3a2850136dc3138ba631","035b7c1176926a54cdeb0342df5ecc7bb3fe1820fce99491fb50c091e3093f200f","02e0a2d615bff26a57754afa0e8ac8b692a79b399f6d04647398f377dcac4116be","026c7cee5bce1ae9e2fa930001ece81c35442a461fc9ef1266ac3d41b9f13e3bd5","0217b1d5066708e0cdaee99087c407db684131e34578adc7800dc66f329576c457","03ec0ed891b0ead00f1eaca7a4736d6816e348731d995bd4e77acbc8c582f68429","028cb4c682dde9692de47f71f3b16755cc440d722b84eed68db2b3d80bce83d50a","03d5d770a58d32b5d59b12861bbda37560fe7b789181b3349abf56223ea61b39c4","0250b6aee8338ac0497f2106b0ed014f5a2419c7bf429eb2b17a70bec77e6ff482","02565da9be6fc66a1e354638dcd8a4244e8733f38599c91c4f1ab0fb8d5d94fd2f","02e6c88509ff676b686afc2326370684bbc6edc0b31e09f312df4f7a17fe379e31","02224fef0921e61adcb2cd14ef45dbe4b859f1fcdc62eba26c6a7ce386c0a8f4b1","034c63da9c2a20132d9fd1088028de18f7ccd72458f9eb07a72452bd9994d28b1f","032bfe2fc88a55e19ba2338155b79e67b7d061d5fd1844bc8edc1808d998f8ba2c"],"xpub":"xpub6D77dkWgEcSNBq7xDA1RUysGvD64QNy2TykC9UuRK6fEzqy3512HR2p2spstKCybkhDqkNStPWZKcnhwdD6kDYWJxsTQJhg9RCwifzcfJN9"}},"accounts_expanded":{},"labels":{"0":"Main account"},"master_public_keys":{"x/0'":"xpub6D77dkWgEcSNBq7xDA1RUysGvD64QNy2TykC9UuRK6fEzqy3512HR2p2spstKCybkhDqkNStPWZKcnhwdD6kDYWJxsTQJhg9RCwifzcfJN9","x/1'":"xpub6D77dkWgEcSNFtXV2CQgsbfG33VyGMaUtUdpbdfMMHsS4WDzLtRapchQWcVBMFFjdRYjhkvQwGnJeKWPP3C2e1DevATAEUzL258Lhfkd7KG"},"next_account2":["1","xpub6D77dkWgEcSNFtXV2CQgsbfG33VyGMaUtUdpbdfMMHsS4WDzLtRapchQWcVBMFFjdRYjhkvQwGnJeKWPP3C2e1DevATAEUzL258Lhfkd7KG","03571f041921078b153a496638d703dfd1cee75e73c42653bbe0650ab6168d6a5b","LSvzG3x2mkWo9bpAW4UsvTQtkPqSoUkJop"],"pruned_txo":{},"stored_height":485855,"transactions":{},"txi":{},"txo":{},"wallet_type":"trezor"}'''
        self._upgrade_storage(wallet_str)

    def test_upgrade_from_client_2_4_3_trezor_multiacc(self):
        wallet_str = '''{"accounts":{"0":{"change":["03143bc04f007c454e03caf9d59b61e27f527b5e6723e167b50197ce45e2071902","03157710459a8213a79060e2f2003fe0eb7a7ed173ac3f846309de52269dd44740","028ec4bbbf4ac9edfabb704bd82acb0840f2166312929ce01af2b2e99059b16dee","021a9f1201968bd835029daf09ae98745a75bcb8c6143b80610cfc2eb2eee94dd8","031fe8323703fee4a1f6c59f27ceed4e227f5643b1cb387b39619b6b5499a971b4","033199fc62b72ce98e3780684e993f31d520f1da0bf2016ed26153b2efcc86ac1d"],"receiving":["03d27c0f5594d8df0616d64a735c909098eb867d01c6f1588f04ca2cf353837ec0","024d299f21e9ee9cc3eb425d04f45110eff46e45abcab24a3e594645860518fb97","03f6bc650e5f118ab4a63359a9cde4ab8382fe16e7d1b36b0a459145a79bef674b","028bed00a2fbd03f1ff43e0150ec1018458f7b39f3e4e602e089b1f47f8f607136","02108b15014d53f2e4e1b5b2d8f5eaf82006bbc4f273dbfbaef91eff08f9d10ea5","02a9a59a529818f3ba7a37ebe34454eac2bcbe4da0e8566b13f369e03bb020c4c4","023fde4ecf7fbdffb679d92f58381066cf2d840d34cb2d8bef63f7c5182d278d53","02ad8bf6dc0ff3c39bd20297d77fbd62073d7bf2fa44bf716cdd026db0819bb2b4","029c8352118800beaef1f3fa9c12afe30d329e7544bea9b136b717b88c24d95d92","02c42c251392674e2c2768ccd6224e04298bd5479436f02e9867ecc288dd2eb066","0316f3c82d9fce97e267b82147d56a4b170d39e6cf01bfaff6c2ae6bcc79a14447","0398554ee8e333061391b3e866505bbc5e130304ae09b198444bcd31c4ba7846ea","02e69d21aadb502e9bd93c5536866eff8ca6b19664545ccc4e77f3508e0cbe2027","0270fb334407a53a23ad449389e2cb055fae5017ca4d79ec8e082038db2d749c50","03d91a8f47453f9da51e0194e3aacff88bf79a625df82ceee73c71f3a7099a5459","0306b2d3fd06c4673cc90374b7db0c152ba7960be382440cecc4cdad7642e0537c","028020dd6062f080e1e2b49ca629faa1407978adab13b74875a9de93b16accf804","03907061c5f6fde367aafe27e1d53b39ff9c2babffe8ab7cf8c3023acba5c39736","029749462dba9af034455f5e0f170aac67fe9365ce7126092b4d24ced979b5381f","02f001d35308833881b3440670d25072256474c6c4061daf729055bf9563134105"],"xpub":"xpub6BycoSLDNcWjBQMuYgSaEoinupMjma8Cu2uj4XiRCZkecLHXXmzcxbyR1gdfrZpiZDVSs92MEGGNhF78BEbbYi2b5U2oPnaUPRhjriWz85y"},"1":{"change":["03b0df486b4e1baa03ad565622820d692089b059c8f9fefa3567c3fa26d0cbaa34","0294c76c062c865873dccab84d51682f880e0197b64789c61bff85e1be2506925e","036f900d0c6bafbbcac0fbc95bed44954007faa182655cf69dc84d50c22e6edce8","03d1be74f1360ecede61ad1a294b2e53d64d44def67848e407ec835f6639d825ff","03a6a526cfadd510a47da95b074be250f5bb659b857b8432a6d317e978994c30b7","022216da9e351ae57174f93a972b0b09d788f5b240b5d29985174fbd2119a981a9"],"receiving":["02106878f6aefd9a81e1ca4a5f30ea0e1851aa36404fb62d19bd2325e180112b58","039e95f369e8d65aa7a7bf6a5d7d3259b827c1549c77c9b502b75a18f7708a9aa9","0273197861097be131542f8b7e03bc912934da51bc957d425be5bc7c1b69fb44ec","02b4c829b6a20815c5e1eef7ffd5d55c99505a7afeac5135ec2c97cfaae3483604","0312b1285272f1005c5834de2eec830ce9f9163c842d728c3921ae790716d8503f","0354059948c709c777a49a37e150271a3377f7aaee17798253d5240e4119f2a1c6","03800d87cc3878912d22a42a79db7ddbff3efec727d29ae1c0165730e5314483cd","03cafa35ad9adb41cff39e3bc2e0592d88c8b91981e73f068397e6c863c42c7b00","028668f734a4927e03621e319ab385919e891d248c86aea07ab922492d3d414ad3","02e42d46823893978ae7be9e032be21ce3e613cecb5ffe687b534795f90dc8ef85","03b86914af797e7b68940bc4ee2dec134036781a8e23ffaf4189ca7637e0afe898","021221ae9be51a9747aa7ebc2213a42a2364ce790ee86255277dc5f9beeb0bf6b4","03c8d58183f5d8102f8eb5f6db0f60add0a51ec6737097c46fc8a6b7c840d7571f","0304de0806b299cef4be3a162bac78f811d4adacc6a229ffdaeb7333bce72d88ff","03e08262e18616a3a9b9aecbfb8a860ccee147820a3c60050695ef72ff2cedc4a7","02caf4d61bb5deec29a39e5a1cc6d5987ec71d61d57c57bb5c2a47dd9266130bec","0252d429002d9c06f0befbef6c389bdd021969b416dd83d220394e414bd5d83c0a","024e23ce58533163df3e1d5766295144beb8f9729b1ac41e80ba485f39c483dfe6","026de9e7e6b11fbecd88b7b49915b5df64d672ef900aa043a8cac3bc79eb414089","02aaac08fc100014ec692efa0f3b408bf741e1dc68ebe28ce41837662810f40986","03e0d2b426705dcc5cb62c6113b10153f10624c926a3fe86142fd9020e7d6a2129"],"xpub":"xpub6BycoSLDNcWjFs4B6T82q4zCbJBJdzQLwburAtBAwTLPyDPtkotGUWbef1t8D6XuCs6Yz5FUgFaL2hNzCTGe8F1bf9vNyXFMgLyKV65C9BH"}},"accounts_expanded":{},"addr_history":{"LM9TfCciLzZUpYUhg2VkBgoC81bQwrav4C":[["a242aeff746aa481c5d8a496111039262f2a3fbde6038124301522539fa06837",490002]]},"labels":{"0":"Main account"},"master_public_keys":{"x/0'":"xpub6BycoSLDNcWjBQMuYgSaEoinupMjma8Cu2uj4XiRCZkecLHXXmzcxbyR1gdfrZpiZDVSs92MEGGNhF78BEbbYi2b5U2oPnaUPRhjriWz85y","x/1'":"xpub6BycoSLDNcWjFs4B6T82q4zCbJBJdzQLwburAtBAwTLPyDPtkotGUWbef1t8D6XuCs6Yz5FUgFaL2hNzCTGe8F1bf9vNyXFMgLyKV65C9BH","x/2'":"xpub6BycoSLDNcWjHWrJyJJYmq9dDwBxSkFbWeaFFcrB6zBH9JTvyRVbAoWcmbPRmxicUkiutGQWqfsom9CbKSVG8Zh5HqHyR25xHE1xxmHeNYa"},"next_account2":["2","xpub6BycoSLDNcWjHWrJyJJYmq9dDwBxSkFbWeaFFcrB6zBH9JTvyRVbAoWcmbPRmxicUkiutGQWqfsom9CbKSVG8Zh5HqHyR25xHE1xxmHeNYa","031b68cff8114df7677c4fe80619b701ea966428ecbeba55c9224cd8149cc5f05e","LcVc1FUxfhcwJcjK8A6hb6YYU6k4e4MLdT"],"pruned_txo":{},"stored_height":490009,"transactions":{"a242aeff746aa481c5d8a496111039262f2a3fbde6038124301522539fa06837":"01000000018394dfaba83ca6f510f622ecf95b445e856eab3193cb0dad53e1262841149d5f00000000da0047304402207761cdbf009c0bd3864c6a457288cadfa565601f782cc09f0046926d54a1b68b022060b73a7babb5dfd5188c4697cfcab6c15c4dd3de8507d39722e3a6b728f697dc01483045022100a540921229b02c4cfbf2d57222a455cbb4a5bd09bff063749fb71292f720850a02204dd18369213ec4cb033cbf222e8439eb8a9dd0a1b864bfeefa44cfe0c0066ee401475221025966a0193194a071e71501f9f8987111f7364bd8105a006f908b1f743da8d353210397c83f4963bdf333f129ab8000d89536bfea0971fc7578fdff5c2104b296c4d252aefdffffff0288130000000000001976a9141516b5e9653ab1fb09180186077fc2d7dfa07e5788aca0ba09000000000017a9148132c19d6b9abba9ec978ca5269d577ae104541e8700000000"},"txi":{"a242aeff746aa481c5d8a496111039262f2a3fbde6038124301522539fa06837":{}},"txo":{"a242aeff746aa481c5d8a496111039262f2a3fbde6038124301522539fa06837":{"LM9TfCciLzZUpYUhg2VkBgoC81bQwrav4C":[[0,5000,false]]}},"verified_tx3":{"a242aeff746aa481c5d8a496111039262f2a3fbde6038124301522539fa06837":[490002,1508090436,607]},"wallet_type":"trezor"}'''
        self._upgrade_storage(wallet_str, accounts=2)

    def test_upgrade_from_client_2_4_3_multisig(self):
        wallet_str = '{"accounts":{"0":{"change":[["03467a8bae231aff83aa01999ee4d3834894969df7a3b0753e23ae7a3aae089f6b","02180c539980494b4e59edbda5e5340be2f5fbf07e7c3898b0488950dda04f3476"],["03d8e18a428837e707f35d8e2da106da2e291b8acbf40ca0e7bf1ac102cda1de11","03fad368e3eb468a7fe721805c89f4405581854a58dcef7205a0ab9b903fd39c23"],["0331c9414d3eee5bee3c2dcab911537376148752af83471bf3b623c184562815d9","02dcd25d2752a6303f3a8366fae2d62a9ff46519d70da96380232fc9818ee7029e"],["03bb18a304533086e85782870413688eabef6a444a620bf679f77095b9d06f5a16","02f089ed84b0f7b6cb0547741a18517f2e67d7b5d4d4dd050490345831ce2aef9e"],["02dc6ebde88fdfeb2bcd69fce5c5c76db6409652c347d766b91671e37d0747e423","038086a75e36ac0d6e321b581464ea863ab0be9c77098b01d9bc8561391ed0c695"],["02a0b30b12f0c4417a4bef03cb64aa55e4de52326cf9ebe0714613b7375d48a22e","02c149adda912e8dc060e3bbe4020c96cff1a32e0c95098b2573e67b330e714df0"]],"m":2,"receiving":[["0254281a737060e919b071cb58cc16a3865e36ea65d08a7a50ba2e10b80ff326d5","0257421fa90b0f0bc75b67dd54ffa61dc421d583f307c58c48b719dd59078023e4"],["03854ce9bbc7813d535099658bcc6c671a2c25a269fdb044ee0ed5deb95da0d7e0","025379ca82313dde797e5aa3f222dddf0f7223cb271f79ecce2c8178bea3e33c62"],["03ae6ad5ffc75d71adc2ab87e3adc63fa8696a8656e1135adb5ae88ddb6d39089f","025ed8821f8b37aef69b1aabf89e4e405f09206c330c78e94206b21139ddafcc4f"],["033ea4d8b88d36d14a52983ae30d486254af2dfa1c7f8e04bc9d8e34b3ffe4b32a","02b441a3e47a338d89027755b81724219362b8d9b66142d32fcb91c9c7829d8c9f"],["029195704b9bbc3014452bbf07baa7bf6277dfefd9721aea8438f2671ba57b898b","022264503140f99b41c0269666ab6d16b2dad72865dbd2bf6153d45f5d11978e4d"],["037e3caa2d151123821dff34fd8a76ac0d56fa97c41127e9b330a115bf12d76674","02a4ae28e2011537de4cce0c47af4ac0484b38d408befcb731c3d752922fcd3c5b"],["02226853ca32e72b4771ccc47c0aae27c65ed0d25c525c1f673b913b97dca46cc5","027a9c855fc4e6b3f8495e77347a1e03c0298c6a86bd5a89800195bd445ae3e3bd"],["02890f7eee0766d2dde92f3146cd461ae0fa9caf07e1f3559d023a20349bae5e44","0380249f30829b3656c32064ddf657311159cecb36f9dbbf8e50e3d7279b70c57e"],["02ab9613fd5a67a3fdf6b6241d757ce92b2640d9d436e968742cb7c4ec4bb3e6e9","0204b29cc980b18dfb3a4f9ca6796c6be3e0aee2462719b4a787e31c8c5d79c8cf"],["029103b50ecc0cc818c1c97e8acb8ce3e1d86f67e49f60c8496683f15e753c3eed","0247abb2c5e4cde22eb59a203557c0bbe87e9c449e6c2973e693ac14d0d9cf3f28"],["02817c935c971e6e318ba9e25402df26ca016a4e532459be5841c2d83a5aa8a967","03331fe3a2e4aa3e2dc1d8d4afc5a88c57350806b905e593b5876c6b9cef71fd4d"],["03023c6797af5c9c3d7db2fbeb9d7236601fe5438036200f2f59d9b997d29ec123","023b1084f008cf2e9632967095958bb0bbd59e60a0537e6003d780c7ebccb2d4f5"],["0245e0bdebe483fef984e4e023eb34641e65909cd566eb6bd6c0bce592296265a1","0363bad4b477d551f46b19afcc10decf6a4c1200becb5b22c032c62e6d90b373b8"],["0379ba2f8c5e8e5e3f358615d230348fe8d7855ef9c0e1cf97aac4ec09dfe690aa","02ecda86ff40b286a3faadf9a5b361ab7a5beb50426296a8c0e3d222f404ae4380"],["02e090227c22efa7f60f290408ce9f779e27b39d4acec216111cc3a8b9594ab451","02144954ddabb55abcfe49ea703a4e909ab86db2f971a2e85fc006dffbdf85af52"],["025dc4bd1c4809470b5a14cf741519ad7f5f2ccd331b42e0afd2ce182cdf25f82d","03d292524190af850665c2255a785d66c59fea2b502d4037bb31fdde10ad9b043f"],["027e7c549f613ae9ba1d806c8c8256f870e1c7912e3e91cbb326d61fb20ac3a096","03fbbf15ee2b49878c022d0b30478b6a3acb61f24af6754b3f8bcb4d2e71968099"],["02c188eaf5391e52fdcd66f8522df5ae996e20c524577ac9ffa7a9a9af54508f7c","03fe28f1ea4a0f708fa2539988758efd5144a128cc12aed28285e4483382a6636a"],["03bea51abacd82d971f1ef2af58dcbd1b46cdfa5a3a107af526edf40ca3097b78d","02267d2c8d43034d03219bb5bc0af842fb08f028111fc363ec43ab3b631134228a"],["03c3a0ecdbf8f0a162434b0db53b3b51ce02886cbc20c52e19a42b5f681dac6ffb","02d1ede70e7b1520a6ccabd91488af24049f1f1cf2661c07d8d87aee31d5aec7c9"]],"xpubs":["xpub661MyMwAqRbcFafkG2opdo3ou3zUEpFK3eKpWWYkdA5kfvootPkZzqvUV1rtLYRLdUxvXBZApzZpwyR2mXBd1hRtnc4LoaLTQWDFcPKnKiQ","xpub661MyMwAqRbcFrxPbuWkHdMeaZMjb4jKpm51RHxQ3czEDmyK3Qa3Z43niVzVjFyhJs6SrdXgQg56DHMDcC94a7MCtn9Pwh2bafhHGJbLWeH"]}},"accounts_expanded":{},"master_private_keys":{"x1/":"xprv9s21ZrQH143K3NsvVsyjvVQv2XXFBc1UTY9QcuYnVHTFLyeAVsFo1FjJsBk48XK16jZLqRs1B5Sa6SCqYdA2XFvB9riBca2GyGccYGKKP6t"},"master_public_keys":{"x1/":"xpub661MyMwAqRbcFrxPbuWkHdMeaZMjb4jKpm51RHxQ3czEDmyK3Qa3Z43niVzVjFyhJs6SrdXgQg56DHMDcC94a7MCtn9Pwh2bafhHGJbLWeH","x2/":"xpub661MyMwAqRbcFafkG2opdo3ou3zUEpFK3eKpWWYkdA5kfvootPkZzqvUV1rtLYRLdUxvXBZApzZpwyR2mXBd1hRtnc4LoaLTQWDFcPKnKiQ"},"pruned_txo":{},"seed":"angry work entry banana taste climb script fold level rate organ edge account","seed_version":11,"stored_height":490033,"transactions":{},"txi":{},"txo":{},"use_encryption":false,"wallet_type":"2of2"}'
        self._upgrade_storage(wallet_str)

    def test_upgrade_from_client_2_5_4_seeded(self):
        wallet_str = '{"accounts":{"0":{"change":["0253e61683b66ebf5a4916334adf1409ffe031016717868c9600d313e87538e745","021762e47578385ecedc03c7055da1713971c82df242920e7079afaf153cc37570","0303a8d6a35956c228aa95a17aab3dee0bca255e8b4f7e8155b23acef15cf4a974","02e881bc60018f9a6c566e2eb081a670f48d89b4a6615466788a4e2ce20246d4c6","02f0090e29817ef64c17f27bf6cdebc1222f7e11d7112073f45708e8d218340777","035b9c53b85fd0c2b434682675ac862bfcc7c5bb6993aee8e542f01d96ff485d67"],"receiving":["024fbc610bd51391794c40a7e04b0e4d4adeb6b0c0cc84ac0b3dad90544e428c47","024a2832afb0a366b149b6a64b648f0df0d28c15caa77f7bbf62881111d6915fe9","028cd24716179906bee99851a9062c6055ec298a3956b74631e30f5239a50cb328","039761647d7584ba83386a27875fe3d7715043c2817f4baca91e7a0c81d164d73d","02606fc2f0ce90edc495a617329b3c5c5cc46e36d36e6c66015b1615137278eabd","02191cc2986e33554e7b155f9eddcc3904fdba43a5a3638499d3b7b5452692b740","024b5bf755b2f65cab1f7e5505febc1db8b91781e5aac352902e79bc96ad7d9ad0","0309816cb047402b84133f4f3c5e56c215e860204513278beef54a87254e44c14a","03f53d34337c12ddb94950b1fee9e4a9cf06ad591db66194871d31a17ec7b59ac7","0325ede4b08073d7f288741c2c577878919fd5d832a9e6e04c9eac5563ae13aa83","02eca43081b04f68d6c8b81781acd59e5b8d2ba44dba195369afc40790fd9edef7","029a8ca96c64d3a98345be1594208908f2be5e6af6bcc6ff3681f271e75fcf232e","02fbe0804980750163a216cc91cfe86e907addf0e80797a8ea5067977eb4897c1b","0344f32fc1ee8b2eb08f419325529f495d77a3b5ea683bbce7a44178705ab59302","021dd62bdf18256bd5316ce3cbcca58785378058a41ba2d1c58f4cc76449b3c424","035e61cdbdb4306e58a816a19ad92c7ca3a392b67ac6d7257646868ffe512068c5","0326a4db82f21787d0246f8144abe6cda124383b7d93a6536f36c05af530ea262a","02b352a27a8f9c57b8e5c89b357ba9d0b5cb18bf623509b34cd881fcf8b89a819a","02a59188edef1ed29c158a0adb970588d2031cfe53e72e83d35b7e8dd0c0c77525","02e8b9e42a54d072c8887542c405f6c99cfabf41bdde639944b44ba7408837afd1"],"xpub":"xpub661MyMwAqRbcGh7ywNf1BYoFCs8mht2YnvkMYUJTazrAWbnbvkrisvSvrKGjRTDtw324xzprbDgphsmPv2pB6K5Sux3YNHC8pnJANCBY6vG"}},"accounts_expanded":{},"addr_history":{"LLZV4hbJrpmqLzBM11h3DeBdegK69wQPAW":[],"LLwUekV4w5Lcc38LKWuQLT8aiAzYUt6rV6":[],"LMxirHoS7Vw5Qh5rrE2QTxG4aL4j21r9LX":[],"LNrESPumL9SB3X8N1zaNZDMBXHgQybaGTT":[],"LPBpZ7r6wivP5E1ContrDiQwfPJkhWTbrF":[],"LPammZnQx2jSidgMFqJKSvZ29cQSNfc17S":[],"LS1jBo6sKnJhrCYn69KnEQYCeMRkDtkqkX":[],"LSCm9Suxt8vMkDAwvsYjgkgc3mbsQRfEne":[],"LUGZH4W2WgbbocHpr7TbDQuX3SSqxPLXLZ":[],"LV7AFyvimmPtM6Np9MmeKPQS4EWyG1kwBq":[],"LV8cZunhSG5zr91JV8TZgAxEA34UU4yR6h":[],"LVL4Uy18DVXgCC6MCjzbFvSNm7Sk6LpGsa":[],"LXHYwwutRt8HeK4cfopZMcEZqiGKLDy663":[],"LXsccbqTirgTStQp5GjiPiS2NkM2TDKFtF":[],"LYK4JdYGcfgyiKde2DghHFBPUvnzYgZLQp":[],"LZB3y15emUHJffWaFiYE6B4ajs8Xs23Lc1":[],"LZVyyNuudLYNyp1mzRzw1vZp9WPYobqd43":[],"Lb3ghucBMWaTXBnwjPCY9xXt3gqxSwt4GG":[],"LbH99hN6wL55qo6qTaNHzPB7hvmdKowJMY":[],"Lc1U6ETTUZTUQvP7KRPeFTLQ9UszVBUyZi":[],"LearupHXqoArAjmzhBt8k3FTonyvouya2f":[],"LegFaLyW1yEUqB7EoMDd7KwrfLxLrS7Yv6":[],"Lf7Up8jg9PFa592KDH85snPUCvD7CwMncF":[],"Lgtpjz2RGd2xQrR1JQJDfVxJHqNBtXWemb":[],"LiGZpxHzJT31LdJmBWMKvmNVYw6eunGpTP":[],"LL2i5PpdwW38mfspFTm6ttjTPQbVktGudJ":[]},"master_private_keys":{"x/":"xprv9s21ZrQH143K4D3WqM7zpQrWeqJHJRJhRhpkk5tr2fKBdoTTPDYUL88T12Ad9RHwViugcMbngkMDY626vD5syaFDoUB2cpLeraBaHvZHWFn"},"master_public_keys":{"x/":"xpub661MyMwAqRbcGh7ywNf1BYoFCs8mht2YnvkMYUJTazrAWbnbvkrisvSvrKGjRTDtw324xzprbDgphsmPv2pB6K5Sux3YNHC8pnJANCBY6vG"},"pruned_txo":{},"seed":"tent alien genius panic stage below spoon swap merge hammer gorilla squeeze ability","seed_version":11,"stored_height":489715,"transactions":{},"txi":{},"txo":{},"use_encryption":false,"wallet_type":"standard","winpos-qt":[100,100,840,400]}'
        self._upgrade_storage(wallet_str)

    def test_upgrade_from_client_2_5_4_importedkeys(self):
        wallet_str = '{"accounts":{"/x":{"imported":{"LMK1a5LKLkLFCEKukwwTrGxPboNvZjDbcY":["0344b1588589958b0bcab03435061539e9bcf54677c104904044e4f8901f4ebdf5","T8hVerMmMsVnq7mkXpEw4krEhXJ5BZNVv7mb4C7LoV8Ni8iywME1"],"LPRvUteVjy7MwDYro7o6XJ8SzhaYBJQhoM":["04575f52b82f159fa649d2a4c353eb7435f30206f0a6cb9674fbd659f45082c37d559ffd19bea9c0d3b7dcc07a7b79f4cffb76026d5d4dff35341efe99056e22d2","6vHESf1YF8tPdqpGyEiNvibJPRZzKsB4ijYsywkUaz3SfUAnidY"],"LZBc9EVXNXW1aGdrxodATNp9kYeCxufeWb":["0389508c13999d08ffae0f434a085f4185922d64765c0bff2f66e36ad7f745cc5f","T96yXyhXKvujT4sMAPihoJJ2sXNTwDircc7WnT2qqXTdBs433uZ5"]}}},"accounts_expanded":{},"addr_history":{},"pruned_txo":{},"stored_height":489716,"transactions":{},"txi":{},"txo":{},"use_encryption":false,"wallet_type":"imported","winpos-qt":[595,261,840,400]}'
        self._upgrade_storage(wallet_str)

    def test_upgrade_from_client_2_5_4_watchaddresses(self):
        wallet_str = '{"accounts":{"/x":{"imported":{"LXupCaL8GsoAAC3c6ayRuQiF6oKd6jzvF2":[null,null],"LbGiejb64pNXrjPZfiauVkchFQksBnFjrz":[null,null],"Lc2ZerD7r4iMufWnkUFRVoqj8zaUdra9gy":[null,null]}}},"accounts_expanded":{},"addr_history":{},"pruned_txo":{},"stored_height":490038,"transactions":{},"txi":{},"txo":{},"wallet_type":"imported","winpos-qt":[406,393,840,400]}'
        self._upgrade_storage(wallet_str)

    def test_upgrade_from_client_2_5_4_trezor_singleacc(self):
        wallet_str = '''{"accounts":{"0":{"change":["033608f89d381bcb9964df9da428d706d3eb30c14433af8de21bee2601e7392a80","0295c3905730d987ae9a9c09ad85c9c22c28aa414448f9d3450d8afb3da0d78890","038cf10bcf2bd3384f05974295fc83fc4e9cb48c0105995ad86d3ea237edb7e1d1","029b76e98f87c537165f016cf6840fe40c172ca0dba10278fb10e49a2b718cd156","034f08127c3651e5c5a65803e22dcbb1be10a90a79b699173ed0de82e0ceae862e","036013206a41aa6f782955b5a3b0e67f9a508ecd451796a2aa4ee7a02edef9fb7e"],"receiving":["020be78fa1a35e44fb1ee3141b40bd8d68330f12f98fdef5ba249b4d8c52a6a1ae","03f23e9a3b5337f322f720f533653349f6e97228d1c4a6feca36d4d1554aa19f74","03d3e7cfde0117561856e6e43d87852480c512910bfd1988c2ff1e6f6d795f7046","02ec56fc0bfe6a1466a783737919edbe83c8907af29a5ae672919ffcb1bb96303f","031b1d151f6584f9926614a7c335ee61606ff7a9769ca6e175ad99f9c7b5e9fb4d","03d782be0ace089e02529029b08ca9107b0e58302306de30bd9f9a3a1ed40c3717","0325784a4290eeeea1f99a928cf6c75c33417659dbd50a3a2850136dc3138ba631","035b7c1176926a54cdeb0342df5ecc7bb3fe1820fce99491fb50c091e3093f200f","02e0a2d615bff26a57754afa0e8ac8b692a79b399f6d04647398f377dcac4116be","026c7cee5bce1ae9e2fa930001ece81c35442a461fc9ef1266ac3d41b9f13e3bd5","0217b1d5066708e0cdaee99087c407db684131e34578adc7800dc66f329576c457","03ec0ed891b0ead00f1eaca7a4736d6816e348731d995bd4e77acbc8c582f68429","028cb4c682dde9692de47f71f3b16755cc440d722b84eed68db2b3d80bce83d50a","03d5d770a58d32b5d59b12861bbda37560fe7b789181b3349abf56223ea61b39c4","0250b6aee8338ac0497f2106b0ed014f5a2419c7bf429eb2b17a70bec77e6ff482","02565da9be6fc66a1e354638dcd8a4244e8733f38599c91c4f1ab0fb8d5d94fd2f","02e6c88509ff676b686afc2326370684bbc6edc0b31e09f312df4f7a17fe379e31","02224fef0921e61adcb2cd14ef45dbe4b859f1fcdc62eba26c6a7ce386c0a8f4b1","034c63da9c2a20132d9fd1088028de18f7ccd72458f9eb07a72452bd9994d28b1f","032bfe2fc88a55e19ba2338155b79e67b7d061d5fd1844bc8edc1808d998f8ba2c"],"xpub":"xpub6D77dkWgEcSNBq7xDA1RUysGvD64QNy2TykC9UuRK6fEzqy3512HR2p2spstKCybkhDqkNStPWZKcnhwdD6kDYWJxsTQJhg9RCwifzcfJN9"}},"accounts_expanded":{},"addr_history":{},"labels":{"0":"Main account"},"master_public_keys":{"x/0'":"xpub6D77dkWgEcSNBq7xDA1RUysGvD64QNy2TykC9UuRK6fEzqy3512HR2p2spstKCybkhDqkNStPWZKcnhwdD6kDYWJxsTQJhg9RCwifzcfJN9","x/1'":"xpub6D77dkWgEcSNFtXV2CQgsbfG33VyGMaUtUdpbdfMMHsS4WDzLtRapchQWcVBMFFjdRYjhkvQwGnJeKWPP3C2e1DevATAEUzL258Lhfkd7KG"},"next_account2":["1","xpub6D77dkWgEcSNFtXV2CQgsbfG33VyGMaUtUdpbdfMMHsS4WDzLtRapchQWcVBMFFjdRYjhkvQwGnJeKWPP3C2e1DevATAEUzL258Lhfkd7KG","03571f041921078b153a496638d703dfd1cee75e73c42653bbe0650ab6168d6a5b","LSvzG3x2mkWo9bpAW4UsvTQtkPqSoUkJop"],"pruned_txo":{},"stored_height":490046,"transactions":{},"txi":{},"txo":{},"wallet_type":"trezor","winpos-qt":[522,328,840,400]}'''
        self._upgrade_storage(wallet_str)

    def test_upgrade_from_client_2_5_4_trezor_multiacc(self):
        wallet_str = '''{"accounts":{"0":{"change":["03143bc04f007c454e03caf9d59b61e27f527b5e6723e167b50197ce45e2071902","03157710459a8213a79060e2f2003fe0eb7a7ed173ac3f846309de52269dd44740","028ec4bbbf4ac9edfabb704bd82acb0840f2166312929ce01af2b2e99059b16dee","021a9f1201968bd835029daf09ae98745a75bcb8c6143b80610cfc2eb2eee94dd8","031fe8323703fee4a1f6c59f27ceed4e227f5643b1cb387b39619b6b5499a971b4","033199fc62b72ce98e3780684e993f31d520f1da0bf2016ed26153b2efcc86ac1d"],"receiving":["03d27c0f5594d8df0616d64a735c909098eb867d01c6f1588f04ca2cf353837ec0","024d299f21e9ee9cc3eb425d04f45110eff46e45abcab24a3e594645860518fb97","03f6bc650e5f118ab4a63359a9cde4ab8382fe16e7d1b36b0a459145a79bef674b","028bed00a2fbd03f1ff43e0150ec1018458f7b39f3e4e602e089b1f47f8f607136","02108b15014d53f2e4e1b5b2d8f5eaf82006bbc4f273dbfbaef91eff08f9d10ea5","02a9a59a529818f3ba7a37ebe34454eac2bcbe4da0e8566b13f369e03bb020c4c4","023fde4ecf7fbdffb679d92f58381066cf2d840d34cb2d8bef63f7c5182d278d53","02ad8bf6dc0ff3c39bd20297d77fbd62073d7bf2fa44bf716cdd026db0819bb2b4","029c8352118800beaef1f3fa9c12afe30d329e7544bea9b136b717b88c24d95d92","02c42c251392674e2c2768ccd6224e04298bd5479436f02e9867ecc288dd2eb066","0316f3c82d9fce97e267b82147d56a4b170d39e6cf01bfaff6c2ae6bcc79a14447","0398554ee8e333061391b3e866505bbc5e130304ae09b198444bcd31c4ba7846ea","02e69d21aadb502e9bd93c5536866eff8ca6b19664545ccc4e77f3508e0cbe2027","0270fb334407a53a23ad449389e2cb055fae5017ca4d79ec8e082038db2d749c50","03d91a8f47453f9da51e0194e3aacff88bf79a625df82ceee73c71f3a7099a5459","0306b2d3fd06c4673cc90374b7db0c152ba7960be382440cecc4cdad7642e0537c","028020dd6062f080e1e2b49ca629faa1407978adab13b74875a9de93b16accf804","03907061c5f6fde367aafe27e1d53b39ff9c2babffe8ab7cf8c3023acba5c39736","029749462dba9af034455f5e0f170aac67fe9365ce7126092b4d24ced979b5381f","02f001d35308833881b3440670d25072256474c6c4061daf729055bf9563134105"],"xpub":"xpub6BycoSLDNcWjBQMuYgSaEoinupMjma8Cu2uj4XiRCZkecLHXXmzcxbyR1gdfrZpiZDVSs92MEGGNhF78BEbbYi2b5U2oPnaUPRhjriWz85y"},"1":{"change":["03b0df486b4e1baa03ad565622820d692089b059c8f9fefa3567c3fa26d0cbaa34","0294c76c062c865873dccab84d51682f880e0197b64789c61bff85e1be2506925e","036f900d0c6bafbbcac0fbc95bed44954007faa182655cf69dc84d50c22e6edce8","03d1be74f1360ecede61ad1a294b2e53d64d44def67848e407ec835f6639d825ff","03a6a526cfadd510a47da95b074be250f5bb659b857b8432a6d317e978994c30b7","022216da9e351ae57174f93a972b0b09d788f5b240b5d29985174fbd2119a981a9"],"receiving":["02106878f6aefd9a81e1ca4a5f30ea0e1851aa36404fb62d19bd2325e180112b58","039e95f369e8d65aa7a7bf6a5d7d3259b827c1549c77c9b502b75a18f7708a9aa9","0273197861097be131542f8b7e03bc912934da51bc957d425be5bc7c1b69fb44ec","02b4c829b6a20815c5e1eef7ffd5d55c99505a7afeac5135ec2c97cfaae3483604","0312b1285272f1005c5834de2eec830ce9f9163c842d728c3921ae790716d8503f","0354059948c709c777a49a37e150271a3377f7aaee17798253d5240e4119f2a1c6","03800d87cc3878912d22a42a79db7ddbff3efec727d29ae1c0165730e5314483cd","03cafa35ad9adb41cff39e3bc2e0592d88c8b91981e73f068397e6c863c42c7b00","028668f734a4927e03621e319ab385919e891d248c86aea07ab922492d3d414ad3","02e42d46823893978ae7be9e032be21ce3e613cecb5ffe687b534795f90dc8ef85","03b86914af797e7b68940bc4ee2dec134036781a8e23ffaf4189ca7637e0afe898","021221ae9be51a9747aa7ebc2213a42a2364ce790ee86255277dc5f9beeb0bf6b4","03c8d58183f5d8102f8eb5f6db0f60add0a51ec6737097c46fc8a6b7c840d7571f","0304de0806b299cef4be3a162bac78f811d4adacc6a229ffdaeb7333bce72d88ff","03e08262e18616a3a9b9aecbfb8a860ccee147820a3c60050695ef72ff2cedc4a7","02caf4d61bb5deec29a39e5a1cc6d5987ec71d61d57c57bb5c2a47dd9266130bec","0252d429002d9c06f0befbef6c389bdd021969b416dd83d220394e414bd5d83c0a","024e23ce58533163df3e1d5766295144beb8f9729b1ac41e80ba485f39c483dfe6","026de9e7e6b11fbecd88b7b49915b5df64d672ef900aa043a8cac3bc79eb414089","02aaac08fc100014ec692efa0f3b408bf741e1dc68ebe28ce41837662810f40986","03e0d2b426705dcc5cb62c6113b10153f10624c926a3fe86142fd9020e7d6a2129"],"xpub":"xpub6BycoSLDNcWjFs4B6T82q4zCbJBJdzQLwburAtBAwTLPyDPtkotGUWbef1t8D6XuCs6Yz5FUgFaL2hNzCTGe8F1bf9vNyXFMgLyKV65C9BH"}},"accounts_expanded":{},"addr_history":{"LLp8eip42b8b7Dqx4afsg8EYVBrb3XoDhJ":[],"LM9TfCciLzZUpYUhg2VkBgoC81bQwrav4C":[["a242aeff746aa481c5d8a496111039262f2a3fbde6038124301522539fa06837",490002]],"LMM2K24t4JKfPknUBUekKvGGSzdHCEmtER":[],"LMQDkz2pMnuoJe4vBjhfqyELckRCXv6Joe":[],"LMgt5EXAUv4YDjJGV69WKUbRNgtCm3u6cc":[],"LPTMsfapiZWahP7ssTxJXZCuScmtxuRRmB":[],"LQ3XVACE7hyN27PtyKJ16Xc2WRcUcbzv5t":[],"LRk5aKPw4qnPiY8Y6RASyBACidkddJuXmS":[],"LSDQ4Gtkj2pHL2Qcx5MsAyv4yeTFzwuQ9P":[],"LTQNkxn5kWQgDJqyyiAjWVDoC8Uizu2sAX":[],"LTuLiF5RDueFyX5nLuLTrcicevMeaMTyUA":[],"LUGt537JhWkqN7HsM8FrrdxBCLestA2JqB":[],"LXEZ3EcphcJGH5Dm98qbHJ19Grk7AzFrW3":[],"LY9wA2j6Qy9neh8VibQTU1tjF4TyXiqHyg":[],"LKTDwEtSc2wMvihkeBiG8cvXuAdAEo5pWQ":[],"LZ8zhMrM36MNmFpv9UkYBLYr5sKeTwBMuz":[],"LZtmh1Db3FuF3cbnh4vT9eqNLJusZXGJG1":[],"LaQudSRrazvgHvu9yPSY31AAeMcDX3Wkoo":[],"LcUAuMRpK2cXy8LtAkEmZtvmG8oJGfEbV5":[],"LcVc1FUxfhcwJcjK8A6hb6YYU6k4e4MLdT":[],"LcdnnGHWB9o1aubx5ZA9VRdwmmAKzT3F6W":[],"LchZ84NWvtM4pVCY1u9HRaM3WRyV7Wtpaq":[],"Ld8EjhuNjqaGjW9T8Dt3VF2yoR9dyUCK8Q":[],"LdnrP2Kt8thosyn45zQgLwm2Ecg9tRyzZ8":[],"LeT4zw74CdG81r3WjixibqzPRBPWBvuKeg":[],"LeioJ2mJBzdU9wVHPysFtHvhA7T8ejJbav":[],"Lezrwzoh4P9QrVKdM42eBdrBZZJ7jP6Amz":[],"LfcKM98iJDSarohpjsooHqyvtgvMW6sc61":[]},"labels":{"0":"Main account"},"master_public_keys":{"x/0'":"xpub6BycoSLDNcWjBQMuYgSaEoinupMjma8Cu2uj4XiRCZkecLHXXmzcxbyR1gdfrZpiZDVSs92MEGGNhF78BEbbYi2b5U2oPnaUPRhjriWz85y","x/1'":"xpub6BycoSLDNcWjFs4B6T82q4zCbJBJdzQLwburAtBAwTLPyDPtkotGUWbef1t8D6XuCs6Yz5FUgFaL2hNzCTGe8F1bf9vNyXFMgLyKV65C9BH","x/2'":"xpub6BycoSLDNcWjHWrJyJJYmq9dDwBxSkFbWeaFFcrB6zBH9JTvyRVbAoWcmbPRmxicUkiutGQWqfsom9CbKSVG8Zh5HqHyR25xHE1xxmHeNYa"},"next_account2":["2","xpub6BycoSLDNcWjHWrJyJJYmq9dDwBxSkFbWeaFFcrB6zBH9JTvyRVbAoWcmbPRmxicUkiutGQWqfsom9CbKSVG8Zh5HqHyR25xHE1xxmHeNYa","031b68cff8114df7677c4fe80619b701ea966428ecbeba55c9224cd8149cc5f05e","LcVc1FUxfhcwJcjK8A6hb6YYU6k4e4MLdT"],"pruned_txo":{},"stored_height":490009,"transactions":{"a242aeff746aa481c5d8a496111039262f2a3fbde6038124301522539fa06837":"01000000018394dfaba83ca6f510f622ecf95b445e856eab3193cb0dad53e1262841149d5f00000000da0047304402207761cdbf009c0bd3864c6a457288cadfa565601f782cc09f0046926d54a1b68b022060b73a7babb5dfd5188c4697cfcab6c15c4dd3de8507d39722e3a6b728f697dc01483045022100a540921229b02c4cfbf2d57222a455cbb4a5bd09bff063749fb71292f720850a02204dd18369213ec4cb033cbf222e8439eb8a9dd0a1b864bfeefa44cfe0c0066ee401475221025966a0193194a071e71501f9f8987111f7364bd8105a006f908b1f743da8d353210397c83f4963bdf333f129ab8000d89536bfea0971fc7578fdff5c2104b296c4d252aefdffffff0288130000000000001976a9141516b5e9653ab1fb09180186077fc2d7dfa07e5788aca0ba09000000000017a9148132c19d6b9abba9ec978ca5269d577ae104541e8700000000"},"txi":{"a242aeff746aa481c5d8a496111039262f2a3fbde6038124301522539fa06837":{}},"txo":{"a242aeff746aa481c5d8a496111039262f2a3fbde6038124301522539fa06837":{"LM9TfCciLzZUpYUhg2VkBgoC81bQwrav4C":[[0,5000,false]]}},"verified_tx3":{"a242aeff746aa481c5d8a496111039262f2a3fbde6038124301522539fa06837":[490002,1508090436,607]},"wallet_type":"trezor","winpos-qt":[757,469,840,400]}'''
        self._upgrade_storage(wallet_str, accounts=2)

    def test_upgrade_from_client_2_5_4_multisig(self):
        wallet_str = '{"accounts":{"0":{"change":[["02a63209b49df0bb98d8a262e9891fe266ffdce4be09d5e1ffaf269a10d7e7a17c","02a074035006ed8ee8f200859c004c073b687140f7d40bd333cdbbe43bad1e50bc"],["0280e2367142669e08e27fb9fd476076a7f34f596e130af761aef54ec54954a64d","02719a66c59f76c36921cf7b330fca7aaa4d863ee367828e7d89cd2f1aad98c3ac"],["0332083e80df509d3bd8a06538ca20030086c9ed3313300f7313ed98421482020f","032f336744f53843d8a007990fa909e35e42e1e32460fae2e0fc1aef7c2cff2180"],["03fe014e5816497f9e27d26ce3ae8d374edadec410227b2351e9e65eb4c5d32ab7","0226edd8c3af9e339631145fd8a9f6d321fdc52fe0dc8e30503541c348399dd52a"],["03e6717b18d7cbe264c6f5d0ad80f915163f6f6c08c121ac144a7664b95aedfdf3","03d69a074eba3bc2c1c7b1f6f85822be39aee20341923e406c2b445c255545394a"],["023112f87a5b9b2eadc73b8d5657c137b50609cd83f128d130172a0ed9e3fea9bc","029a81fd5ba57a2c2c6cfbcb34f369d87af8759b66364d5411eddd28e8a65f67fa"]],"m":2,"receiving":[["03c35c3da2c864ee3192a847ffd3f67fa59c095d8c2c0f182ed9556308ec37231e","03cfcb6d1774bfd916bd261232645f6c765da3401bf794ab74e84a6931d8318786"],["03973c83f84a4cf5d7b21d1e8b29d6cbd4cb40d7460166835cd1e1fd2418cfcf2e","03596801e66976959ac1bdb4025d65a412d95d320ed9d1280ac3e89b041e663cf4"],["02b78ac89bfdf90559f24313d7393af272092827efc33ba3a0d716ee8b75fd08ff","038e21fae8a033459e15a700551c1980131eb555bbb8b23774f8851aa10dcac6b8"],["0288e9695bb24f336421d5dcf16efb799e7d1f8284413fe08e9569588bc116567e","027123ba3314f77a8eb8bb57ba1015dd6d61b709420f6a3320ba4571b728ef2d91"],["0312e1483f7f558aef1a14728cc125bb4ee5cff0e7fa916ba8edd25e3ebceb05e9","02dad92a9893ad95d3be5ebc40828cef080e4317e3a47af732127c3fee41451356"],["03a694e428a74d37194edc9e231e68399767fdb38a20eca7b72caf81b7414916a8","03129a0cef4ed428031972050f00682974b3d9f30a571dc3917377595923ac41d8"],["026ed41491a6d0fb3507f3ca7de7fb2fbfdfb28463ae2b91f2ab782830d8d5b32c","03211b3c30c41d54734b3f13b8c9354dac238d82d012839ee0199b2493d7e7b6fc"],["03480e87ffa55a96596be0af1d97bca86987741eb5809675952a854d59f5e8adc2","0215f04df467d411e2a9ed8883a21860071ab721314503019a10ed30e225e522e7"],["0389fce63841e9231d5890b1a0c19479f8f40f4f463ef8e54ef306641abe545ac8","02396961d498c2dcb3c7081b50c5a4df15fda31300285a4c779a59c9abc98ea20d"],["03d4a3053e9e08dc21a334106b5f7d9ac93e42c9251ceb136b83f1a614925eb1fb","025533963c22b4f5fbfe75e6ee5ad7ee1c7bff113155a7695a408049e0b16f1c52"],["038a07c8d2024b9118651474bd881527e8b9eb85fc90fdcb04c1e38688d498de4b","03164b188eb06a3ea96039047d0db1c8f9be34bfd454e35471b1c2f429acd40afb"],["0214070cd393f39c062ce1e982a8225e5548dbbbd654aeba6d36bfcc7a685c7b12","029c6a9fb61705cc39bef34b09c684a362d4862b16a3b0b39ca4f94d75cd72290c"],["027b3497f72f581fea0a678bc20482b6fc7b4b507f7263d588001d73fdf5fe314e","021b80b159d19b6978a41c2a6bf7d3448bc73001885f933f7854f450b5873091f3"],["0303e9d76e4fe7336397c760f6fdfd5fb7500f83e491efb604fa2442db6e1da417","03a8d1b22a73d4c181aecd8cfe8bb2ee30c5dd386249d2a5a3b071b7a25b9da73a"],["0298e472b74832af856fb68eed02ff00a235fd0424d833bc305613e9f44087d0ee","03bb9bc2e4aaa9b022b35c8d122dfccb6c28ae8f0996a8fb4a021af8ec96a7beaf"],["02e933a4afb354500da03373514247e1be12e67cc4683e0cb82f508878cc3cc048","02c07a57b071bc449a95dd80308e53b26e4ebf4d523f620eecb17f96ae3aa814e9"],["03f73476951078b3ccc549bc7e6362797aaaacb1ea0edc81404b4d16cb321255a3","03b3a825fb9fc497e568fba69f70e2c3dcdc793637e242fce578546fcbd33cb312"],["03bbdf99fddeea64a96bbb9d1e6d7ced571c9c7757045dcbd8c40137125b017dc5","03aedf4452afefb1c3da25e698f621cb3a3a0130aa299488e018b93a45b5e6c21d"],["03b85891edb147d43c0a5935a20d6bbf8d32c542bfecccf3ae0158b65bd639b34e","03b34713c636a1c103b82d6cec917d442c59522ddc5a60bf7412266dd9790e7760"],["028ddf53b85f6c01122a96bd6c181ee17ca222ee9eca85bdeeb25c4b5315005e3b","02f4821995bfd5d0adb7a78d6e3a967ac72ace9d9a4f9392aff2711533893e017b"]],"xpubs":["xpub661MyMwAqRbcGHtCYBSGGVgMSihroMkuyE25GPyzfQvS2vSFG7SgJYf7rtXJjMh7srBJj8WddLtjapHnUQLwJ7kxsy5HiNZnGvF9pm2du7b","xpub661MyMwAqRbcEdd7bzA86LbhMoTv8NeyqcNP5z1Tiz9ajCRQDzdeXHw3h5ucDNGWr6mPFCZBcBE31VNKyR3vWM7WEeisu5m4VsCyuA6H8fp"]}},"accounts_expanded":{},"addr_history":{"M8X4uq5CDRnz5n2wtpY4McvH6xo33JVsfg":[],"M92fGyHHhXjAmjFxBmo1skrZTd1RztaTtf":[],"M9H89QRUqYxCLYCd6X7Lc6pjQktKmgrz8M":[],"M9UgTpWY1ecky2EGnFEbFAhrkfCM2sDC9t":[],"M9tnVWPU5JnVqjx51vqHB8zu7dZ1REXSe3":[],"MBPvxh6i9VosWwdueDm38ydY1Qp3K6vm5S":[],"MDgCby178EhqauoSymM9ERqW2rAxomV5Jr":[],"MDtyuB3ZoKThnMe97tA43Q44ouK66iw3L1":[],"ME69hxq6yjeVQUJUgZsgSUsumuqSJuoEny":[],"MECCAnaFA5eRSovF625uePrLkjnna9fnsn":[],"MG3nhkjYc3Zg2rTzJPWNvs5yjLAWjcrX7N":[],"MGHoAUJpAdkVFM9hPhuBhadGjUQbfFH2wF":[],"MHDWMGg3aVEyfxSoP8aqVQBvyGSHL8zghQ":[],"MHNKup31bHmNXLaqvhkQtGYzE2NsXxbVws":[],"MJP1azbGjVJVZHDkh97sNzcLpoW67isa8n":[],"MJjAaDcRcw6iFBSfh9R7irZfc4BxXrW1CT":[],"MK4UnLuFrNrxrPDh52XZbPuhSrJjE7Ypg5":[],"MKAZszP8M9DTfKVC5MSvKMWfPE5cTnbWpB":[],"MKYcAm3WXijDuv6ruDRquCW8fenPmHUuwy":[],"MNUBUH6paL3tZhRnZpWEsWctUGmEnrF7de":[],"MQRf8MNkpSekiPRQj945xgJF65pXggXx9e":[],"MSqS7U7h4y8reumY91CQY1JTJ8nGTFc6dr":[],"MT6DQ5FgG4QSiGH9zQHspEnVESdUKZhNci":[],"MTZHMtXjvrDYi6d7rTJMm3PpvRq427MwLM":[],"MUfsE8uVsgue1EffyY59tv8QxUVvwcdybA":[],"MWR6CcmwtUjsqzwzHpRLsjb1jRuEYktCTQ":[]},"master_private_keys":{"x1/":"xprv9s21ZrQH143K29YeVxd7jCexomdRiuw8UPSnHbbrAecbrQ6FgTKPyVcZqp2256L5DSTdb8UepPVaDwJecswTrEhdyZiaNGERJpfzWV5FcN5"},"master_public_keys":{"x1/":"xpub661MyMwAqRbcEdd7bzA86LbhMoTv8NeyqcNP5z1Tiz9ajCRQDzdeXHw3h5ucDNGWr6mPFCZBcBE31VNKyR3vWM7WEeisu5m4VsCyuA6H8fp","x2/":"xpub661MyMwAqRbcGHtCYBSGGVgMSihroMkuyE25GPyzfQvS2vSFG7SgJYf7rtXJjMh7srBJj8WddLtjapHnUQLwJ7kxsy5HiNZnGvF9pm2du7b"},"pruned_txo":{},"seed":"park dash merit trend life field acid wrap dinosaur kit bar hotel abuse","seed_version":11,"stored_height":490034,"transactions":{},"txi":{},"txo":{},"use_encryption":false,"wallet_type":"2of2","winpos-qt":[564,329,840,400]}'
        self._upgrade_storage(wallet_str)

    def test_upgrade_from_client_2_6_4_seeded(self):
        wallet_str = '{"accounts":{"0":{"change":["03236a8ce6fd3d343358f92d3686b33fd6e7301bf9f635e94c21825780ab79c93d","0393e39f6b4a3651013fca3352b89f1ae31751d4268603f1423c71ff79cbb453a1","033d9722ecf50846527037295736708b20857b4dd7032fc02317f9780d6715e8ff","03f1d56d2ade1daae5706ea945cab2af719060a955c8ad78153693d8d08ed6b456","029260d935322dd3188c3c6b03a7b82e174f11ca7b4d332521740c842c34649137","0266e8431b49f129b892273ab4c8834a19c6432d5ed0a72f6e88be8c629c731ede"],"receiving":["0350f41cfac3fa92310bb4f36e4c9d45ec39f227a0c6e7555748dff17e7a127f67","02f997d3ed0e460961cdfa91dec4fa09f6a7217b2b14c91ed71d208375914782ba","029a498e2457744c02f4786ac5f0887619505c1dae99de24cf500407089d523414","03b15b06044de7935a0c1486566f0459f5e66c627b57d2cda14b418e8b9017aca1","026e9c73bdf2160630720baa3da2611b6e34044ad52519614d264fbf4adc5c229a","0205184703b5a8df9ae622ea0e8326134cbeb92e1f252698bc617c9598aff395a1","02af55f9af0e46631cb7fde6d1df6715dc6018df51c2370932507e3d6d41c19eec","0374e0c89aa4ecf1816f374f6de8750b9c6648d67fe0316a887a132c608af5e7c0","0321bb62f5b5c393aa82750c5512703e39f4824f4c487d1dc130f690360c0e5847","0338ea6ebb2ed80445f64b2094b290c81d0e085e6000367eb64b1dc5049f11c2e9","020c3371a9fd283977699c44a205621dea8abfc8ebc52692a590c60e22202fa49b","0395555e4646f94b10af7d9bc57e1816895ad2deddef9d93242d6d342cea3d753b","02ffa4495d020d17b54da83eaf8fbe489d81995577021ade3a340a39f5a0e2d45c","030f0e16b2d55c3b40b64835f87ab923d58bcdbb1195fadc2f05b6714d9331e837","02f70041fc4b1155785784a7c23f35d5d6490e300a7dd5b7053f88135fc1f14dfd","03b39508c6f9c7b8c3fb8a1b91e61a0850c3ac76ccd1a53fbc5b853a94979cffa8","03b02aa869aa14b0ec03c4935cc12f221c3f204f44d64146d468e07370c040bfe7","02b7d246a721e150aaf0e0e60a30ad562a32ef76a450101f3f772fef4d92b212d9","037cd5271b31466a75321d7c9e16f995fd0a2b320989c14bee82e161c83c714321","03d4ad77e15be312b29987630734d27ca6e9ee418faa6a8d6a50581eca40662829"],"xpub":"xpub661MyMwAqRbcGwHDovebbFy19vHfW2Cqtyf2TaJkAwhFWsLYfHHYcCnM7smpvntxJP1YMVT5triFbWiCGXPRPhqdCxFumA77MuQB1CeWHpE"}},"accounts_expanded":{},"addr_history":{"LM4H3YDXHDFTQKssBW5k4ybzh6xMdNcL7D":[],"LMExtrDd36wM23kmuq3DMzuBL7xB3oaNwi":[],"LMXfJxaLrp61bRCRsm3QEkYrutVibsZPfS":[],"LNJnLmXMyuxAAxKKD27bFECk62DwcADxLY":[],"LNu8J9eo6sboSJb4eEGaf4pAkacpXQAdgw":[],"LQiDhACQ2UK2qd6XFoRRUqv5Jz94JWukNM":[],"LQoeaiJ31NfmGsZ6vwJyzTZCy8nerq6KbZ":[],"LRAgamK2apbJFF7Df6PknrbByN6tVWycjm":[],"LSebmUc1ufmoZP5KtzUvj7VbS67tQVhZSa":[],"LUEBTZf8YicmsK56qVB5KYNcvPRnLNKu4n":[],"LW9ursus2BRCEwT9AAuGbx6A5LfvJxZZer":[],"LYSTkCNaUVNcr1Ka1GqdyGfp3evNMBKcQQ":[],"LZ6sioAR2218STwDEqojAF82smcwg7LqhK":[],"LcuXuxWrK7bN1uVaYvvknSNunAtvdzG6pd":[],"LdWac1whXAy4bfYNKkzisBtS4DCEZ5J7CA":[],"LduED2dXwZXa5A542xQYEEa6YxT7TnV2ww":[],"LeUcPqMMHopwpj3eXJi8RzkLrmy6kxYyPj":[],"LgGV3pXExAU66UMAQdxhWnUrWYiGL6LZRp":[],"LghqbpoETRn8i6tspUzuknFY8DVSirGrAw":[],"LgmD8yRDuStWLtJ8c2kS4k3h7Ch9iBseQ8":[],"Lh9BsfEVHJNPej5uVCZFym4LgzyjXgFV7H":[],"Lhi6Dr4NQctR5bgopJ3wpFt6EH6HJc9uiu":[],"LhrfY7JcfAFq4YnPdoewhwT9HsRvr6pYRB":[],"LiPmdrN3xyMLRQ11xDjr2a2Ka6VNaKMuZ3":[],"LKdjYKYvVqmJtv3448PPbUVEbxmbWFYre1":[],"LKsiAy1BT6kFvb82wxkCjSy6ZpMNhJn2Gy":[]},"master_private_keys":{"x/":"xprv9s21ZrQH143K4TCkhu7bE82GbtTB6ZUzXkjRfBu8ccAGe51Q7jyJ4QTsGbWxpHxnatKeYV7Ad83m7KC81THBm2xmyxA1q8BuuRXSGnmhhR8"},"master_public_keys":{"x/":"xpub661MyMwAqRbcGwHDovebbFy19vHfW2Cqtyf2TaJkAwhFWsLYfHHYcCnM7smpvntxJP1YMVT5triFbWiCGXPRPhqdCxFumA77MuQB1CeWHpE"},"pruned_txo":{},"seed":"heart cabbage scout rely square census satoshi home purpose legal replace move able","seed_version":11,"stored_height":489716,"transactions":{},"txi":{},"txo":{},"use_encryption":false,"wallet_type":"standard","winpos-qt":[582,394,840,400]}'
        self._upgrade_storage(wallet_str)

    def test_upgrade_from_client_2_6_4_importedkeys(self):
        wallet_str = '{"accounts":{"/x":{"imported":{"LMK1a5LKLkLFCEKukwwTrGxPboNvZjDbcY":["0344b1588589958b0bcab03435061539e9bcf54677c104904044e4f8901f4ebdf5","T8hVerMmMsVnq7mkXpEw4krEhXJ5BZNVv7mb4C7LoV8Ni8iywME1"],"LPRvUteVjy7MwDYro7o6XJ8SzhaYBJQhoM":["04575f52b82f159fa649d2a4c353eb7435f30206f0a6cb9674fbd659f45082c37d559ffd19bea9c0d3b7dcc07a7b79f4cffb76026d5d4dff35341efe99056e22d2","6vHESf1YF8tPdqpGyEiNvibJPRZzKsB4ijYsywkUaz3SfUAnidY"],"LZBc9EVXNXW1aGdrxodATNp9kYeCxufeWb":["0389508c13999d08ffae0f434a085f4185922d64765c0bff2f66e36ad7f745cc5f","T96yXyhXKvujT4sMAPihoJJ2sXNTwDircc7WnT2qqXTdBs433uZ5"]}}},"accounts_expanded":{},"addr_history":{},"pruned_txo":{},"stored_height":489716,"transactions":{},"txi":{},"txo":{},"use_encryption":false,"wallet_type":"imported","winpos-qt":[510,338,840,400]}'
        self._upgrade_storage(wallet_str)

    def test_upgrade_from_client_2_6_4_watchaddresses(self):
        wallet_str = '{"accounts":{"/x":{"imported":{"LXupCaL8GsoAAC3c6ayRuQiF6oKd6jzvF2":[null,null],"LbGiejb64pNXrjPZfiauVkchFQksBnFjrz":[null,null],"Lc2ZerD7r4iMufWnkUFRVoqj8zaUdra9gy":[null,null]}}},"accounts_expanded":{},"addr_history":{},"pruned_txo":{},"stored_height":490038,"transactions":{},"txi":{},"txo":{},"wallet_type":"imported","winpos-qt":[582,425,840,400]}'
        self._upgrade_storage(wallet_str)

    def test_upgrade_from_client_2_6_4_multisig(self):
        wallet_str = '{"accounts":{"0":{"change":[["03d0bcdc86a64cc2024c84853e88985f6f30d3dc3f219b432680c338a3996a89ed","024f326d48aa0a62310590b10522b69d250a2439544aa4dc496f7ba6351e6ebbfe"],["03c0416928528a9aaaee558590447ee63fd33fa497deebefcf363b1af90d867762","03db7de16cd6f3dcd0329a088382652bc3e6b21ee1a732dd9655e192c887ed88a7"],["0291790656844c9d9c24daa344c0b426089eadd3952935c58ce6efe00ef1369828","02c2a5493893643102f77f91cba709f11aaab3e247863311d6fc3d3fc82624c3cc"],["023dc976bd1410a7e9f34c230051db58a3f487763f00df1f529b10f55ee85b931c","036c318a7530eedf3584fd8b24c4024656508e35057a0e7654f21e89e121d0bd30"],["02c8820711b39272e9730a1c5c5c78fe39a642b8097f8724b2592cc987017680ce","0380e3ebe0ea075e33acb3f796ad6548fde86d37c62fe8e4f6ab5d2073c1bb1d43"],["0369a32ddd213677a0509c85af514537d5ee04c68114da3bc720faeb3adb45e6f8","0370e85ac01af5e3fd5a5c3969c8bca3e4fc24efb9f82d34d5790e718a507cecb6"]],"m":2,"receiving":[["0207739a9ff4a643e1d4adb03736ec43d13ec897bdff76b40a25d3a16e19e464aa","02372ea4a291aeb1fadb26f36976348fc169fc70514797e53b789a87c9b27cc568"],["0248ae7671882ec87dd6bacf7eb2ff078558456cf5753952cddb5dde08f471f3d6","035bac54828b383545d7b70824a8be2f2d9584f656bfdc680298a38e9383ed9e51"],["02cb99ba41dfbd510cd25491c12bd0875fe8155b5a6694ab781b42bd949252ff26","03b520feba42149947f8b2bbc7e8c03f9376521f20ac7b7f122dd44ab27309d7c6"],["0395902d5ebb4905edd7c4aedecf17be0675a2ffeb27d85af25451659c05cc5198","02b4a01d4bd25cadcbf49900005e8d5060ed9cdc35eb33f2cd65cc45cc7ebc00c5"],["02f9d06c136f05acc94e4572399f17238bb56fa15271e3cb816ae7bb9be24b00b6","035516437612574b2b563929c49308911651205e7cebb621940742e570518f1c50"],["0376a7de3abaee6631bd4441658987c27e0c7eee2190a86d44841ae718a014ee43","03cb702364ffd59cb92b2e2128c18d8a5a255be2b95eb950641c5f17a5a900eecb"],["03240c5e868ecb02c4879ae5f5bad809439fdbd2825769d75be188e34f6e533a67","026b0d05784e4b4c8193443ce60bea162eee4d99f9dfa94a53ae3bc046a8574eeb"],["02d087cccb7dc457074aa9decc04de5a080757493c6aa12fa5d7d3d389cfdb5b8e","0293ab7d0d8bbb2d433e7521a1100a08d75a32a02be941f731d5809b22d86edb33"],["03d1b83ab13c5b35701129bed42c1f1fbe86dd503181ad66af3f4fb729f46a277e","0382ec5e920bc5c60afa6775952760668af42b67d36d369cd0e9acc17e6d0a930d"],["03f1737db45f3a42aebd813776f179d5724fce9985e715feb54d836020b8517bfe","0287a9dfb8ee2adab81ef98d52acd27c25f558d2a888539f7d583ef8c00c34d6dc"],["038eb8804e433023324c1d439cd5fbbd641ca85eadcfc5a8b038cb833a755dac21","0361a7c80f0d9483c416bc63d62506c3c8d34f6233b6d100bb43b6fe8ec39388b9"],["0336437ada4cd35bec65469afce298fe49e846085949d93ef59bf77e1a1d804e4a","0321898ed89df11fcfb1be44bb326e4bb3272464f000a9e51fb21d25548619d377"],["0260f0e59d6a80c49314d5b5b857d1df64d474aba48a37c95322292786397f3dc6","03acd6c9aeac54c9510304c2c97b7e206bbf5320c1e268a2757d400356a30c627b"],["0373dc423d6ee57fac3b9de5e2b87cf36c21f2469f17f32f5496e9e7454598ba8e","031ddc1f40c8b8bf68117e790e2d18675b57166e9521dff1da44ba368be76555b3"],["031878b39bc6e35b33ceac396b429babd02d15632e4a926be0220ccbd710c7d7b9","025a71cc5009ae07e3e991f78212e99dd5be7adf941766d011197f331ce8c1bed0"],["032d3b42ed4913a134145f004cf105b66ae97a9914c35fb73d37170d37271acfcd","0322adeb83151937ddcd32d5bf2d3ed07c245811d0f7152716f82120f21fb25426"],["0312759ff0441c59cb477b5ec1b22e76a794cd821c13b8900d72e34e9848f088c2","02d868626604046887d128388e86c595483085f86a395d68920e244013b544ef3b"],["038c4d5f49ab08be619d4fed7161c339ea37317f92d36d4b3487f7934794b79df4","03f4afb40ae7f4a886f9b469a81168ad549ad341390ff91ebf043c4e4bfa05ecc1"],["02378b36e9f84ba387f0605a738288c159a5c277bbea2ea70191ade359bc597dbb","029fd6f0ee075a08308c0ccda7ace4ad9107573d2def988c2e207ac1d69df13355"],["02cfecde7f415b0931fc1ec06055ff127e9c3bec82af5e3affb15191bf995ffc1a","02abb7481504173a7aa1b9860915ef62d09a323425f680d71746be6516f0bb4acf"]],"xpubs":["xpub661MyMwAqRbcF4mZnFnBRYGBaiD9aQRp9w2jaPUrDg3Eery5gywV7eFMzQKmNyY1W4m4fUwsinMw1tFhMNEZ9KjNtkUSBHPXdcXBwCg5ctV","xpub661MyMwAqRbcGHU5H41miJ2wXBLYYk4psK7pB5pWyxK6m5EARwLrKtmpnMzP52qGsKZEtjJCyohVEaZTFXbohjVdfpDFifgMBT82EvkFpsW"]}},"accounts_expanded":{},"addr_history":{"M8MTCyJg7xvM64WrGL3foGne5MvAF75N27":[],"M8VSJw8RSouJ12FS6box6EG3RqAQZS9jqj":[],"M8pJwbaYmbqoHvpRs6txtwLKYvCisBKHLx":[],"M9sTefDAkFegU9m3DzNS9Vcs1Q2jgh5HWZ":[],"MApNQT2eV38fmps8UuJAoiSStw79zS33PS":[],"MDB26LjH8vayDnW4vNQSQqVzY3QbkxT8yH":[],"MDEXZyd1ZphZh1WwPzzMSxhDi8iWMui1Uy":[],"MDLvo8YbXZvGrEwR7XafFLtspG7Xx3w18t":[],"MFEiCQjmya9HYamnhTmyMbVjVqaJ2AndJA":[],"MFpMAMTXwAJJ6DgNKbxjFef2QFvVXSdTQQ":[],"MGEkjgbbbswKRw1jAt3jdkpKufa5iREArH":[],"MJrx1vmHaotPXVzBK3z7gNC8Yef61QKkdA":[],"MMpfw9Yje8Q5ChpPpU7WkmFM72Qertt3HS":[],"MQGjLuP8YXbkWA1LbzQKti5mcuqQzGNfH4":[],"MR2TALNBxPESKay28sufyfhzgFjEWLiRqi":[],"MRDnJi1akvrncQBk58QK4Yn1F7F9Xajs3e":[],"MSLdB1rKy999tn4TVJBgQTBZLGV3puZJ9N":[],"MSNXHgiwPpFZjaMo2gp96MoRWA6BJx3XCz":[],"MT1SaJ3VR7M124BXaZtitNchsff8Na2LpH":[],"MTRH3Nh59yfWi7Xhs6mrepM9jYpr8bUVVA":[],"MTSGXYBiCRJCqPZL7vyFZfm4u3ya6E5hyy":[],"MTTX9tXmPgfggnGzo9P2MdH45jHknLnsDu":[],"MWVZmSCTyQMdKJvcyNcJsc7ZZtgQf7FokC":[],"MWY6HZucwQ6chDBXXMgUJmCMDDL1kRkUvG":[],"MWaXqw3xjNnribmFiCg7bmVfdLUMPqjY48":[],"MWb6F6YbmDcMEdXsxwZJJwnxVdnye8V4Rv":[]},"master_private_keys":{"x1/":"xprv9s21ZrQH143K3oPcB2UmMA6Cy9W49HLyW6CDNhQuRcn7tGu1tQ2bn6TLw8HFWbu5oP38Z2fFCo5Q4n3fog4DTqywYqfSDWhYbDgVD1TGZoP"},"master_public_keys":{"x1/":"xpub661MyMwAqRbcGHU5H41miJ2wXBLYYk4psK7pB5pWyxK6m5EARwLrKtmpnMzP52qGsKZEtjJCyohVEaZTFXbohjVdfpDFifgMBT82EvkFpsW","x2/":"xpub661MyMwAqRbcF4mZnFnBRYGBaiD9aQRp9w2jaPUrDg3Eery5gywV7eFMzQKmNyY1W4m4fUwsinMw1tFhMNEZ9KjNtkUSBHPXdcXBwCg5ctV"},"pruned_txo":{},"seed":"turkey weapon legend tower style multiply tomorrow wet like frame leave cash achieve","seed_version":11,"stored_height":490035,"transactions":{},"txi":{},"txo":{},"use_encryption":false,"wallet_type":"2of2","winpos-qt":[610,418,840,400]}'
        self._upgrade_storage(wallet_str)

    def test_upgrade_from_client_2_7_18_seeded(self):
        wallet_str = '{"addr_history":{"LM1x72tu1cxK2Rd911vjnL5RGqHZ4SxXm2":[],"LN6Y5jvDAB55LCQgsDZ9RnQUBwzwxLa1wz":[],"LNTwTJGuiuSavs9GnR3zopnhDCEWrmAAEM":[],"LPcRfQ1riuEt71G1cGd3wYyZb8Vk1EgZSk":[],"LQbsoD3nNFxRRH2xbZSV1TqQpa3XAtaF7u":[],"LR2veweB95P9qMtwcRpUTmH7tobJnSJMV6":[],"LVtebLsDhEoonGFULaPqtGNdbstf2g3w6U":[],"LW11C85q9RTZS2T7EXucJU3GXEA7McE6ca":[],"LW59W11VBkHMxJ4mk1iZtPqXw5YwYoLhp4":[],"LW9UU9pziEgWVEkPYJLDKUzrfWyqhZgpud":[],"LWFtFtXoUW8zF47hepaE5MzWFXeBwyRsNu":[],"LWayJCn7zBKWD59vT4Nkr3as3vZad9y6qu":[],"LWhQQfCt7GJQWmYpmzoD5onfuiHCZmMBf1":[],"LXZXnRhckjBZnJoKoMFLtMpfXk3WgXnAvY":[],"LXgHsjfw33iYnBhiausKyfbQEXeVdJUTsD":[],"LZEwoWtWDdmZ32NRT77ErRWoerM6EvCTAZ":[],"LZwiMKutB2XWsFB4DA9CX9fcfz85mfh39T":[],"Lb23ZpzakE9DNUfZRTtdueiQMvN711HvJq":[],"LcKixsCMsoUs1doXSsvtboMdCAqUwKJwsC":[],"LdNpWyjwv1GSL7WeSYgadrUSNzjzxxeh7g":[],"LdQaWzTiM3nJ6LUT9S9bECixcTcRyhFTPX":[],"LeeTgYp7Jh4gcjQepbdbTbCYToqjbtvEgA":[],"Lf3URyCdWyqVCv6Qw7aKbmW8WjoYRnFjAG":[],"Lf7uTceHusFtLCmLbnNSK3wqRLBc7U6gar":[],"Lfk2ReMeEjyExaNDPMtWgFy8ubdiEURyAV":[],"LiD6rkZBjVoonPQ7L7P2ouNhYJXGJ726Nb":[]},"keystore":{"seed":"giraffe tuition frog desk airport rural since dizzy regular victory mind coconut","type":"bip32","xprv":"xprv9s21ZrQH143K28Jvnpm7hU3xPt18neaDpcpoMKTyi9ewNRg6puJ2RAE5gZNPQ73bbmU9WsagxLQ3a6i2t1M9W289HY9Q5sEzFsLaYq3ZQf3","xpub":"xpub661MyMwAqRbcEcPPtrJ84bzgwuqdC7J5BqkQ9hsbGVBvFE1FNScGxxYZXpC9ncowEe7EZVbAerSypw3wCjrmLmsHeG3RzySw5iEJhAfZaZT"},"pruned_txo":{},"pubkeys":{"change":["033e860b0823ed2bf143594b07031d9d95d35f6e4ad6093ddc3071b8d2760f133f","03f51e8798a1a46266dee899bada3e1517a7a57a8402deeef30300a8918c81889a","0308168b05810f62e3d08c61e3c545ccbdce9af603adbdf23dcc366c47f1c5634c","03d7eddff48be72310347efa93f6022ac261cc33ee0704cdad7b6e376e9f90f574","0287e34a1d3fd51efdc83f946f2060f13065e39e587c347b65a579b95ef2307d45","02df34e258a320a11590eca5f0cb0246110399de28186011e8398ce99dd806854a"],"receiving":["031082ff400cbe517cc2ae37492a6811d129b8fb0a8c6bd083313f234e221527ae","03fac4d7402c0d8b290423a05e09a323b51afebd4b5917964ba115f48ab280ef07","03c0a8c4ab604634256d3cfa350c4b6ca294a4374193055195a46626a6adea920f","03b0bc3112231a9bea6f5382f4324f23b4e2deb5f01a90b0fe006b816367e43958","03a59c08c8e2d66523c888416e89fa1aaec679f7043aa5a9145925c7a80568e752","0346fefc07ab2f38b16c8d979a8ffe05bc9f31dd33291b4130797fa7d78f6e4a35","025eb34724546b3c6db2ee8b59fbc4731bafadac5df51bd9bbb20b456d550ef56e","02b79c26e2eac48401d8a278c63eec84dc5bef7a71fa7ce01a6e333902495272e2","03a3a212462a2b12dc33a89a3e85684f3a02a647db3d7eaae18c029a6277c4f8ac","02d13fc5b57c4d057accf42cc918912221c528907a1474b2c6e1b9ca24c9655c1a","023c87c3ca86f25c282d9e6b8583b0856a4888f46666b413622d72baad90a25221","030710e320e9911ebfc89a6b377a5c2e5ae0ab16b9a3df54baa9dbd3eb710bf03c","03406b5199d34be50725db2fcd440e487d13d1f7611e604db81bb06cdd9077ffa5","0378139461735db84ff4d838eb408b9c124e556cfb6bac571ed6b2d0ec671abd0c","030538379532c476f664d8795c0d8e5d29aea924d964c685ea5c2343087f055a82","02d1b93fa37b824b4842c46ef36e5c50aadbac024a6f066b482be382bec6b41e5a","02d64e92d12666cde831eb21e00079ecfc3c4f64728415cc38f899aca32f1a5558","0347480bf4d321f5dce2fcd496598fbdce19825de6ed5b06f602d66de7155ac1c0","03242e3dfd8c4b6947b0fbb0b314620c0c3758600bb842f0848f991e9a2520a81c","021acadf6300cb7f2cca11c6e1c7e59e3cf923a786f6371c3b85dd6f8b65c68470"]},"seed_version":13,"stored_height":0,"transactions":{},"tx_fees":{},"txi":{},"txo":{},"use_encryption":false,"verified_tx3":{},"wallet_type":"standard","winpos-qt":[709,314,840,405]}'
        self._upgrade_storage(wallet_str)

    def test_upgrade_from_client_2_7_18_importedkeys(self):
        wallet_str = '{"addr_history":{"LMK1a5LKLkLFCEKukwwTrGxPboNvZjDbcY":[],"LPRvUteVjy7MwDYro7o6XJ8SzhaYBJQhoM":[],"LZBc9EVXNXW1aGdrxodATNp9kYeCxufeWb":[]},"keystore":{"keypairs":{"0344b1588589958b0bcab03435061539e9bcf54677c104904044e4f8901f4ebdf5":"T8hVerMmMsVnq7mkXpEw4krEhXJ5BZNVv7mb4C7LoV8Ni8iywME1","0389508c13999d08ffae0f434a085f4185922d64765c0bff2f66e36ad7f745cc5f":"T96yXyhXKvujT4sMAPihoJJ2sXNTwDircc7WnT2qqXTdBs433uZ5","04575f52b82f159fa649d2a4c353eb7435f30206f0a6cb9674fbd659f45082c37d559ffd19bea9c0d3b7dcc07a7b79f4cffb76026d5d4dff35341efe99056e22d2":"6vHESf1YF8tPdqpGyEiNvibJPRZzKsB4ijYsywkUaz3SfUAnidY"},"type":"imported"},"pruned_txo":{},"pubkeys":{"change":[],"receiving":["0344b1588589958b0bcab03435061539e9bcf54677c104904044e4f8901f4ebdf5","0389508c13999d08ffae0f434a085f4185922d64765c0bff2f66e36ad7f745cc5f","04575f52b82f159fa649d2a4c353eb7435f30206f0a6cb9674fbd659f45082c37d559ffd19bea9c0d3b7dcc07a7b79f4cffb76026d5d4dff35341efe99056e22d2"]},"seed_version":13,"stored_height":0,"transactions":{},"tx_fees":{},"txi":{},"txo":{},"use_encryption":false,"verified_tx3":{},"wallet_type":"standard","winpos-qt":[420,312,840,405]}'
        self._upgrade_storage(wallet_str)

    def test_upgrade_from_client_2_7_18_watchaddresses(self):
        wallet_str = '{"addr_history":{"LXupCaL8GsoAAC3c6ayRuQiF6oKd6jzvF2":[],"LbGiejb64pNXrjPZfiauVkchFQksBnFjrz":[],"Lc2ZerD7r4iMufWnkUFRVoqj8zaUdra9gy":[]},"addresses":["LbGiejb64pNXrjPZfiauVkchFQksBnFjrz","Lc2ZerD7r4iMufWnkUFRVoqj8zaUdra9gy","LXupCaL8GsoAAC3c6ayRuQiF6oKd6jzvF2"],"pruned_txo":{},"seed_version":13,"stored_height":0,"transactions":{},"tx_fees":{},"txi":{},"txo":{},"verified_tx3":{},"wallet_type":"imported","winpos-qt":[553,402,840,405]}'
        self._upgrade_storage(wallet_str)

    def test_upgrade_from_client_2_7_18_trezor_singleacc(self):
        wallet_str = '''{"addr_history":{"LM6NBhqWiUD5f2W1WpqLA7MtWiNFjW5Gpf":[],"LNKgMdfRbUZbVNxcoeVHr4nRFp9ULZX4bT":[],"LNRkHQjKykMaazy1PCQnmqeQ71ttwUuuQK":[],"LPYB6U1Tc3Ld2sE3UdUnxbm4Kq5DDkPCEX":[],"LQ6D1vogMEs8fX1r4gixxjCCerbwTX3srN":[],"LQDkeaPgZyTG88UietSqaXKgGthudu92c8":[],"LRmMnkbdJVrssuy5gW8UpLC1zSEFp7omPC":[],"LSgH66JcXMp7k639zdaC4sHwr6t2yTKAwQ":[],"LW1dXPAmnVEZz17PhgQjHvmEV6MUcd6Zhi":[],"LYNthwkLpuYsJ6Ajf8TYRfaaQxqqtYWC1P":[],"LKTPPv5imBVPgTeGBLYbB99NYTnpPpF5wV":[],"LZrSPCcvWHfDaeNCnkFaYL8mzWhm89qZxo":[],"LaxCqVGpuyF5cpwGLw3T28dgZPBUoRcMSZ":[],"LbyEUdYYci1Cj1ejcJYY42xd1nQvM6eiXw":[],"LcFKtey5o4am16ZBPdxV3C7sZxTMyRqyoN":[],"Le1MnHWuYaGxL1fg13WsvNBy98GmHpurMG":[],"Le2qSFZKLGnxXyBnbW9wJaRmZdc6bfBmDG":[],"Les27ji39QbL8cM3ENGRmJ4eHhw1nkrHLf":[],"Lf3SJTKupNcZjw4BbXNJtoP2u36qoUPFJ4":[],"LfrnPoo5Wqudu5n5uiWa1jTVBKCfbNbeG4":[],"Lg57GijtoArWz9YwcyMg6Z4D3HsR6N1tGr":[],"LgUeokVX6eTKtbXNBJv6RheFhLiCzwSPaE":[],"LgahVvDJdYCWTZMzL8xFUUskXak7rKY76R":[],"LggNWLqwSZKAtCqcS5TTR9JPzCxSgoznXZ":[],"LgnpLBMSPN9okS1biMgszNMTbGvkCxAxom":[],"LL5B1VZe55MoSv47bra4E4pwrgNY1zHv1o":[]},"keystore":{"derivation":"m/44'/0'/0'","hw_type":"trezor","label":"trezor1","type":"hardware","xpub":"xpub6BycoSLDNcWjBQMuYgSaEoinupMjma8Cu2uj4XiRCZkecLHXXmzcxbyR1gdfrZpiZDVSs92MEGGNhF78BEbbYi2b5U2oPnaUPRhjriWz85y"},"pruned_txo":{},"pubkeys":{"change":["03143bc04f007c454e03caf9d59b61e27f527b5e6723e167b50197ce45e2071902","03157710459a8213a79060e2f2003fe0eb7a7ed173ac3f846309de52269dd44740","028ec4bbbf4ac9edfabb704bd82acb0840f2166312929ce01af2b2e99059b16dee","021a9f1201968bd835029daf09ae98745a75bcb8c6143b80610cfc2eb2eee94dd8","031fe8323703fee4a1f6c59f27ceed4e227f5643b1cb387b39619b6b5499a971b4","033199fc62b72ce98e3780684e993f31d520f1da0bf2016ed26153b2efcc86ac1d"],"receiving":["03d27c0f5594d8df0616d64a735c909098eb867d01c6f1588f04ca2cf353837ec0","024d299f21e9ee9cc3eb425d04f45110eff46e45abcab24a3e594645860518fb97","03f6bc650e5f118ab4a63359a9cde4ab8382fe16e7d1b36b0a459145a79bef674b","028bed00a2fbd03f1ff43e0150ec1018458f7b39f3e4e602e089b1f47f8f607136","02108b15014d53f2e4e1b5b2d8f5eaf82006bbc4f273dbfbaef91eff08f9d10ea5","02a9a59a529818f3ba7a37ebe34454eac2bcbe4da0e8566b13f369e03bb020c4c4","023fde4ecf7fbdffb679d92f58381066cf2d840d34cb2d8bef63f7c5182d278d53","02ad8bf6dc0ff3c39bd20297d77fbd62073d7bf2fa44bf716cdd026db0819bb2b4","029c8352118800beaef1f3fa9c12afe30d329e7544bea9b136b717b88c24d95d92","02c42c251392674e2c2768ccd6224e04298bd5479436f02e9867ecc288dd2eb066","0316f3c82d9fce97e267b82147d56a4b170d39e6cf01bfaff6c2ae6bcc79a14447","0398554ee8e333061391b3e866505bbc5e130304ae09b198444bcd31c4ba7846ea","02e69d21aadb502e9bd93c5536866eff8ca6b19664545ccc4e77f3508e0cbe2027","0270fb334407a53a23ad449389e2cb055fae5017ca4d79ec8e082038db2d749c50","03d91a8f47453f9da51e0194e3aacff88bf79a625df82ceee73c71f3a7099a5459","0306b2d3fd06c4673cc90374b7db0c152ba7960be382440cecc4cdad7642e0537c","028020dd6062f080e1e2b49ca629faa1407978adab13b74875a9de93b16accf804","03907061c5f6fde367aafe27e1d53b39ff9c2babffe8ab7cf8c3023acba5c39736","029749462dba9af034455f5e0f170aac67fe9365ce7126092b4d24ced979b5381f","02f001d35308833881b3440670d25072256474c6c4061daf729055bf9563134105"]},"seed_version":13,"stored_height":490013,"transactions":{},"tx_fees":{},"txi":{},"txo":{},"use_encryption":false,"verified_tx3":{},"wallet_type":"standard","winpos-qt":[631,410,840,405]}'''
        self._upgrade_storage(wallet_str)

    def test_upgrade_from_client_2_7_18_multisig(self):
        wallet_str = '{"addr_history":{"M8iTqHW9U17j1zjijVThXXfxqhHBz7TQ4y":[],"MA556vEvXjTdHd1F3ot2rk82fTDgr8Rojg":[],"MAKta33xq9CSMtjU8syxb96ZYofnuELHoC":[],"MAPKx3uCbC1muU2KkUcy4uNhbo6Py5i8E2":[],"MAZJaVNv9QEwvfiZRkxiae5Ehw4uYAc6mY":[],"MD7X8goQdbYnshsv3JQK9kMyXi1n3PjF9m":[],"MEH7HaAdVzJLKsL1EsghtP1mwTZTYycTC9":[],"MFUKaTgnm8VozP1dgp7ibEomtSxSkZjj7h":[],"MHdrEtTe6ZYhRQZVP7xJhtvL2STQgSj9E4":[],"MHowdT1zSoakJU56BZmy9v5LZSykw8QTvW":[],"MJFpdBSSMVDiLXiAAa3Pp4gQzH2nkwAV9F":[],"MJSgKNVUsKKPXnWHMxAstHnDwFJ2iayuMr":[],"MKX7i2UF6nrZBvNbmsYinbC2nnhYxXcqkQ":[],"MKwjRkvmdC1oVBfQPe4JGiZ7nZ3tCeknKP":[],"MLsq3htcFJZEqitaV2wKrswghLLeeFXhyu":[],"MMiq3ozJ65DXb9H3c5Dz2jDNBgZm6NJsoQ":[],"MPGiC6fmsepNK2UiXg87fqsQ4ATLdwP9XA":[],"MQ8w3HQnXLtv52DAZ3Ku1L9rTWk7wyhL57":[],"MQV3r2enx2RB1qh22NG3exNQ6DkBfWTWi6":[],"MR8zgx6n9bVqoLxJ56sNMHdw6kMGngptYr":[],"MRFbopHdkBt7STG1nd7QXJdWSP2Dqv3LZa":[],"MRJ3zyLgSB51QXN1VvdijVeoWVQgXUEVEu":[],"MRnwp7RizXiKjTjJS8fGCWP6G6saigQKVZ":[],"MS1wQtmA2436WibMyVjTer6q4asQ3aST6e":[],"MSLfVmYHv4goKXCCvjoS1no4hCf9ghyXXT":[],"MWyi3qouZz8zUzkK8ZPSmGqfctBhoSW7ww":[]},"pruned_txo":{},"pubkeys":{"change":[["031bfbbfb36b5e526bf4d94bfc59f170177b2c821f7d4d4c0e1ee945467fe031a0","03c4664d68e3948e2017c5c55f7c1aec72c1c15686b07875b0f20d5f856ebeb703"],["03c515314e4b695a809d3ba08c20bef00397a0e2df729eaf17b8e082825395e06b","032391d8ab8cad902e503492f1051129cee42dc389231d3cdba60541d70e163244"],["035934f55c09ecec3e8f2aa72407ee7ba3c2f077be08b92a27bc4e81b5e27643fe","0332b121ed13753a1f573feaf4d0a94bf5dd1839b94018844a30490dd501f5f5fb"],["02b1367f7f07cbe1ef2c75ac83845c173770e42518da20efde3239bf988dbff5ac","03f3a8b9033b3545fbe47cab10a6f42c51393ed6e525371e864109f0865a0af43c"],["02e7c25f25ecc17969a664d5225c37ec76184a8843f7a94655f5ed34b97c52445d","030ae4304923e6d8d6cd67324fa4c8bc44827918da24a05f9240df7c91c8e8db8f"],["02deb653a1d54372dbc8656fe0a461d91bcaec18add290ccaa742bdaefdb9ec69b","023c1384f90273e3fc8bc551e71ace8f34831d4a364e56a6e778cd802b7f7965a6"]],"receiving":[["02d978f23dc1493db4daf066201f25092d91d60c4b749ca438186764e6d80e6aa1","02912a8c05d16800589579f08263734957797d8e4bc32ad7411472d3625fd51f10"],["024a4b4f2553d7f4cc2229922387aad70e5944a5266b2feb15f453cedbb5859b13","03f8c6751ee93a0f4afb7b2263982b849b3d4d13c2e30b3f8318908ad148274b4b"],["03cd88a88aabc4b833b4631f4ffb4b9dc4a0845bb7bc3309fab0764d6aa08c4f25","03568901b1f3fb8db05dd5c2092afc90671c3eb8a34b03f08bcfb6b20adf98f1cd"],["030530ffe2e4a41312a41f708febab4408ca8e431ce382c1eedb837901839b550d","024d53412197fc609a6ca6997c6634771862f2808c155723fac03ea89a5379fdcc"],["02de503d2081b523087ca195dbae55bafb27031a918a1cfedbd2c4c0da7d519902","03f4a27a98e41bddb7543bf81a9c53313bf9cfb2c2ebdb6bf96551221d8aecb01a"],["03504bc595ac0d947299759871bfdcf46bcdd8a0590c44a78b8b69f1b152019418","0291f188301773dbc7c1d12e88e3aa86e6d4a88185a896f02852141e10e7e986ab"],["0389c3ab262b7994d2202e163632a264f49dd5f78517e01c9210b6d0a29f524cd4","034bdfa9cc0c6896cb9488329d14903cfe60a2879771c5568adfc452f8dba1b2cb"],["02c55a517c162aae2cb5b36eef78b51aa15040e7293033a5b55ba299e375da297d","027273faf29e922d95987a09c2554229becb857a68112bd139409eb111e7cdb45e"],["02401e62d645dc64d43f77ba1f360b529a4c644ed3fc15b35932edafbaf741e844","02c44cbffc13cb53134354acd18c54c59fa78ec61307e147fa0f6f536fb030a675"],["02194a538f37b388b2b138f73a37d7fbb9a3e62f6b5a00bad2420650adc4fb44d9","03e5cc15d47fcdcf815baa0e15227bc5e6bd8af6cae6add71f724e95bc29714ce5"],["037ebf7b2029c8ea0c1861f98e0952c544a38b9e7caebbf514ff58683063cd0e78","022850577856c810dead8d3d44f28a3b71aaf21cdc682db1beb8056408b1d57d52"],["02aea7537611754fdafd98f341c5a6827f8301eaf98f5710c02f17a07a8938a30e","032fa37659a8365fdae3b293a855c5a692faca687b0875e9720219f9adf4bdb6c2"],["0224b0b8d200238495c58e1bc83afd2b57f9dbb79f9a1fdb40747bebb51542c8d3","03b88cd2502e62b69185b989abb786a57de27431ece4eabb26c934848d8426cbd6"],["032802b0be2a00a1e28e1e29cfd2ad79d36ef936a0ef1c834b0bbe55c1b2673bff","032669b2d80f9110e49d49480acf696b74ecca28c21e7d9c1dd2743104c54a0b13"],["03fcfa90eac92950dd66058bbef0feb153e05a114af94b6843d15200ef7cf9ea4a","023246268fbe8b9a023d9a3fa413f666853bbf92c4c0af47731fdded51751e0c3a"],["020cf5fffe70b174e242f6193930d352c54109578024677c1a13ffce5e1f9e6a29","03cb996663b9c895c3e04689f0cf1473974023fa0d59416be2a0b01ccdaa3cc484"],["03467e4fff9b33c73b0140393bde3b35a3f804bce79eccf9c53a1f76c59b7452bd","03251c2a041e953c8007d9ee838569d6be9eacfbf65857e875d87c32a8123036d8"],["02192e19803bfa6f55748aada33f778f0ebb22a1c573e5e49cba14b6a431ef1c37","02224ce74f1ee47ba6eaaf75618ce2d4768a041a553ee5eb60b38895f3f6de11dc"],["032679be8a73fa5f72d438d6963857bd9e49aef6134041ca950c70b017c0c7d44f","025a8463f1c68e85753bd2d37a640ab586d8259f21024f6173aeed15a23ad4287b"],["03ab0355c95480f0157ae48126f893a6d434aa1341ad04c71517b104f3eda08d3d","02ba4aadba99ae8dc60515b15a087e8763496fcf4026f5a637d684d0d0f8a5f76c"]]},"seed_version":13,"stored_height":0,"transactions":{},"tx_fees":{},"txi":{},"txo":{},"use_encryption":false,"verified_tx3":{},"wallet_type":"2of2","winpos-qt":[523,230,840,405],"x1/":{"seed":"pudding sell evoke crystal try order supply chase fine drive nurse double","type":"bip32","xprv":"xprv9s21ZrQH143K2MK5erSSgeaPA1H7gENYS6grakohkaK2M4tzqo6XAjLoRPcBRW9NbGNpaZN3pdoSKLeiQJwmqdSi3GJWZLnK1Txpbn3zinV","xpub":"xpub661MyMwAqRbcEqPYksyT3nX7i37c5h6PoKcTP9DKJur1DsE9PLQmiXfHGe8RmN538Pj8t3qUQcZXCMrkS5z1uWJ6jf9EptAFbC4Z2nKaEQE"},"x2/":{"type":"bip32","xprv":null,"xpub":"xpub661MyMwAqRbcGYXvLgWjW91feK49GajmPdEarB3Ny8JDduUhzTcEThc8Xs1GyqMR4S7xPHvSq4sbDEFzQh3hjJJFEksUzvnjYnap5RX9o4j"}}'
        self._upgrade_storage(wallet_str)

    # seed_version 13 is ambiguous
    # client 2.7.18 created wallets with an earlier "v13" structure
    # client 2.8.3 created wallets with a later "v13" structure
    # client 2.8.3 did not do a proper clean-slate upgrade
    # the wallet here was created in 2.7.18 with a couple privkeys imported
    # then opened in 2.8.3, after which a few other new privkeys were imported
    # it's in some sense in an "inconsistent" state
    def test_upgrade_from_client_2_8_3_importedkeys_flawed_previous_upgrade_from_2_7_18(self):
        wallet_str = '{"addr_history":{"LPi97srmtCAGmnDT19mHEEypuFU7ZPmHCt":[],"LRNsh5JZXozAztVMYLwPvphJQnhbVzYfgG":[],"LT23mQVLhppQLZRUy7DdLK3e1fQJFz4Vbt":[],"LUNCMmYfrKZiA9LQ1DdoXyeVtvfwJYQa8Y":[],"LVggXanbj1gSSGbgdmvWKEQjR83Si2W5e1":[],"LWxTKXesDErFgjk2zrEczawVLB93XBN17Z":[],"LYoAdYhmN66dmp4CpkNoa3qXKanxmSoSP4":[],"LhmqfQ4ZbweaMMaXANfwyP9oM1UQBhojhc":[],"LLCQHfNXehx4XNVUCrNRWqgSeadK8mKQWj":[]},"addresses":{"change":[],"receiving":["LhmqfQ4ZbweaMMaXANfwyP9oM1UQBhojhc","LLCQHfNXehx4XNVUCrNRWqgSeadK8mKQWj","LWxTKXesDErFgjk2zrEczawVLB93XBN17Z","LUNCMmYfrKZiA9LQ1DdoXyeVtvfwJYQa8Y","LT23mQVLhppQLZRUy7DdLK3e1fQJFz4Vbt","LYoAdYhmN66dmp4CpkNoa3qXKanxmSoSP4","LRNsh5JZXozAztVMYLwPvphJQnhbVzYfgG","LVggXanbj1gSSGbgdmvWKEQjR83Si2W5e1","LPi97srmtCAGmnDT19mHEEypuFU7ZPmHCt"]},"keystore":{"keypairs":{"0206b77fd06f212ad7d85f4a054c231ba4e7894b1773dcbb449671ee54618ff5e9":"TArbxBKsaTdWv9BbGWCX9epXLrjnC4ZWFanJCw6rujWFKuUey6VQ","028cda4a0f03cbcbc695d9cac0858081fd5458acfd29564127d329553245afca42":"T6FyC7SaH97naSFGVgTuiLHs6zd1GGsPjRy9KnTdwCCHZku7rQJr","02ba4117a24d7e38ae14c429fce0d521aa1fb6bb97558a13f1ef2bc0a476a1741f":"T5Go7g1pAjAFuZZyJgN1jFB3GU3hacfgkZU9gbRd6nqVsFmtPMio","031bb44462038b97010624a8f8cb15a10fd0d277f12aba3ccf5ce0d36fc6df3112":"T4btCxDZFwEHjsNrXnSuHQ4yJnqraP1SGcQFTNrD8KEQrrAersDu","0339081c4a0ce22c01aa78a5d025e7a109100d1a35ef0f8f06a0d4c5f9ffefc042":"TAsbJpPLARFcQGdn7gj9CXmR7RsoCiNp11BUWEvpMUQPADjCH2E4","0339ea71aba2805238e636c2f1b3e5a8308b1dbdbb335787c51f2f6bf3f6218643":"T37UvZy7BpAfuSVvKuuymBBHZPPuqt7NHVmEUyvWfqdBHJoxiKkw","04e7dc460c87267cf0958d6904d9cd99a4af0d64d61858636aec7a02e5f9a578d27c1329d5ddc45a937130ed4a59e4147cb4907724321baa6a976f9972a17f79ba":"6uXw5hcm2GUWr4F5dCfMQcoKVC3fhjyUkv7sVtBSFMgFZB63bNt","04e9ad0bf70c51c06c2459961175c47cfec59d58ebef4ffcd9836904ef11230afce03ab5eaac5958b538382195b5aea9bf057c0486079869bb72ef9c958f33f1ed":"6vBtKPt3bPGAxAxWKN2BzGXWitiXPZ1s44gqpQeiQmWCCQYsJeB","04f8cbd67830ab37138c92898a64a4edf836a60aa5b36956547788bd205c635d6a3056fa6a079961384ae336e737d4c45835821c8915dbc5e18a7def88df83946b":"6vjTfW1EKdr13nM9Z7d74sDfKtvwNq67veLWNYVuZyrxDHmTv51"},"type":"imported"},"pruned_txo":{},"pubkeys":{"change":[],"receiving":["04e9ad0bf70c51c06c2459961175c47cfec59d58ebef4ffcd9836904ef11230afce03ab5eaac5958b538382195b5aea9bf057c0486079869bb72ef9c958f33f1ed","0339081c4a0ce22c01aa78a5d025e7a109100d1a35ef0f8f06a0d4c5f9ffefc042","0339ea71aba2805238e636c2f1b3e5a8308b1dbdbb335787c51f2f6bf3f6218643","02ba4117a24d7e38ae14c429fce0d521aa1fb6bb97558a13f1ef2bc0a476a1741f","028cda4a0f03cbcbc695d9cac0858081fd5458acfd29564127d329553245afca42","04e7dc460c87267cf0958d6904d9cd99a4af0d64d61858636aec7a02e5f9a578d27c1329d5ddc45a937130ed4a59e4147cb4907724321baa6a976f9972a17f79ba","04f8cbd67830ab37138c92898a64a4edf836a60aa5b36956547788bd205c635d6a3056fa6a079961384ae336e737d4c45835821c8915dbc5e18a7def88df83946b"]},"seed_version":13,"stored_height":492756,"transactions":{},"tx_fees":{},"txi":{},"txo":{},"use_encryption":false,"verified_tx3":{},"wallet_type":"standard","winpos-qt":[100,100,840,405]}'
        self._upgrade_storage(wallet_str)

    def test_upgrade_from_client_2_8_3_seeded(self):
        wallet_str = '{"addr_history":{"LN6Kx1UXusiWRrEcAeXubLz9ESzGRQwKcu":[],"LNR43kArM5pNJbmdFn7vaTtFdRB7a94V8x":[],"LNtEP1jB9G5N97SqUNy5jTmNgjnDofR2DW":[],"LQUBTpRcThBs6pQthThzYpjF1R85RnLRad":[],"LQqJZQPPFYdrB96MAoH4RZUuV1bEYGQzgB":[],"LRRYfucsma8twKaBtUWPRaiCR9JR5mtDJo":[],"LRxBqPHUptNEYCcYwtJ8XVkn8DdirU1M4J":[],"LTU2hwtLd9SNcCCaJxzZ8frpdUZyVGohou":[],"LU6kF5kDdtqjzaLX53SR7ERDYVPwd9iKfr":[],"LUUeBYaCN3Hqp251jCQKTaPYp9amJpSHML":[],"LVATwguZVKfkaJ2Uw9nR7gtJ141e6pxHCG":[],"LVHCjEp4hgcUFRiWveAdZxBt7X4U8r93F2":[],"LVT957o8LNwH236WdJuMsPYncKzqmrWyJM":[],"LVr8No1SD7gUQDzNwefZihwGwvPTnWxmg2":[],"LXVefEDeBHbmu3dQp1PhXJVcwCLh99DUVe":[],"LbQ7S3ZKsHmEsKKfaWXnpTH5Mxzm3EUigP":[],"LbaogX4HfdcUSNKgjTUtPpQKXwPLVrf6q2":[],"Lbw8HcWVTK1BqsJTkh1jAAWpPoqUSM7h1K":[],"LbyZ9pHdhbXZz7swATm8Qu4gFpcxZCBsFa":[],"LdJ9mwzPKCrNifzfpYqaNPg7cCckHRhfPU":[],"LdaAjjwfuYwLGLFdEy53uTs7myZnG3pQr4":[],"LdzEdvgbj6MwmE2hdPCf8Uf5dJpWVcSqVt":[],"Lgdu2VrU38FsWG9g9xt5QwTGDvEie2hWou":[],"Lh8M4sx9DdcHzhBL5HQuJqPCMyJQdXBFXY":[],"LiGbiacLYSv1eZAThYjwUrTTDpYgvBVvXm":[],"LKdCAhmTjSrkeaqwkVgt2a1td9dkeCBwDX":[]},"addresses":{"change":["LdJ9mwzPKCrNifzfpYqaNPg7cCckHRhfPU","LU6kF5kDdtqjzaLX53SR7ERDYVPwd9iKfr","LXVefEDeBHbmu3dQp1PhXJVcwCLh99DUVe","LRRYfucsma8twKaBtUWPRaiCR9JR5mtDJo","LiGbiacLYSv1eZAThYjwUrTTDpYgvBVvXm","LRxBqPHUptNEYCcYwtJ8XVkn8DdirU1M4J"],"receiving":["LdaAjjwfuYwLGLFdEy53uTs7myZnG3pQr4","LbyZ9pHdhbXZz7swATm8Qu4gFpcxZCBsFa","Lbw8HcWVTK1BqsJTkh1jAAWpPoqUSM7h1K","LNtEP1jB9G5N97SqUNy5jTmNgjnDofR2DW","Lh8M4sx9DdcHzhBL5HQuJqPCMyJQdXBFXY","LQUBTpRcThBs6pQthThzYpjF1R85RnLRad","LTU2hwtLd9SNcCCaJxzZ8frpdUZyVGohou","Lgdu2VrU38FsWG9g9xt5QwTGDvEie2hWou","LbQ7S3ZKsHmEsKKfaWXnpTH5Mxzm3EUigP","LVHCjEp4hgcUFRiWveAdZxBt7X4U8r93F2","LbaogX4HfdcUSNKgjTUtPpQKXwPLVrf6q2","LdzEdvgbj6MwmE2hdPCf8Uf5dJpWVcSqVt","LVr8No1SD7gUQDzNwefZihwGwvPTnWxmg2","LNR43kArM5pNJbmdFn7vaTtFdRB7a94V8x","LUUeBYaCN3Hqp251jCQKTaPYp9amJpSHML","LN6Kx1UXusiWRrEcAeXubLz9ESzGRQwKcu","LVATwguZVKfkaJ2Uw9nR7gtJ141e6pxHCG","LKdCAhmTjSrkeaqwkVgt2a1td9dkeCBwDX","LVT957o8LNwH236WdJuMsPYncKzqmrWyJM","LQqJZQPPFYdrB96MAoH4RZUuV1bEYGQzgB"]},"keystore":{"seed":"novel clay width echo swing blanket absorb salute asset under ginger final","type":"bip32","xprv":"xprv9s21ZrQH143K2jfFF6ektPj6zCCsDGGjQxhD2FQ21j6yrA1piWWEjch2kf1smzB2rzm8rPkdJuHf3vsKqMX9ogtE2A7JF49qVUHrgtjRymM","xpub":"xpub661MyMwAqRbcFDjiM8BmFXfqYE3McizanBcopdoda4dxixLyG3pVHR1WbwgjLo9RL882KRfpfpxh7a7zXPogDdR4xj9TpJWJGsbwaodLSKe"},"pruned_txo":{},"seed_type":"standard","seed_version":13,"stored_height":0,"transactions":{},"tx_fees":{},"txi":{},"txo":{},"use_encryption":false,"verified_tx3":{},"wallet_type":"standard","winpos-qt":[100,100,840,405]}'
        self._upgrade_storage(wallet_str)

    def test_upgrade_from_client_2_8_3_importedkeys(self):
        wallet_str = '{"addr_history":{"LMK1a5LKLkLFCEKukwwTrGxPboNvZjDbcY":[],"LPRvUteVjy7MwDYro7o6XJ8SzhaYBJQhoM":[],"LZBc9EVXNXW1aGdrxodATNp9kYeCxufeWb":[]},"addresses":{"change":[],"receiving":["LMK1a5LKLkLFCEKukwwTrGxPboNvZjDbcY","LZBc9EVXNXW1aGdrxodATNp9kYeCxufeWb","LPRvUteVjy7MwDYro7o6XJ8SzhaYBJQhoM"]},"keystore":{"keypairs":{"0344b1588589958b0bcab03435061539e9bcf54677c104904044e4f8901f4ebdf5":"T8hVerMmMsVnq7mkXpEw4krEhXJ5BZNVv7mb4C7LoV8Ni8iywME1","0389508c13999d08ffae0f434a085f4185922d64765c0bff2f66e36ad7f745cc5f":"T96yXyhXKvujT4sMAPihoJJ2sXNTwDircc7WnT2qqXTdBs433uZ5","04575f52b82f159fa649d2a4c353eb7435f30206f0a6cb9674fbd659f45082c37d559ffd19bea9c0d3b7dcc07a7b79f4cffb76026d5d4dff35341efe99056e22d2":"6vHESf1YF8tPdqpGyEiNvibJPRZzKsB4ijYsywkUaz3SfUAnidY"},"type":"imported"},"pruned_txo":{},"seed_version":13,"stored_height":0,"transactions":{},"tx_fees":{},"txi":{},"txo":{},"use_encryption":false,"verified_tx3":{},"wallet_type":"standard","winpos-qt":[100,100,840,405]}'
        self._upgrade_storage(wallet_str)

    def test_upgrade_from_client_2_8_3_watchaddresses(self):
        wallet_str = '{"addr_history":{"LXupCaL8GsoAAC3c6ayRuQiF6oKd6jzvF2":[],"LbGiejb64pNXrjPZfiauVkchFQksBnFjrz":[],"Lc2ZerD7r4iMufWnkUFRVoqj8zaUdra9gy":[]},"addresses":["LbGiejb64pNXrjPZfiauVkchFQksBnFjrz","Lc2ZerD7r4iMufWnkUFRVoqj8zaUdra9gy","LXupCaL8GsoAAC3c6ayRuQiF6oKd6jzvF2"],"pruned_txo":{},"seed_version":13,"stored_height":0,"transactions":{},"tx_fees":{},"txi":{},"txo":{},"verified_tx3":{},"wallet_type":"imported","winpos-qt":[535,380,840,405]}'
        self._upgrade_storage(wallet_str)

    def test_upgrade_from_client_2_8_3_trezor_singleacc(self):
        wallet_str = '''{"addr_history":{"LM6NBhqWiUD5f2W1WpqLA7MtWiNFjW5Gpf":[],"LNKgMdfRbUZbVNxcoeVHr4nRFp9ULZX4bT":[],"LNRkHQjKykMaazy1PCQnmqeQ71ttwUuuQK":[],"LPYB6U1Tc3Ld2sE3UdUnxbm4Kq5DDkPCEX":[],"LQ6D1vogMEs8fX1r4gixxjCCerbwTX3srN":[],"LQDkeaPgZyTG88UietSqaXKgGthudu92c8":[],"LRmMnkbdJVrssuy5gW8UpLC1zSEFp7omPC":[],"LSgH66JcXMp7k639zdaC4sHwr6t2yTKAwQ":[],"LW1dXPAmnVEZz17PhgQjHvmEV6MUcd6Zhi":[],"LYNthwkLpuYsJ6Ajf8TYRfaaQxqqtYWC1P":[],"LKTPPv5imBVPgTeGBLYbB99NYTnpPpF5wV":[],"LZrSPCcvWHfDaeNCnkFaYL8mzWhm89qZxo":[],"LaxCqVGpuyF5cpwGLw3T28dgZPBUoRcMSZ":[],"LbyEUdYYci1Cj1ejcJYY42xd1nQvM6eiXw":[],"LcFKtey5o4am16ZBPdxV3C7sZxTMyRqyoN":[],"Le1MnHWuYaGxL1fg13WsvNBy98GmHpurMG":[],"Le2qSFZKLGnxXyBnbW9wJaRmZdc6bfBmDG":[],"Les27ji39QbL8cM3ENGRmJ4eHhw1nkrHLf":[],"Lf3SJTKupNcZjw4BbXNJtoP2u36qoUPFJ4":[],"LfrnPoo5Wqudu5n5uiWa1jTVBKCfbNbeG4":[],"Lg57GijtoArWz9YwcyMg6Z4D3HsR6N1tGr":[],"LgUeokVX6eTKtbXNBJv6RheFhLiCzwSPaE":[],"LgahVvDJdYCWTZMzL8xFUUskXak7rKY76R":[],"LggNWLqwSZKAtCqcS5TTR9JPzCxSgoznXZ":[],"LgnpLBMSPN9okS1biMgszNMTbGvkCxAxom":[],"LL5B1VZe55MoSv47bra4E4pwrgNY1zHv1o":[]},"addresses":{"change":["LKTPPv5imBVPgTeGBLYbB99NYTnpPpF5wV","LNRkHQjKykMaazy1PCQnmqeQ71ttwUuuQK","LL5B1VZe55MoSv47bra4E4pwrgNY1zHv1o","LQ6D1vogMEs8fX1r4gixxjCCerbwTX3srN","LgnpLBMSPN9okS1biMgszNMTbGvkCxAxom","Le2qSFZKLGnxXyBnbW9wJaRmZdc6bfBmDG"],"receiving":["Lf3SJTKupNcZjw4BbXNJtoP2u36qoUPFJ4","LSgH66JcXMp7k639zdaC4sHwr6t2yTKAwQ","LRmMnkbdJVrssuy5gW8UpLC1zSEFp7omPC","LM6NBhqWiUD5f2W1WpqLA7MtWiNFjW5Gpf","LPYB6U1Tc3Ld2sE3UdUnxbm4Kq5DDkPCEX","Les27ji39QbL8cM3ENGRmJ4eHhw1nkrHLf","Le1MnHWuYaGxL1fg13WsvNBy98GmHpurMG","Lg57GijtoArWz9YwcyMg6Z4D3HsR6N1tGr","LNKgMdfRbUZbVNxcoeVHr4nRFp9ULZX4bT","LgahVvDJdYCWTZMzL8xFUUskXak7rKY76R","LfrnPoo5Wqudu5n5uiWa1jTVBKCfbNbeG4","LW1dXPAmnVEZz17PhgQjHvmEV6MUcd6Zhi","LggNWLqwSZKAtCqcS5TTR9JPzCxSgoznXZ","LgUeokVX6eTKtbXNBJv6RheFhLiCzwSPaE","LcFKtey5o4am16ZBPdxV3C7sZxTMyRqyoN","LQDkeaPgZyTG88UietSqaXKgGthudu92c8","LYNthwkLpuYsJ6Ajf8TYRfaaQxqqtYWC1P","LZrSPCcvWHfDaeNCnkFaYL8mzWhm89qZxo","LaxCqVGpuyF5cpwGLw3T28dgZPBUoRcMSZ","LbyEUdYYci1Cj1ejcJYY42xd1nQvM6eiXw"]},"keystore":{"derivation":"m/44'/0'/0'","hw_type":"trezor","label":"trezor1","type":"hardware","xpub":"xpub6BycoSLDNcWjBQMuYgSaEoinupMjma8Cu2uj4XiRCZkecLHXXmzcxbyR1gdfrZpiZDVSs92MEGGNhF78BEbbYi2b5U2oPnaUPRhjriWz85y"},"pruned_txo":{},"seed_version":13,"stored_height":0,"transactions":{},"tx_fees":{},"txi":{},"txo":{},"use_encryption":false,"verified_tx3":{},"wallet_type":"standard","winpos-qt":[744,390,840,405]}'''
        self._upgrade_storage(wallet_str)

    def test_upgrade_from_client_2_8_3_multisig(self):
        wallet_str = '{"addr_history":{"M8ctQHXVVKtLrAA3mxeVxm1NTE1cLB59XX":[],"M9MjGfzbLhG6rHx6oFAfQTH37L4xroiVcz":[],"MATQSjQ83bPmmN4evNjgyR6fsRYVXUEi91":[],"MBQZMaSbCMtfYvnz5C3TBv9eLxCnuAwdtH":[],"MCD17Vk9Mi963MFmno2FudHpbomsE8n6tg":[],"MD7KcHAefXo1iXKshXvwWPeSJwakELozTJ":[],"MDzb25LEUsrpB49Z5eZebiUpwAfDTdhHtS":[],"MG4Cq6BdRB9UAeQSW1FHkQNtghrMnk1uBk":[],"MHRyZgxKv6pYb1UiX5gtJjnbbPkHpKKpva":[],"MJULeKhS5gb5LRNi1dHPToemPNRgMxbtnj":[],"MKQX6Z75kdCJawKiBHcrV9J7FJqh7uwJPD":[],"MKbqx7ZsXupa2xJjHfVaqawTJvVGsBwAtX":[],"MLrWcB6QVc9pm3gvUTYFqzGy7ELqNssXpx":[],"MMihRhiMugYhee5zPFqV9z7gUqTc7xNtbj":[],"MMmkJ7f7EkHGoDvviCTbcakYUx3kaW27wz":[],"MNSqiAspU6bctowoEu3BiUChYuTgFZcjn1":[],"MPWHPoNuTDhnbjySnMexWTsSZf4VZvHbPj":[],"MPomfP6HNxS4BDZKU9iLHrDrjFQjyCUA8q":[],"MQK6j8ZaxDFogS5RrRjzHahsT2fozuLaWx":[],"MQPjjvgtf3emVPcX1Eud2Y68YpEEbFDHw5":[],"MRaesUHUAJkvoW5ydxbw4Kz3sUdpGiN3pS":[],"MRcECLeZhXJB8DtWR8CjgLbBWS2odKRiga":[],"MS4PbVaxKRQAiFY7KSkN7HjUgWLWHxMjFd":[],"MSahuQZubuBUPrECZHmjYGhKpadgx4KiVK":[],"MTCsUjFdfUzMrxicc1U9wEZjXmoAbFyUZa":[],"MV4wNuMYrQm7icJGTmXVeQbCGDdhZeabe9":[]},"addresses":{"change":["MATQSjQ83bPmmN4evNjgyR6fsRYVXUEi91","MTCsUjFdfUzMrxicc1U9wEZjXmoAbFyUZa","MNSqiAspU6bctowoEu3BiUChYuTgFZcjn1","MV4wNuMYrQm7icJGTmXVeQbCGDdhZeabe9","MQPjjvgtf3emVPcX1Eud2Y68YpEEbFDHw5","MJULeKhS5gb5LRNi1dHPToemPNRgMxbtnj"],"receiving":["MCD17Vk9Mi963MFmno2FudHpbomsE8n6tg","MMihRhiMugYhee5zPFqV9z7gUqTc7xNtbj","MKbqx7ZsXupa2xJjHfVaqawTJvVGsBwAtX","MPomfP6HNxS4BDZKU9iLHrDrjFQjyCUA8q","MRcECLeZhXJB8DtWR8CjgLbBWS2odKRiga","MBQZMaSbCMtfYvnz5C3TBv9eLxCnuAwdtH","MPWHPoNuTDhnbjySnMexWTsSZf4VZvHbPj","MMmkJ7f7EkHGoDvviCTbcakYUx3kaW27wz","MG4Cq6BdRB9UAeQSW1FHkQNtghrMnk1uBk","MSahuQZubuBUPrECZHmjYGhKpadgx4KiVK","M8ctQHXVVKtLrAA3mxeVxm1NTE1cLB59XX","M9MjGfzbLhG6rHx6oFAfQTH37L4xroiVcz","MLrWcB6QVc9pm3gvUTYFqzGy7ELqNssXpx","MHRyZgxKv6pYb1UiX5gtJjnbbPkHpKKpva","MKQX6Z75kdCJawKiBHcrV9J7FJqh7uwJPD","MRaesUHUAJkvoW5ydxbw4Kz3sUdpGiN3pS","MDzb25LEUsrpB49Z5eZebiUpwAfDTdhHtS","MS4PbVaxKRQAiFY7KSkN7HjUgWLWHxMjFd","MD7KcHAefXo1iXKshXvwWPeSJwakELozTJ","MQK6j8ZaxDFogS5RrRjzHahsT2fozuLaWx"]},"pruned_txo":{},"seed_version":13,"stored_height":0,"transactions":{},"tx_fees":{},"txi":{},"txo":{},"use_encryption":false,"verified_tx3":{},"wallet_type":"2of2","winpos-qt":[671,238,840,405],"x1/":{"seed":"property play install hill hunt follow trash comic pulse consider canyon limit","type":"bip32","xprv":"xprv9s21ZrQH143K46tCjDh5i4H9eSJpnMrYyLUbVZheTbNjiamdxPiffMEYLgxuYsMFokFrNEZ6S6z5wSXXszXaCVQWf6jzZvn14uYZhsnM9Sb","xpub":"xpub661MyMwAqRbcGaxfqFE65CDtCU9KBpaQLZQCHx7G1vuibP6nVw2vD9Z2Bz2DsH43bDZGXjmcvx2TD9wq3CmmFcoT96RCiDd1wMSUB2UH7Gu"},"x2/":{"type":"bip32","xprv":null,"xpub":"xpub661MyMwAqRbcEncvVc1zrPFZSKe7iAP1LTRhzxuXpmztu1kTtnfj8XNFzzmGH1X1gcGxczBZ3MmYKkxXgZKJCsNXXdasNaQJKJE4KcUjn1L"}}'
        self._upgrade_storage(wallet_str)

    def test_upgrade_from_client_2_9_3_seeded(self):
        wallet_str = '{"addr_history":{"LLT9wyJ9BLXsA7riHYi75ZFfxDZxS32oAG":[],"LLwNKFZDfjbB8jkWnzqPF2r3XsBxHu3mHF":[],"LMWQH2yLhZ7VnHx9RF6CpvZPd8ySV5Lanh":[],"LMyDQiayPVgAxmtmfU1B9Mh98GwozAPdCj":[],"LNgcK42YMxmW9FADVuhx4Bm3sWCPTPydxX":[],"LNuiTArKDn23okCnUaHLdUQMfVrvjvjMnU":[],"LPUEAWEFxY956wMN7H8E8ctRpFiM528kSn":[],"LS2GG9wz7M29h2S2Vp9TCVGr1ppHuMvQeL":[],"LSvKsf3Q55rUdtzBmoEjEqDEt2j5NEo9CF":[],"LT16eUG1pRZFXWKDZLCXWrcdvEa9vWyQz8":[],"LTo6Pmy4jeTRr1dsodhym6SvXADh7b69Av":[],"LUCzzEYAvFv65DpGn7BWA4EyBXnQ5evfQJ":[],"LUGUhzEAVatT2jTH9ktAYmF7jMvbPaECbC":[],"LKRixTwrG2FkQYPoRxHxLw6ujam1EHbQAf":[],"LY8mxubJfda3rZL5udixMexVzEXUsqGaNP":[],"LYHvweg8uAa6ACDiTKpC3V6749vk1g26k1":[],"LagAhx4KgpAdpysLSWV8jBS3WPz5YsDTXU":[],"Lajnx2mXFZgtJguqH3C6cS29jck4ago9vq":[],"Lavj6A9GKjrtdVL1KwHeqyCPYAkhyZoFVE":[],"LcJQigi9nbtkUxu6GSjBv2HnETs8jtLNPR":[],"LcjviD3pPN7HiHAn1dYbBwU6NLBwJJrSXZ":[],"LddFDqGsV8XDm9yUf2J37EDNZXtth3N4UF":[],"Le2upsurQXvsBXxP95pt4cJzNKUC6NQTuK":[],"Le4SVbqTuFnyVQe2jkDd2sDpNF79ngHorT":[],"LgE4ERkNimLfKxjMydnoSM23rNqtG5pPYc":[],"Lhz5ZQ1pYxTtuD6V2un762Kd4HByp4QwXB":[]},"addresses":{"change":["Lavj6A9GKjrtdVL1KwHeqyCPYAkhyZoFVE","LagAhx4KgpAdpysLSWV8jBS3WPz5YsDTXU","LPUEAWEFxY956wMN7H8E8ctRpFiM528kSn","LUGUhzEAVatT2jTH9ktAYmF7jMvbPaECbC","LUCzzEYAvFv65DpGn7BWA4EyBXnQ5evfQJ","LcjviD3pPN7HiHAn1dYbBwU6NLBwJJrSXZ"],"receiving":["LNuiTArKDn23okCnUaHLdUQMfVrvjvjMnU","LMWQH2yLhZ7VnHx9RF6CpvZPd8ySV5Lanh","LTo6Pmy4jeTRr1dsodhym6SvXADh7b69Av","LcJQigi9nbtkUxu6GSjBv2HnETs8jtLNPR","Lhz5ZQ1pYxTtuD6V2un762Kd4HByp4QwXB","LMyDQiayPVgAxmtmfU1B9Mh98GwozAPdCj","LddFDqGsV8XDm9yUf2J37EDNZXtth3N4UF","LLT9wyJ9BLXsA7riHYi75ZFfxDZxS32oAG","LLwNKFZDfjbB8jkWnzqPF2r3XsBxHu3mHF","LNgcK42YMxmW9FADVuhx4Bm3sWCPTPydxX","Le4SVbqTuFnyVQe2jkDd2sDpNF79ngHorT","LS2GG9wz7M29h2S2Vp9TCVGr1ppHuMvQeL","LYHvweg8uAa6ACDiTKpC3V6749vk1g26k1","LSvKsf3Q55rUdtzBmoEjEqDEt2j5NEo9CF","Le2upsurQXvsBXxP95pt4cJzNKUC6NQTuK","LT16eUG1pRZFXWKDZLCXWrcdvEa9vWyQz8","LKRixTwrG2FkQYPoRxHxLw6ujam1EHbQAf","LY8mxubJfda3rZL5udixMexVzEXUsqGaNP","Lajnx2mXFZgtJguqH3C6cS29jck4ago9vq","LgE4ERkNimLfKxjMydnoSM23rNqtG5pPYc"]},"keystore":{"seed":"cereal wise two govern top pet frog nut rule sketch bundle logic","type":"bip32","xprv":"xprv9s21ZrQH143K29XjRjUs6MnDB9wXjXbJP2kG1fnRk8zjdDYWqVkQYUqaDtgZp5zPSrH5PZQJs8sU25HrUgT1WdgsPU8GbifKurtMYg37d4v","xpub":"xpub661MyMwAqRbcEdcCXm1sTViwjBn28zK9kFfrp4C3JUXiW1sfP34f6HA45B9yr7EH5XGzWuTfMTdqpt9XPrVQVUdgiYb5NW9m8ij1FSZgGBF"},"pruned_txo":{},"seed_type":"standard","seed_version":13,"stored_height":-1,"transactions":{},"tx_fees":{},"txi":{},"txo":{},"use_encryption":false,"verified_tx3":{},"wallet_type":"standard","winpos-qt":[619,310,840,405]}'
        self._upgrade_storage(wallet_str)

    @testnet_wallet
    def test_upgrade_from_client_2_9_3_old_seeded_with_realistic_history(self):
        wallet_str = '{"addr_history":{"mfxZoA5dHaVn6QiHMbRwQTQUB7VFpZQFW4":[["8361b8f56b1ba8d9b59d5ef4547fe7203859e0c3107bc131b83fc1db12a11471",1446399]],"mgSZfzhK7VDj7MQRxjRLSC7FSESskDKsrN":[],"mgaArVGf5heGUko1i24wYrvkfFcN442U4v":[["76bcf540b27e75488d95913d0950624511900ae291a37247c22d996bb7cde0b4",1251084]],"mhBod4XkgRs3orfynhDGR7gLkDuD23tHKP":[],"mhgErkPdC6BP5h6JAQ7nw2EfNerepQB8QL":[],"mhwQ9cxhAxaED747XuzgUo3F39MDc6txHr":[["8361b8f56b1ba8d9b59d5ef4547fe7203859e0c3107bc131b83fc1db12a11471",1446399]],"mjUYaF2jPsTWYEUWidQiKuqnHDRh49Q95W":[],"mjWMtS2NZvAcZLdHGanWrsVwnyYEtBr9si":[],"mk8xgq5ubvpXQKFNNeMzYpy25G5zSQ6Vtc":[],"mmL4aJtiAPVUQca9AaZZdPUht9FvS2eb4a":[["e87a207ff3f3d2601fd086e90fa81a8ecb9c15e6974e649d53b9ebc2b087af25",1297404],["e453e7346693b507561691b5ea73f8eba60bfc8998056226df55b2fac88ba306",1297610]],"mnFrzrrgj65VAynUzzhnuSkrrWwivtR7a2":[],"mnQ53GF9oa4njpWswsnmUQ9A4Hif8ct86q":[],"mo2ougmAzBmvQW5iJCojfi7n2Rt7RaRtGc":[],"mp2CafXnWnN8rR6BnFToVQ8bXNY4jnAecr":[["e453e7346693b507561691b5ea73f8eba60bfc8998056226df55b2fac88ba306",1297610]],"mp9iZVBSUokAUX1p57Kjc4mHrtqqEhxjrh":[["0f4972c84974b908a58dda2614b68cf037e6c03e8291898c719766f213217b67",1230168],["72419d187c61cfc67a011095566b374dc2c01f5397e36eafe68e40fc44474112",1230191]],"mpEGnkPKtMyfHo8EaUFks7xFZJdSgLjnC7":[["3a6ed17d34c49dfdf413398e113cf5f71710d59e9f4050bbc601d513a77eb308",1231594]],"mpHhM9knUvMLHjhy7kDjXuEKV72hM6FzuK":[],"mpg6Y3SCPa8CSDYdzA7GEx855Zxg3ZhasV":[],"mpmDNEsBXxRC55RpqKpqSEy37edNzSx9Cw":[],"mq9piav8nf5yw9pJt4bsob7mpngw6EK8Bx":[],"mqA4SNeHJtqUmxXWsmddweawM9DRRGVMuN":[],"mqEq8T5ktH1E9RbVramCwAXnrUa8EdzZrk":[],"mqSpdctdWV7gdiXWEJVgkt7yMoL8FSVtLB":[],"mqYXSDuvMpdibxUy6ftKW1564L9UE5eeFX":[["336eee749da7d1c537fd5679157fae63005bfd4bb8cf47ae73600999cbc9beaa",1242088],["c1433779c5faec5df5e7bdc51214a95f15deeab842c23efbdde3acf82c165462",1242088]],"mqvJJCT4WHQHQvj7bvCNQDdHdr9WjCPMaH":[],"mrHCUTD63vsP9K3oon2AWZ9bKjqDhd5PMm":[["475c149be20c8a73596fad6cb8861a5af46d4fcf8e26a9dbf6cedff7ff80b70d",1281357],["e87a207ff3f3d2601fd086e90fa81a8ecb9c15e6974e649d53b9ebc2b087af25",1297404]],"mrdUepR2frXufJH5zeHEQZRVbYiAjVNufo":[],"msgSKRJY9y8GPFsDpsnso23RQbEWFY2DJL":[],"mt2ijtY7BUkQRpErd99N9131YgsEL7oBSt":[["e07bf0498d40d7b8d7933b1049dd54a1b21b7c5f6d8def98b0997e22761e0968",1231594],["3a6ed17d34c49dfdf413398e113cf5f71710d59e9f4050bbc601d513a77eb308",1231594]],"mtPuWkAj3cYHj4xoDYYL4yJ5tTckeXb6go":[],"mupBXEDhWQnrmyW4TukDs2qcqQrhRJGrQd":[["a29d131e766950cae2e97dd4527b7c050293c2f5630470bdd7d00b7fe6db1b9d",1230163],["0f4972c84974b908a58dda2614b68cf037e6c03e8291898c719766f213217b67",1230168],["6ae728f783b0d4680ed8050c05419f0a89dfd6e28d46acfce7453b4d1b2b0254",1230626],["31494e7e9f42f4bd736769b07cc602e2a1019617b2c72a03ec945b667aada78f",1230627],["9de08bcafc602a3d2270c46cbad1be0ef2e96930bec3944739089f960652e7cb",1255526]],"muwtzEGtaACt6KrLxwdu8itbfsKo8WerW7":[],"mvJ2vrvNySAXWxVYuCn2tX6amyfchFGHvK":[["c2595a521111eb0298e183e0a74befc91f6f93b03e2f7d43c7ad63a9196f7e3a",1251074],["475c149be20c8a73596fad6cb8861a5af46d4fcf8e26a9dbf6cedff7ff80b70d",1281357]],"mvXwR94pXVgP7kdrW3vTiDQtVrkP3NY3zn":[["c1433779c5faec5df5e7bdc51214a95f15deeab842c23efbdde3acf82c165462",1242088]],"mvbi7ywmFLL8FLrcn7XEYATbn1kBeeNbzx":[],"mwNWMKSGou8ZJzXgfDaAUy1C8Jip3TEmdf":[["e453e7346693b507561691b5ea73f8eba60bfc8998056226df55b2fac88ba306",1297610],["8361b8f56b1ba8d9b59d5ef4547fe7203859e0c3107bc131b83fc1db12a11471",1446399]],"mweezhmgY1kEvmSNpfrqdLcd6NHekupXKp":[["c1433779c5faec5df5e7bdc51214a95f15deeab842c23efbdde3acf82c165462",1242088],["2d216451b20b6501e927d85244bcc1c7c70598332717df91bb571359c358affd",1251055]],"mwzAXyVfyG5mcGKAQANs67M3HhENmu2Uh2":[],"mx1KFACmoAA2EedMAcoQ4ed5dRtsh3ow4L":[],"mxTwRCnJgafjVaUVLsniWZPpXhz5dFzRyb":[["7f19935daa7347bdcf45f0bfd726dd665c514ffd49dfb035369813a54c1e5d1a",1230624],["6ae728f783b0d4680ed8050c05419f0a89dfd6e28d46acfce7453b4d1b2b0254",1230626]],"myJLELfyhG1Fu7iPyfpHfviVCQuLwsNCBm":[["a29d131e766950cae2e97dd4527b7c050293c2f5630470bdd7d00b7fe6db1b9d",1230163],["0f4972c84974b908a58dda2614b68cf037e6c03e8291898c719766f213217b67",1230168]],"mycxtgambuph71Hg6MdwRoF7c7GkFvHiZ6":[["c1fa83595c4c117da834569cba81d84d30ebf99fbdc96535f6e8afd5550e48b9",1323966],["8361b8f56b1ba8d9b59d5ef4547fe7203859e0c3107bc131b83fc1db12a11471",1446399]],"myunReLavjcSN8mWUn3jqhirHWYiok51jU":[],"myvhXvymTD4Ncgfg8r2WXiTZeDY3TtZGUY":[["56a65810186f82132cea35357819499468e4e376fca685c023700c75dc3bd216",1231595],["c1433779c5faec5df5e7bdc51214a95f15deeab842c23efbdde3acf82c165462",1242088]],"mywTRsN56GipUEbmCnoUV9YFdrUU5CmUxd":[["0f4972c84974b908a58dda2614b68cf037e6c03e8291898c719766f213217b67",1230168],["72419d187c61cfc67a011095566b374dc2c01f5397e36eafe68e40fc44474112",1230191]],"mzeE9KrQrsfqYAuTN5EJXcs91rUJU8Y8Bb":[],"mzrXKAWzbctb6Ee1LkbXLmdsNhPtLucUkw":[],"n1Hjparfsp2c4yCZ72KbotNcY84XLS73jj":[],"n1gdKukb5TUu37x5GahHsp4Gp2fdowdZPH":[["e07bf0498d40d7b8d7933b1049dd54a1b21b7c5f6d8def98b0997e22761e0968",1231594],["c1433779c5faec5df5e7bdc51214a95f15deeab842c23efbdde3acf82c165462",1242088]],"n1yXnvBc7giip11h2D2NX3azXqhasAeFeM":[],"n23NSQfgAmVaW1qE1kgnxkW8JvWfveAktH":[["3a6ed17d34c49dfdf413398e113cf5f71710d59e9f4050bbc601d513a77eb308",1231594]],"n3JYuxqhKja3QcJG3sm4yKTmZUBpTbVQyP":[],"n4FfEQrf1PS3no7FCPhhDugxqgR4fUSvdX":[["2791cdc98570cc2b6d9d5b197dc2d002221b074101e3becb19fab4b79150446d",1231593],["e07bf0498d40d7b8d7933b1049dd54a1b21b7c5f6d8def98b0997e22761e0968",1231594]],"n4g4z5GRAWXXcx5f3m7Cyyek9LRRPHcuJy":[]},"addresses":{"change":["mywTRsN56GipUEbmCnoUV9YFdrUU5CmUxd","mt2ijtY7BUkQRpErd99N9131YgsEL7oBSt","n23NSQfgAmVaW1qE1kgnxkW8JvWfveAktH","mvXwR94pXVgP7kdrW3vTiDQtVrkP3NY3zn","mrHCUTD63vsP9K3oon2AWZ9bKjqDhd5PMm","mmL4aJtiAPVUQca9AaZZdPUht9FvS2eb4a","mp2CafXnWnN8rR6BnFToVQ8bXNY4jnAecr","mhwQ9cxhAxaED747XuzgUo3F39MDc6txHr","n1yXnvBc7giip11h2D2NX3azXqhasAeFeM","mpmDNEsBXxRC55RpqKpqSEy37edNzSx9Cw","msgSKRJY9y8GPFsDpsnso23RQbEWFY2DJL","mhBod4XkgRs3orfynhDGR7gLkDuD23tHKP","mvbi7ywmFLL8FLrcn7XEYATbn1kBeeNbzx","mzeE9KrQrsfqYAuTN5EJXcs91rUJU8Y8Bb"],"receiving":["mupBXEDhWQnrmyW4TukDs2qcqQrhRJGrQd","myJLELfyhG1Fu7iPyfpHfviVCQuLwsNCBm","mp9iZVBSUokAUX1p57Kjc4mHrtqqEhxjrh","n4FfEQrf1PS3no7FCPhhDugxqgR4fUSvdX","n1gdKukb5TUu37x5GahHsp4Gp2fdowdZPH","mpEGnkPKtMyfHo8EaUFks7xFZJdSgLjnC7","myvhXvymTD4Ncgfg8r2WXiTZeDY3TtZGUY","mqYXSDuvMpdibxUy6ftKW1564L9UE5eeFX","mweezhmgY1kEvmSNpfrqdLcd6NHekupXKp","mvJ2vrvNySAXWxVYuCn2tX6amyfchFGHvK","mxTwRCnJgafjVaUVLsniWZPpXhz5dFzRyb","mgaArVGf5heGUko1i24wYrvkfFcN442U4v","mycxtgambuph71Hg6MdwRoF7c7GkFvHiZ6","mgSZfzhK7VDj7MQRxjRLSC7FSESskDKsrN","mwNWMKSGou8ZJzXgfDaAUy1C8Jip3TEmdf","mqSpdctdWV7gdiXWEJVgkt7yMoL8FSVtLB","n4g4z5GRAWXXcx5f3m7Cyyek9LRRPHcuJy","mqvJJCT4WHQHQvj7bvCNQDdHdr9WjCPMaH","n1Hjparfsp2c4yCZ72KbotNcY84XLS73jj","mfxZoA5dHaVn6QiHMbRwQTQUB7VFpZQFW4","mjWMtS2NZvAcZLdHGanWrsVwnyYEtBr9si","mhgErkPdC6BP5h6JAQ7nw2EfNerepQB8QL","mx1KFACmoAA2EedMAcoQ4ed5dRtsh3ow4L","myunReLavjcSN8mWUn3jqhirHWYiok51jU","mrdUepR2frXufJH5zeHEQZRVbYiAjVNufo","mk8xgq5ubvpXQKFNNeMzYpy25G5zSQ6Vtc","mqEq8T5ktH1E9RbVramCwAXnrUa8EdzZrk","mq9piav8nf5yw9pJt4bsob7mpngw6EK8Bx","mpHhM9knUvMLHjhy7kDjXuEKV72hM6FzuK","mwzAXyVfyG5mcGKAQANs67M3HhENmu2Uh2","mnQ53GF9oa4njpWswsnmUQ9A4Hif8ct86q","mpg6Y3SCPa8CSDYdzA7GEx855Zxg3ZhasV","mo2ougmAzBmvQW5iJCojfi7n2Rt7RaRtGc","mzrXKAWzbctb6Ee1LkbXLmdsNhPtLucUkw","mnFrzrrgj65VAynUzzhnuSkrrWwivtR7a2","muwtzEGtaACt6KrLxwdu8itbfsKo8WerW7","n3JYuxqhKja3QcJG3sm4yKTmZUBpTbVQyP","mqA4SNeHJtqUmxXWsmddweawM9DRRGVMuN","mjUYaF2jPsTWYEUWidQiKuqnHDRh49Q95W","mtPuWkAj3cYHj4xoDYYL4yJ5tTckeXb6go"]},"keystore":{"mpk":"e9d4b7866dd1e91c862aebf62a49548c7dbf7bcc6e4b7b8c9da820c7737968df9c09d5a3e271dc814a29981f81b3faaf2737b551ef5dcc6189cf0f8252c442b3","seed":"acb740e454c3134901d7c8f16497cc1c","type":"old"},"pruned_txo":{},"seed_type":"old","seed_version":13,"stored_height":1482542,"transactions":{"0f4972c84974b908a58dda2614b68cf037e6c03e8291898c719766f213217b67":"01000000029d1bdbe67f0bd0d7bd700463f5c29302057c7b52d47de9e2ca5069761e139da2000000008b483045022100a146a2078a318c1266e42265a369a8eef8993750cb3faa8dd80754d8d541d5d202207a6ab8864986919fd1a7fd5854f1e18a8a0431df924d7a878ec3dc283e3d75340141045f7ba332df2a7b4f5d13f246e307c9174cfa9b8b05f3b83410a3c23ef8958d610be285963d67c7bc1feb082f168fa9877c25999963ff8b56b242a852b23e25edfeffffff9d1bdbe67f0bd0d7bd700463f5c29302057c7b52d47de9e2ca5069761e139da2010000008a47304402201c7fa37b74a915668b0244c01f14a9756bbbec1031fb69390bcba236148ab37e02206151581f9aa0e6758b503064c1e661a726d75c6be3364a5a121a8c12cf618f64014104dc28da82e141416aaf771eb78128d00a55fdcbd13622afcbb7a3b911e58baa6a99841bfb7b99bcb7e1d47904fda5d13fdf9675cdbbe73e44efcc08165f49bac6feffffff02b0183101000000001976a914ca14915184a2662b5d1505ce7142c8ca066c70e288ac005a6202000000001976a9145eb4eeaefcf9a709f8671444933243fbd05366a388ac54c51200","2791cdc98570cc2b6d9d5b197dc2d002221b074101e3becb19fab4b79150446d":"010000000132201ff125888a326635a2fc6e971cd774c4d0c1a757d742d0f6b5b020f7203a050000006a47304402201d20bb5629a35b84ff9dd54788b98e265623022894f12152ac0e6158042550fe02204e98969e1f7043261912dd0660d3da64e15acf5435577fc02a00eccfe76b323f012103a336ad86546ab66b6184238fe63bb2955314be118b32fa45dd6bd9c4c5875167fdffffff0254959800000000001976a9148d2db0eb25b691829a47503006370070bc67400588ac80969800000000001976a914f96669095e6df76cfdf5c7e49a1909f002e123d088ace8ca1200","2d216451b20b6501e927d85244bcc1c7c70598332717df91bb571359c358affd":"01000000036cdf8d2226c57d7cc8485636d8e823c14790d5f24e6cf38ba9323babc7f6db2901000000171600143fc0dbdc2f939c322aed5a9c3544468ec17f5c3efdffffff507dce91b2a8731636e058ccf252f02b5599489b624e003435a29b9862ccc38c0200000017160014c50ff91aa2a790b99aa98af039ae1b156e053375fdffffff6254162cf8ace3ddfb3ec242b8eade155fa91412c5bde7f55decfac5793743c1010000008b483045022100de9599dcd7764ca8d4fcbe39230602e130db296c310d4abb7f7ae4d139c4d46402200fbfd8e6dc94d90afa05b0c0eab3b84feb465754db3f984fbf059447282771c30141045eecefd39fabba7b0098c3d9e85794e652bdbf094f3f85a3de97a249b98b9948857ea1e8209ee4f196a6bbcfbad103a38698ee58766321ba1cdee0cbfb60e7b2fdffffff01e85af70100000000160014e8d29f07cd5f813317bec4defbef337942d85d74ed161300","31494e7e9f42f4bd736769b07cc602e2a1019617b2c72a03ec945b667aada78f":"010000000454022b1b4d3b45e7fcac468de2d6df890a9f41050c05d80e68d4b083f728e76a000000008b483045022100ea8fe74db2aba23ad36ac66aaa481bad2b4d1b3c331869c1d60a28ce8cfad43c02206fa817281b33fbf74a6dd7352bdc5aa1d6d7966118a4ad5b7e153f37205f1ae80141045f7ba332df2a7b4f5d13f246e307c9174cfa9b8b05f3b83410a3c23ef8958d610be285963d67c7bc1feb082f168fa9877c25999963ff8b56b242a852b23e25edfdffffff54022b1b4d3b45e7fcac468de2d6df890a9f41050c05d80e68d4b083f728e76a01000000171600146dfe07e12af3db7c715bf1c455f8517e19c361e7fdffffff54022b1b4d3b45e7fcac468de2d6df890a9f41050c05d80e68d4b083f728e76a020000006a47304402200b1fb89e9a772a8519294acd61a53a29473ce76077165447f49a686f1718db5902207466e2e8290f84114dc9d6c56419cb79a138f03d7af8756de02c810f19e4e03301210222bfebe09c2638cfa5aa8223fb422fe636ba9675c5e2f53c27a5d10514f49051fdffffff54022b1b4d3b45e7fcac468de2d6df890a9f41050c05d80e68d4b083f728e76a0300000000fdffffff018793140d000000001600144b3e27ddf4fc5f367421ee193da5332ef351b70022c71200","336eee749da7d1c537fd5679157fae63005bfd4bb8cf47ae73600999cbc9beaa":"010000000232201ff125888a326635a2fc6e971cd774c4d0c1a757d742d0f6b5b020f7203a020000006a4730440220198c0ba2b2aefa78d8cca01401d408ecdebea5ac05affce36f079f6e5c8405ca02200eabb1b9a01ff62180cf061dfacedba6b2e07355841b9308de2d37d83489c7b80121031c663e5534fe2a6de816aded6bb9afca09b9e540695c23301f772acb29c64a05fdfffffffb28ff16811d3027a2405be68154be8fdaff77284dbce7a2314c4107c2c941600000000000fdffffff015e104f01000000001976a9146dfd56a0b5d0c9450d590ad21598ecfeaa438bd788ac79f31200","3a6ed17d34c49dfdf413398e113cf5f71710d59e9f4050bbc601d513a77eb308":"010000000168091e76227e99b098ef8d6d5f7c1bb2a154dd49103b93d7b8d7408d49f07be0000000008a47304402202f683a63af571f405825066bd971945a35e7142a75c9a5255d364b25b7115d5602206c59a7214ae729a519757e45fdc87061d357813217848cf94df74125221267ac014104aecb9d427e10f0c370c32210fe75b6e72ccc4f415076cf1a6318fbed5537388862c914b29269751ab3a04962df06d96f5f4f54e393a0afcbfa44b590385ae61afdffffff0240420f00000000001976a9145f917fd451ca6448978ebb2734d2798274daf00b88aca8063d00000000001976a914e1232622a96a04f5e5a24ca0792bb9c28b089d6e88ace9ca1200","475c149be20c8a73596fad6cb8861a5af46d4fcf8e26a9dbf6cedff7ff80b70d":"01000000013a7e6f19a963adc7437d2f3eb0936f1fc9ef4ba7e083e19802eb1111525a59c2000000008b483045022100958d3931051306489d48fe69b32561e0a16e82a2447c07be9d1069317084b5e502202f70c2d9be8248276d334d07f08f934ffeea83977ad241f9c2de954a2d577f94014104d950039cec15ad10ad4fb658873bc746148bc861323959e0c84bf10f8633104aa90b64ce9f80916ab0a4238e025dcddf885b9a2dd6e901fe043a433731db8ab4fdffffff02a086010000000000160014bbfab2cc3267cea2df1b68c392cb3f0294978ca922940d00000000001976a914760f657c67273a06cad5b1d757a95f4ed79f5a4b88ac4c8d1300","56a65810186f82132cea35357819499468e4e376fca685c023700c75dc3bd216":"0100000001614b142aeeb827d35d2b77a5b11f16655b6776110ddd9f34424ff49d85706cf90200000000fdffffff02784a4c00000000001600148464f47f35cbcda2e4e5968c5a3a862c43df65a1404b4c00000000001976a914c9efecf0ecba8b42dce0ae2b28e3ea0573d351c988ace9ca1200","6ae728f783b0d4680ed8050c05419f0a89dfd6e28d46acfce7453b4d1b2b0254":"010000000496941b9f18710b39bacde890e39a7fa401e6bf49985857cb7adfb8a45147ef1e000000001716001441aec99157d762708339d7faf7a63a8c479ed84cfdffffff96941b9f18710b39bacde890e39a7fa401e6bf49985857cb7adfb8a45147ef1e0100000000fdffffff1a5d1e4ca513983635b0df49fd4f515c66dd26d7bff045cfbd4773aa5d93197f000000006a4730440220652145460092ef42452437b942cb3f563bf15ad90d572d0b31d9f28449b7a8dd022052aae24f58b8f76bd2c9cf165cc98623f22870ccdbef1661b6dbe01c0ef9010f01210375b63dd8e93634bbf162d88b25d6110b5f5a9638f6fe080c85f8b21c2199a1fdfdffffff1a5d1e4ca513983635b0df49fd4f515c66dd26d7bff045cfbd4773aa5d93197f010000008a47304402207517c52b241e6638a84b05385e0b3df806478c2e444f671ca34921f6232ee2e70220624af63d357b83e3abe7cdf03d680705df0049ec02f02918ee371170e3b4a73d014104de408e142c00615294813233cdfe9e7774615ae25d18ba4a1e3b70420bb6666d711464518457f8b947034076038c6f0cfc8940d85d3de0386e0ad88614885c7cfdffffff0480969800000000001976a9149cd3dfb0d87a861770ae4e268e74b45335cf00ab88ac809698000000000017a914f2a76207d7b54bd34282281205923841341d9e1f87002d3101000000001976a914b8d4651937cd7db5bcf5fc98e6d2d8cfa131e85088ac743db20a00000000160014c7d0df09e03173170aed0247243874c6872748ed20c71200","72419d187c61cfc67a011095566b374dc2c01f5397e36eafe68e40fc44474112":"0100000002677b2113f26697718c8991823ec0e637f08cb61426da8da508b97449c872490f000000008b4830450221009c50c0f56f34781dfa7b3d540ac724436c67ffdc2e5b2d5a395c9ebf72116ef802205a94a490ea14e4824f36f1658a384aeaecadd54839600141eb20375a49d476d1014104c291245c2ee3babb2a35c39389df56540867f93794215f743b9aa97f5ba114c4cdee8d49d877966728b76bc649bb349efd73adef1d77452a9aac26f8c51ae1ddfdffffff677b2113f26697718c8991823ec0e637f08cb61426da8da508b97449c872490f010000008b483045022100ae0b286493491732e7d3f91ab4ac4cebf8fe8a3397e979cb689e62d350fdcf2802206cf7adf8b29159dd797905351da23a5f6dab9b9dbf5028611e86ccef9ff9012e014104c62c4c4201d5c6597e5999f297427139003fdb82e97c2112e84452d1cfdef31f92dd95e00e4d31a6f5f9af0dadede7f6f4284b84144e912ff15531f36358bda7fdffffff019f7093030000000022002027ce908c4ee5f5b76b4722775f23e20c5474f459619b94040258290395b88afb6ec51200","76bcf540b27e75488d95913d0950624511900ae291a37247c22d996bb7cde0b4":"0100000001f4ba9948cdc4face8315c7f0819c76643e813093ffe9fbcf83d798523c7965db000000006a473044022061df431a168483d144d4cffe1c5e860c0a431c19fc56f313a899feb5296a677c02200208474cc1d11ad89b9bebec5ec00b1e0af0adaba0e8b7f28eed4aaf8d409afb0121039742bf6ab70f12f6353e9455da6ed88f028257950450139209b6030e89927997fdffffff01d4f84b00000000001976a9140b93db89b6bf67b5c2db3370b73d806f458b3d0488ac0a171300","7f19935daa7347bdcf45f0bfd726dd665c514ffd49dfb035369813a54c1e5d1a":"0100000002681b6a8dd3a406ee10e4e4aece3c2e69f6680c02f53157be6374c5c98322823a00000000232200209adfa712053a06cc944237148bcefbc48b16eb1dbdc43d1377809bcef1bea9affdffffff681b6a8dd3a406ee10e4e4aece3c2e69f6680c02f53157be6374c5c98322823a0100000023220020f40ed2e3fbffd150e5b74f162c3ce5dae0dfeba008a7f0f8271cf1cf58bfb442fdffffff02801d2c04000000001976a9140cc01e19090785d629cdcc98316f328df554de4f88ac6d455d05000000001976a914b9e828990a8731af4527bcb6d0cddf8d5ffe90ce88ac1fc71200","8361b8f56b1ba8d9b59d5ef4547fe7203859e0c3107bc131b83fc1db12a11471":"0100000002b9480e55d5afe8f63565c9bd9ff9eb304dd881ba9c5634a87d114c5c5983fac1000000008b483045022100acc3f465902feed13f7358626003c517b2b659007b8876e401ee6933c034b7f80220309eae30631d444a3fca218edbae04e6e2f3492958f31bb8b8f762c02974e671014104d2416bae1a485b6e1ef78d30b41ce1acff13da94f53897c3847f004bc5f87237f53e2fc8d56073cd7a3d3932b2a10eff9cc5e4a4da52f1ad445806c1f8b986e0fdffffff06a38bc8fab255df2662059889fc0ba6ebf873eab591165607b5936634e753e4000000008b48304502210099e11a4e861963e50b2536bfd3d0d70e5faf17e758717a1d36e78973638ba8f802204435f2b0664e0bc95c54d21520696391911d6aaa11dfcbc613c51f594e884680014104861473a447374a30387cca4548dd6462d9526b44beb1029b5f074a5fa8f09e01d21dbae1599aae3f9221e5ed830df7bae69caf4565e50471e34d51801d9a588afdffffff02f0230000000000001976a9141a8fd125d7d6728c0d84bd7b9f6f16442eef776988aca0860100000000001976a91404d808d10acfd7f6dcf81f88912ccf7285ed447688acfe111600","9de08bcafc602a3d2270c46cbad1be0ef2e96930bec3944739089f960652e7cb":"01000000013409c10fd732d9e4b3a9a1c4beb511fa5eb32bc51fd169102a21aa8519618f800000000000fdffffff0640420f00000000001976a9149cd3dfb0d87a861770ae4e268e74b45335cf00ab88ac40420f00000000001976a9149cd3dfb0d87a861770ae4e268e74b45335cf00ab88ac40420f00000000001976a9149cd3dfb0d87a861770ae4e268e74b45335cf00ab88ac80841e00000000001976a9149cd3dfb0d87a861770ae4e268e74b45335cf00ab88ac64064a000000000016001469825d422ca80f2a5438add92d741c7df45211f280969800000000001976a9149cd3dfb0d87a861770ae4e268e74b45335cf00ab88ac65281300","a29d131e766950cae2e97dd4527b7c050293c2f5630470bdd7d00b7fe6db1b9d":"010000000400899af3606e93106a5d0f470e4e2e480dfc2fd56a7257a1f0f4d16fd5961a0f000000006a47304402205b32a834956da303f6d124e1626c7c48a30b8624e33f87a2ae04503c87946691022068aa7f936591fb4b3272046634cf526e4f8a018771c38aff2432a021eea243b70121034bb61618c932b948b9593d1b506092286d9eb70ea7814becef06c3dfcc277d67fdffffff4bc2dcc375abfc7f97d8e8c482f4c7b8bc275384f5271678a32c35d955170753000000006b483045022100de775a580c6cb47061d5a00c6739033f468420c5719f9851f32c6992610abd3902204e6b296e812bb84a60c18c966f6166718922780e6344f243917d7840398eb3db0121025d7317c6910ad2ad3d29a748c7796ddf01e4a8bc5e3bf2a98032f0a20223e4aafdffffff4bc2dcc375abfc7f97d8e8c482f4c7b8bc275384f5271678a32c35d955170753010000006a4730440220615a26f38bf6eb7043794c08fb81f273896b25783346332bec4de8dfaf7ed4d202201c2bc4515fc9b07ded5479d5be452c61ce785099f5e33715e9abd4dbec410e11012103caa46fcb1a6f2505bf66c17901320cc2378057c99e35f0630c41693e97ebb7cffdffffff4bc2dcc375abfc7f97d8e8c482f4c7b8bc275384f5271678a32c35d955170753030000006b483045022100c8fba762dc50041ee3d5c7259c01763ed913063019eefec66678fb8603624faa02200727783ccbdbda8537a6201c63e30c0b2eb9afd0e26cb568d885e6151ef2a8540121027254a862a288cfd98853161f575c49ec0b38f79c3ef0bf1fb89986a3c36a8906fdffffff0240787d01000000001976a9149cd3dfb0d87a861770ae4e268e74b45335cf00ab88ac3bfc1502000000001976a914c30f2af6a79296b6531bf34dba14c8419be8fb7d88ac52c51200","c1433779c5faec5df5e7bdc51214a95f15deeab842c23efbdde3acf82c165462":"0100000003aabec9cb99096073ae47cfb84bfd5b0063ae7f157956fd37c5d1a79d74ee6e33000000008b4830450221008136fc880d5e24fdd9d2a43f5085f374fef013b814f625d44a8075104981d92a0220744526ec8fc7887c586968f22403f0180d54c9b7ff8db9b553a3c4497982e8250141047b8b4c91c5a93a1f2f171c619ca41770427aa07d6de5130c3ba23204b05510b3bd58b7a1b35b9c4409104cfe05e1677fc8b51c03eac98b206e5d6851b31d2368fdffffff16d23bdc750c7023c085a6fc76e3e468944919783535ea2c13826f181058a656010000008a47304402204148410f2d796b1bb976b83904167d28b65dcd7c21b3876022b4fa70abc86280022039ea474245c3dc8cd7e5a572a155df7a6a54496e50c73d9fed28e76a1cf998c00141044702781daed201e35aa07e74d7bda7069e487757a71e3334dc238144ad78819de4120d262e8488068e16c13eea6092e3ab2f729c13ef9a8c42136d6365820f7dfdffffff68091e76227e99b098ef8d6d5f7c1bb2a154dd49103b93d7b8d7408d49f07be0010000008b4830450221008228af51b61a4ee09f58b4a97f204a639c9c9d9787f79b2fc64ea54402c8547902201ed81fca828391d83df5fbd01a3fa5dd87168c455ed7451ba8ccb5bf06942c3b0141046fcdfab26ac08c827e68328dbbf417bbe7577a2baaa5acc29d3e33b3cc0c6366df34455a9f1754cb0952c48461f71ca296b379a574e33bcdbb5ed26bad31220bfdffffff0210791c00000000001976a914a4b991e7c72996c424fe0215f70be6aa7fcae22c88ac80c3c901000000001976a914b0f6e64ea993466f84050becc101062bb502b4e488ac7af31200","c1fa83595c4c117da834569cba81d84d30ebf99fbdc96535f6e8afd5550e48b9":"01000000014f86fabb180a955cd9f304aca1917d5dc08f1fbf0be501d1fc2c76ab60d5f56e0000000000fdffffff01a6250000000000001976a914c695421e5fe3cf96c75410ed160418dbda96dbc588acbd331400","c2595a521111eb0298e183e0a74befc91f6f93b03e2f7d43c7ad63a9196f7e3a":"01000000018557003cb450f53922f63740f0f77db892ef27e15b2614b56309bfcee96a0ad3010000006a473044022041923c905ae4b5ed9a21aa94c60b7dbcb8176d58d1eb1506d9fb1e293b65ce01022015d6e9d2e696925c6ad46ce97cc23dec455defa6309b839abf979effc83b8b160121029332bf6bed07dcca4be8a5a9d60648526e205d60c75a21291bffcdefccafdac3fdffffff01c01c0f00000000001976a914a2185918aa1006f96ed47897b8fb620f28a1b09988ac01171300","e07bf0498d40d7b8d7933b1049dd54a1b21b7c5f6d8def98b0997e22761e0968":"01000000016d445091b7b4fa19cbbee30141071b2202d0c27d195b9d6d2bcc7085c9cd9127010000008b483045022100daf671b52393af79487667eddc92ebcc657e8ae743c387b25d1c1a2e19c7a4e7022015ef2a52ea7e94695de8898821f9da539815775516f18329896e5fc52a3563b30141041704a3daafaace77c8e6e54cf35ed27d0bf9bb8bcd54d1b955735ff63ec54fe82a80862d455c12e739108b345d585014bf6aa0cbd403817c89efa18b3c06d6b5fdffffff02144a4c00000000001976a9148942ac692ace81019176c4fb0ac408b18b49237f88ac404b4c00000000001976a914dd36d773acb68ac1041bc31b8a40ee504b164b2e88ace9ca1200","e453e7346693b507561691b5ea73f8eba60bfc8998056226df55b2fac88ba306":"010000000125af87b0c2ebb9539d644e97e6159ccb8e1aa80fe986d01f60d2f3f37f207ae8010000008b483045022100baed0747099f7b28a5624005d50adf1069120356ac68c471a56c511a5bf6972b022046fbf8ec6950a307c3c18ca32ad2955c559b0d9bbd9ec25b64f4806f78cadf770141041ea9afa5231dc4d65a2667789ebf6806829b6cf88bfe443228f95263730b7b70fb8b00b2b33777e168bcc7ad8e0afa5c7828842794ce3814c901e24193700f6cfdffffff02a0860100000000001976a914ade907333744c953140355ff60d341cedf7609fd88ac68830a00000000001976a9145d48feae4c97677e4ca7dcd73b0d9fd1399c962b88acc9cc1300","e87a207ff3f3d2601fd086e90fa81a8ecb9c15e6974e649d53b9ebc2b087af25":"01000000010db780fff7dfcef6dba9268ecf4f6df45a1a86b86cad6f59738a0ce29b145c47010000008a47304402202887ec6ec200e4e2b4178112633011cbdbc999e66d398b1ff3998e23f7c5541802204964bd07c0f18c48b7b9c00fbe34c7bc035efc479e21a4fa196027743f06095f0141044f1714ed25332bb2f74be169784577d0838aa66f2374f5d8cbbf216063626822d536411d13cbfcef1ff3cc1d58499578bc4a3c4a0be2e5184b2dd7963ef67713fdffffff02a0860100000000001600145bbdf3ba178f517d4812d286a40c436a9088076e6a0b0c00000000001976a9143fc16bef782f6856ff6638b1b99e4d3f863581d388acfbcb1300"},"tx_fees":{},"txi":{"0f4972c84974b908a58dda2614b68cf037e6c03e8291898c719766f213217b67":{"mupBXEDhWQnrmyW4TukDs2qcqQrhRJGrQd":[["a29d131e766950cae2e97dd4527b7c050293c2f5630470bdd7d00b7fe6db1b9d:0",25000000]],"myJLELfyhG1Fu7iPyfpHfviVCQuLwsNCBm":[["a29d131e766950cae2e97dd4527b7c050293c2f5630470bdd7d00b7fe6db1b9d:1",34995259]]},"2791cdc98570cc2b6d9d5b197dc2d002221b074101e3becb19fab4b79150446d":{},"2d216451b20b6501e927d85244bcc1c7c70598332717df91bb571359c358affd":{"mweezhmgY1kEvmSNpfrqdLcd6NHekupXKp":[["c1433779c5faec5df5e7bdc51214a95f15deeab842c23efbdde3acf82c165462:1",30000000]]},"31494e7e9f42f4bd736769b07cc602e2a1019617b2c72a03ec945b667aada78f":{"mupBXEDhWQnrmyW4TukDs2qcqQrhRJGrQd":[["6ae728f783b0d4680ed8050c05419f0a89dfd6e28d46acfce7453b4d1b2b0254:0",10000000]]},"336eee749da7d1c537fd5679157fae63005bfd4bb8cf47ae73600999cbc9beaa":{},"3a6ed17d34c49dfdf413398e113cf5f71710d59e9f4050bbc601d513a77eb308":{"mt2ijtY7BUkQRpErd99N9131YgsEL7oBSt":[["e07bf0498d40d7b8d7933b1049dd54a1b21b7c5f6d8def98b0997e22761e0968:0",4999700]]},"475c149be20c8a73596fad6cb8861a5af46d4fcf8e26a9dbf6cedff7ff80b70d":{"mvJ2vrvNySAXWxVYuCn2tX6amyfchFGHvK":[["c2595a521111eb0298e183e0a74befc91f6f93b03e2f7d43c7ad63a9196f7e3a:0",990400]]},"56a65810186f82132cea35357819499468e4e376fca685c023700c75dc3bd216":{},"6ae728f783b0d4680ed8050c05419f0a89dfd6e28d46acfce7453b4d1b2b0254":{"mxTwRCnJgafjVaUVLsniWZPpXhz5dFzRyb":[["7f19935daa7347bdcf45f0bfd726dd665c514ffd49dfb035369813a54c1e5d1a:1",89998701]]},"72419d187c61cfc67a011095566b374dc2c01f5397e36eafe68e40fc44474112":{"mp9iZVBSUokAUX1p57Kjc4mHrtqqEhxjrh":[["0f4972c84974b908a58dda2614b68cf037e6c03e8291898c719766f213217b67:1",40000000]],"mywTRsN56GipUEbmCnoUV9YFdrUU5CmUxd":[["0f4972c84974b908a58dda2614b68cf037e6c03e8291898c719766f213217b67:0",19994800]]},"76bcf540b27e75488d95913d0950624511900ae291a37247c22d996bb7cde0b4":{},"7f19935daa7347bdcf45f0bfd726dd665c514ffd49dfb035369813a54c1e5d1a":{},"8361b8f56b1ba8d9b59d5ef4547fe7203859e0c3107bc131b83fc1db12a11471":{"mwNWMKSGou8ZJzXgfDaAUy1C8Jip3TEmdf":[["e453e7346693b507561691b5ea73f8eba60bfc8998056226df55b2fac88ba306:0",100000]],"mycxtgambuph71Hg6MdwRoF7c7GkFvHiZ6":[["c1fa83595c4c117da834569cba81d84d30ebf99fbdc96535f6e8afd5550e48b9:0",9638]]},"9de08bcafc602a3d2270c46cbad1be0ef2e96930bec3944739089f960652e7cb":{},"a29d131e766950cae2e97dd4527b7c050293c2f5630470bdd7d00b7fe6db1b9d":{},"c1433779c5faec5df5e7bdc51214a95f15deeab842c23efbdde3acf82c165462":{"mqYXSDuvMpdibxUy6ftKW1564L9UE5eeFX":[["336eee749da7d1c537fd5679157fae63005bfd4bb8cf47ae73600999cbc9beaa:0",21958750]],"myvhXvymTD4Ncgfg8r2WXiTZeDY3TtZGUY":[["56a65810186f82132cea35357819499468e4e376fca685c023700c75dc3bd216:1",5000000]],"n1gdKukb5TUu37x5GahHsp4Gp2fdowdZPH":[["e07bf0498d40d7b8d7933b1049dd54a1b21b7c5f6d8def98b0997e22761e0968:1",5000000]]},"c1fa83595c4c117da834569cba81d84d30ebf99fbdc96535f6e8afd5550e48b9":{},"c2595a521111eb0298e183e0a74befc91f6f93b03e2f7d43c7ad63a9196f7e3a":{},"e07bf0498d40d7b8d7933b1049dd54a1b21b7c5f6d8def98b0997e22761e0968":{"n4FfEQrf1PS3no7FCPhhDugxqgR4fUSvdX":[["2791cdc98570cc2b6d9d5b197dc2d002221b074101e3becb19fab4b79150446d:1",10000000]]},"e453e7346693b507561691b5ea73f8eba60bfc8998056226df55b2fac88ba306":{"mmL4aJtiAPVUQca9AaZZdPUht9FvS2eb4a":[["e87a207ff3f3d2601fd086e90fa81a8ecb9c15e6974e649d53b9ebc2b087af25:1",789354]]},"e87a207ff3f3d2601fd086e90fa81a8ecb9c15e6974e649d53b9ebc2b087af25":{"mrHCUTD63vsP9K3oon2AWZ9bKjqDhd5PMm":[["475c149be20c8a73596fad6cb8861a5af46d4fcf8e26a9dbf6cedff7ff80b70d:1",889890]]}},"txo":{"0f4972c84974b908a58dda2614b68cf037e6c03e8291898c719766f213217b67":{"mp9iZVBSUokAUX1p57Kjc4mHrtqqEhxjrh":[[1,40000000,false]],"mywTRsN56GipUEbmCnoUV9YFdrUU5CmUxd":[[0,19994800,false]]},"2791cdc98570cc2b6d9d5b197dc2d002221b074101e3becb19fab4b79150446d":{"n4FfEQrf1PS3no7FCPhhDugxqgR4fUSvdX":[[1,10000000,false]]},"2d216451b20b6501e927d85244bcc1c7c70598332717df91bb571359c358affd":{},"31494e7e9f42f4bd736769b07cc602e2a1019617b2c72a03ec945b667aada78f":{},"336eee749da7d1c537fd5679157fae63005bfd4bb8cf47ae73600999cbc9beaa":{"mqYXSDuvMpdibxUy6ftKW1564L9UE5eeFX":[[0,21958750,false]]},"3a6ed17d34c49dfdf413398e113cf5f71710d59e9f4050bbc601d513a77eb308":{"mpEGnkPKtMyfHo8EaUFks7xFZJdSgLjnC7":[[0,1000000,false]],"n23NSQfgAmVaW1qE1kgnxkW8JvWfveAktH":[[1,3999400,false]]},"475c149be20c8a73596fad6cb8861a5af46d4fcf8e26a9dbf6cedff7ff80b70d":{"mrHCUTD63vsP9K3oon2AWZ9bKjqDhd5PMm":[[1,889890,false]]},"56a65810186f82132cea35357819499468e4e376fca685c023700c75dc3bd216":{"myvhXvymTD4Ncgfg8r2WXiTZeDY3TtZGUY":[[1,5000000,false]]},"6ae728f783b0d4680ed8050c05419f0a89dfd6e28d46acfce7453b4d1b2b0254":{"mupBXEDhWQnrmyW4TukDs2qcqQrhRJGrQd":[[0,10000000,false]]},"72419d187c61cfc67a011095566b374dc2c01f5397e36eafe68e40fc44474112":{},"76bcf540b27e75488d95913d0950624511900ae291a37247c22d996bb7cde0b4":{"mgaArVGf5heGUko1i24wYrvkfFcN442U4v":[[0,4978900,false]]},"7f19935daa7347bdcf45f0bfd726dd665c514ffd49dfb035369813a54c1e5d1a":{"mxTwRCnJgafjVaUVLsniWZPpXhz5dFzRyb":[[1,89998701,false]]},"8361b8f56b1ba8d9b59d5ef4547fe7203859e0c3107bc131b83fc1db12a11471":{"mfxZoA5dHaVn6QiHMbRwQTQUB7VFpZQFW4":[[1,100000,false]],"mhwQ9cxhAxaED747XuzgUo3F39MDc6txHr":[[0,9200,false]]},"9de08bcafc602a3d2270c46cbad1be0ef2e96930bec3944739089f960652e7cb":{"mupBXEDhWQnrmyW4TukDs2qcqQrhRJGrQd":[[0,1000000,false],[1,1000000,false],[2,1000000,false],[3,2000000,false],[5,10000000,false]]},"a29d131e766950cae2e97dd4527b7c050293c2f5630470bdd7d00b7fe6db1b9d":{"mupBXEDhWQnrmyW4TukDs2qcqQrhRJGrQd":[[0,25000000,false]],"myJLELfyhG1Fu7iPyfpHfviVCQuLwsNCBm":[[1,34995259,false]]},"c1433779c5faec5df5e7bdc51214a95f15deeab842c23efbdde3acf82c165462":{"mvXwR94pXVgP7kdrW3vTiDQtVrkP3NY3zn":[[0,1866000,false]],"mweezhmgY1kEvmSNpfrqdLcd6NHekupXKp":[[1,30000000,false]]},"c1fa83595c4c117da834569cba81d84d30ebf99fbdc96535f6e8afd5550e48b9":{"mycxtgambuph71Hg6MdwRoF7c7GkFvHiZ6":[[0,9638,false]]},"c2595a521111eb0298e183e0a74befc91f6f93b03e2f7d43c7ad63a9196f7e3a":{"mvJ2vrvNySAXWxVYuCn2tX6amyfchFGHvK":[[0,990400,false]]},"e07bf0498d40d7b8d7933b1049dd54a1b21b7c5f6d8def98b0997e22761e0968":{"mt2ijtY7BUkQRpErd99N9131YgsEL7oBSt":[[0,4999700,false]],"n1gdKukb5TUu37x5GahHsp4Gp2fdowdZPH":[[1,5000000,false]]},"e453e7346693b507561691b5ea73f8eba60bfc8998056226df55b2fac88ba306":{"mp2CafXnWnN8rR6BnFToVQ8bXNY4jnAecr":[[1,689000,false]],"mwNWMKSGou8ZJzXgfDaAUy1C8Jip3TEmdf":[[0,100000,false]]},"e87a207ff3f3d2601fd086e90fa81a8ecb9c15e6974e649d53b9ebc2b087af25":{"mmL4aJtiAPVUQca9AaZZdPUht9FvS2eb4a":[[1,789354,false]]}},"use_encryption":false,"verified_tx3":{"0f4972c84974b908a58dda2614b68cf037e6c03e8291898c719766f213217b67":[1230168,1510528889,25],"2791cdc98570cc2b6d9d5b197dc2d002221b074101e3becb19fab4b79150446d":[1231593,1511484570,30],"2d216451b20b6501e927d85244bcc1c7c70598332717df91bb571359c358affd":[1251055,1512046701,245],"31494e7e9f42f4bd736769b07cc602e2a1019617b2c72a03ec945b667aada78f":[1230627,1510871704,71],"336eee749da7d1c537fd5679157fae63005bfd4bb8cf47ae73600999cbc9beaa":[1242088,1511680407,146],"3a6ed17d34c49dfdf413398e113cf5f71710d59e9f4050bbc601d513a77eb308":[1231594,1511485793,27],"475c149be20c8a73596fad6cb8861a5af46d4fcf8e26a9dbf6cedff7ff80b70d":[1281357,1518388420,13],"56a65810186f82132cea35357819499468e4e376fca685c023700c75dc3bd216":[1231595,1511487012,215],"6ae728f783b0d4680ed8050c05419f0a89dfd6e28d46acfce7453b4d1b2b0254":[1230626,1510870499,1],"72419d187c61cfc67a011095566b374dc2c01f5397e36eafe68e40fc44474112":[1230191,1510536040,201],"76bcf540b27e75488d95913d0950624511900ae291a37247c22d996bb7cde0b4":[1251084,1512048610,1],"7f19935daa7347bdcf45f0bfd726dd665c514ffd49dfb035369813a54c1e5d1a":[1230624,1510868089,289],"8361b8f56b1ba8d9b59d5ef4547fe7203859e0c3107bc131b83fc1db12a11471":[1446399,1543859403,92],"9de08bcafc602a3d2270c46cbad1be0ef2e96930bec3944739089f960652e7cb":[1255526,1513816274,12],"a29d131e766950cae2e97dd4527b7c050293c2f5630470bdd7d00b7fe6db1b9d":[1230163,1510527129,10],"c1433779c5faec5df5e7bdc51214a95f15deeab842c23efbdde3acf82c165462":[1242088,1511680407,147],"c1fa83595c4c117da834569cba81d84d30ebf99fbdc96535f6e8afd5550e48b9":[1323966,1528290006,54],"c2595a521111eb0298e183e0a74befc91f6f93b03e2f7d43c7ad63a9196f7e3a":[1251074,1512047838,4],"e07bf0498d40d7b8d7933b1049dd54a1b21b7c5f6d8def98b0997e22761e0968":[1231594,1511485793,26],"e453e7346693b507561691b5ea73f8eba60bfc8998056226df55b2fac88ba306":[1297610,1526308364,61],"e87a207ff3f3d2601fd086e90fa81a8ecb9c15e6974e649d53b9ebc2b087af25":[1297404,1526137238,56]},"wallet_type":"standard","winpos-qt":[671,324,840,400]}'
        self._upgrade_storage(wallet_str)

    def test_upgrade_from_client_2_9_3_importedkeys(self):
        wallet_str = '{"addr_history":{"LMK1a5LKLkLFCEKukwwTrGxPboNvZjDbcY":[],"LPRvUteVjy7MwDYro7o6XJ8SzhaYBJQhoM":[],"LZBc9EVXNXW1aGdrxodATNp9kYeCxufeWb":[]},"addresses":{"change":[],"receiving":["LMK1a5LKLkLFCEKukwwTrGxPboNvZjDbcY","LZBc9EVXNXW1aGdrxodATNp9kYeCxufeWb","LPRvUteVjy7MwDYro7o6XJ8SzhaYBJQhoM"]},"keystore":{"keypairs":{"0344b1588589958b0bcab03435061539e9bcf54677c104904044e4f8901f4ebdf5":"T8hVerMmMsVnq7mkXpEw4krEhXJ5BZNVv7mb4C7LoV8Ni8iywME1","0389508c13999d08ffae0f434a085f4185922d64765c0bff2f66e36ad7f745cc5f":"T96yXyhXKvujT4sMAPihoJJ2sXNTwDircc7WnT2qqXTdBs433uZ5","04575f52b82f159fa649d2a4c353eb7435f30206f0a6cb9674fbd659f45082c37d559ffd19bea9c0d3b7dcc07a7b79f4cffb76026d5d4dff35341efe99056e22d2":"6vHESf1YF8tPdqpGyEiNvibJPRZzKsB4ijYsywkUaz3SfUAnidY"},"type":"imported"},"pruned_txo":{},"seed_version":13,"stored_height":-1,"transactions":{},"tx_fees":{},"txi":{},"txo":{},"use_encryption":false,"verified_tx3":{},"wallet_type":"standard","winpos-qt":[100,100,840,405]}'
        self._upgrade_storage(wallet_str)

    def test_upgrade_from_client_2_9_3_watchaddresses(self):
        wallet_str = '{"addr_history":{"LXupCaL8GsoAAC3c6ayRuQiF6oKd6jzvF2":[],"LbGiejb64pNXrjPZfiauVkchFQksBnFjrz":[],"Lc2ZerD7r4iMufWnkUFRVoqj8zaUdra9gy":[]},"addresses":["LbGiejb64pNXrjPZfiauVkchFQksBnFjrz","Lc2ZerD7r4iMufWnkUFRVoqj8zaUdra9gy","LXupCaL8GsoAAC3c6ayRuQiF6oKd6jzvF2"],"pruned_txo":{},"seed_version":13,"stored_height":490039,"transactions":{},"tx_fees":{},"txi":{},"txo":{},"verified_tx3":{},"wallet_type":"imported","winpos-qt":[499,386,840,405]}'
        self._upgrade_storage(wallet_str)

    def test_upgrade_from_client_2_9_3_trezor_singleacc(self):
        wallet_str = '''{"addr_history":{"LM6NBhqWiUD5f2W1WpqLA7MtWiNFjW5Gpf":[],"LNKgMdfRbUZbVNxcoeVHr4nRFp9ULZX4bT":[],"LNRkHQjKykMaazy1PCQnmqeQ71ttwUuuQK":[],"LPYB6U1Tc3Ld2sE3UdUnxbm4Kq5DDkPCEX":[],"LQ6D1vogMEs8fX1r4gixxjCCerbwTX3srN":[],"LQDkeaPgZyTG88UietSqaXKgGthudu92c8":[],"LRmMnkbdJVrssuy5gW8UpLC1zSEFp7omPC":[],"LSgH66JcXMp7k639zdaC4sHwr6t2yTKAwQ":[],"LW1dXPAmnVEZz17PhgQjHvmEV6MUcd6Zhi":[],"LYNthwkLpuYsJ6Ajf8TYRfaaQxqqtYWC1P":[],"LKTPPv5imBVPgTeGBLYbB99NYTnpPpF5wV":[],"LZrSPCcvWHfDaeNCnkFaYL8mzWhm89qZxo":[],"LaxCqVGpuyF5cpwGLw3T28dgZPBUoRcMSZ":[],"LbyEUdYYci1Cj1ejcJYY42xd1nQvM6eiXw":[],"LcFKtey5o4am16ZBPdxV3C7sZxTMyRqyoN":[],"Le1MnHWuYaGxL1fg13WsvNBy98GmHpurMG":[],"Le2qSFZKLGnxXyBnbW9wJaRmZdc6bfBmDG":[],"Les27ji39QbL8cM3ENGRmJ4eHhw1nkrHLf":[],"Lf3SJTKupNcZjw4BbXNJtoP2u36qoUPFJ4":[],"LfrnPoo5Wqudu5n5uiWa1jTVBKCfbNbeG4":[],"Lg57GijtoArWz9YwcyMg6Z4D3HsR6N1tGr":[],"LgUeokVX6eTKtbXNBJv6RheFhLiCzwSPaE":[],"LgahVvDJdYCWTZMzL8xFUUskXak7rKY76R":[],"LggNWLqwSZKAtCqcS5TTR9JPzCxSgoznXZ":[],"LgnpLBMSPN9okS1biMgszNMTbGvkCxAxom":[],"LL5B1VZe55MoSv47bra4E4pwrgNY1zHv1o":[]},"addresses":{"change":["LKTPPv5imBVPgTeGBLYbB99NYTnpPpF5wV","LNRkHQjKykMaazy1PCQnmqeQ71ttwUuuQK","LL5B1VZe55MoSv47bra4E4pwrgNY1zHv1o","LQ6D1vogMEs8fX1r4gixxjCCerbwTX3srN","LgnpLBMSPN9okS1biMgszNMTbGvkCxAxom","Le2qSFZKLGnxXyBnbW9wJaRmZdc6bfBmDG"],"receiving":["Lf3SJTKupNcZjw4BbXNJtoP2u36qoUPFJ4","LSgH66JcXMp7k639zdaC4sHwr6t2yTKAwQ","LRmMnkbdJVrssuy5gW8UpLC1zSEFp7omPC","LM6NBhqWiUD5f2W1WpqLA7MtWiNFjW5Gpf","LPYB6U1Tc3Ld2sE3UdUnxbm4Kq5DDkPCEX","Les27ji39QbL8cM3ENGRmJ4eHhw1nkrHLf","Le1MnHWuYaGxL1fg13WsvNBy98GmHpurMG","Lg57GijtoArWz9YwcyMg6Z4D3HsR6N1tGr","LNKgMdfRbUZbVNxcoeVHr4nRFp9ULZX4bT","LgahVvDJdYCWTZMzL8xFUUskXak7rKY76R","LfrnPoo5Wqudu5n5uiWa1jTVBKCfbNbeG4","LW1dXPAmnVEZz17PhgQjHvmEV6MUcd6Zhi","LggNWLqwSZKAtCqcS5TTR9JPzCxSgoznXZ","LgUeokVX6eTKtbXNBJv6RheFhLiCzwSPaE","LcFKtey5o4am16ZBPdxV3C7sZxTMyRqyoN","LQDkeaPgZyTG88UietSqaXKgGthudu92c8","LYNthwkLpuYsJ6Ajf8TYRfaaQxqqtYWC1P","LZrSPCcvWHfDaeNCnkFaYL8mzWhm89qZxo","LaxCqVGpuyF5cpwGLw3T28dgZPBUoRcMSZ","LbyEUdYYci1Cj1ejcJYY42xd1nQvM6eiXw"]},"keystore":{"derivation":"m/44'/0'/0'","hw_type":"trezor","label":"trezor1","type":"hardware","xpub":"xpub6BycoSLDNcWjBQMuYgSaEoinupMjma8Cu2uj4XiRCZkecLHXXmzcxbyR1gdfrZpiZDVSs92MEGGNhF78BEbbYi2b5U2oPnaUPRhjriWz85y"},"pruned_txo":{},"seed_version":13,"stored_height":490014,"transactions":{},"tx_fees":{},"txi":{},"txo":{},"use_encryption":false,"verified_tx3":{},"wallet_type":"standard","winpos-qt":[753,486,840,405]}'''
        self._upgrade_storage(wallet_str)

    def test_upgrade_from_client_2_9_3_multisig(self):
        wallet_str = '{"addr_history":{"M87s9D7u1WFsa4ngJdqAULMB7siczAwtwt":[],"M8bL3dwjtYefDPQBHSbW47qnGGtP5WWniV":[],"M9TYf6W52TCr94VEeDJTE8LrgEkTvsookV":[],"M9ZYYkWR9opBxoyU2MDsNVM5XSqFAGCXQF":[],"MA941kSUkxzxZ6DzCnbZaWrnwAhERS4KY3":[],"MC6jfmRo8PdPsveWyWFu8L7WrCC75u7dvM":[],"MDCqb8JE79toXnaY45M5MjTjyAdHzLrGgQ":[],"ME4iDMHgbSMFE39c3jXUfZVb6oN5zsbSsf":[],"MENAd6wWNtGkMvh6NZaLgNFZ2idCGJMSH1":[],"MEUhaxgfuTB8tP53GdZSdVnRYvACvy8HoN":[],"MGT3GjcuffmWLaUKsAmMRj2y7BdjrqcB4f":[],"MGnRpiGVxUqKnCCJb6L9vMLSxrPXDTqz4C":[],"MKNMK37FUVobU516zMarZCkNFiGQNAr5p9":[],"MNXCW51eu2dESvRr4BjBq4357FHiTECShe":[],"MPDHGfAwUANbPadr1Vpfdsws7PeHvbie9r":[],"MQutteLF867MiFZwirZqWNDzAS8ppWXSSC":[],"MR6JNqR8GcucDap4LXKktrFUS5DayikmLX":[],"MRcxBYgDDzLDXV7mpWDNMhSPLffAYWSep2":[],"MRjnKsSJcrsTnqNanHHgdvp4vrDmzPsUtV":[],"MRmrYG92SQUun8C3a6tCtSytkaAohBRyz7":[],"MRrbdAiZhgDSD12pRfGmfBTwhp4yt4dkyy":[],"MSHisDJBGZUWtSfETJo9CXkh52DXLd8DDP":[],"MSNY9dFU1JssSeZH6bU3CDYokkgy1bMyre":[],"MVFScHDwKNmJgRFrr6b8NJAx3Tfyj1N5Ya":[],"MVtWwExQXWHQaP2W517R3KaCnLkTzUuKfs":[],"MVyFXTtxXLDPmY3QBPyddf7dUQ5xC5AiCh":[]},"addresses":{"change":["M87s9D7u1WFsa4ngJdqAULMB7siczAwtwt","MQutteLF867MiFZwirZqWNDzAS8ppWXSSC","MNXCW51eu2dESvRr4BjBq4357FHiTECShe","MSNY9dFU1JssSeZH6bU3CDYokkgy1bMyre","M9ZYYkWR9opBxoyU2MDsNVM5XSqFAGCXQF","MGT3GjcuffmWLaUKsAmMRj2y7BdjrqcB4f"],"receiving":["MVFScHDwKNmJgRFrr6b8NJAx3Tfyj1N5Ya","M9TYf6W52TCr94VEeDJTE8LrgEkTvsookV","MKNMK37FUVobU516zMarZCkNFiGQNAr5p9","MGnRpiGVxUqKnCCJb6L9vMLSxrPXDTqz4C","MPDHGfAwUANbPadr1Vpfdsws7PeHvbie9r","MDCqb8JE79toXnaY45M5MjTjyAdHzLrGgQ","ME4iDMHgbSMFE39c3jXUfZVb6oN5zsbSsf","MENAd6wWNtGkMvh6NZaLgNFZ2idCGJMSH1","MEUhaxgfuTB8tP53GdZSdVnRYvACvy8HoN","MA941kSUkxzxZ6DzCnbZaWrnwAhERS4KY3","MSHisDJBGZUWtSfETJo9CXkh52DXLd8DDP","MRjnKsSJcrsTnqNanHHgdvp4vrDmzPsUtV","MRcxBYgDDzLDXV7mpWDNMhSPLffAYWSep2","MRmrYG92SQUun8C3a6tCtSytkaAohBRyz7","M8bL3dwjtYefDPQBHSbW47qnGGtP5WWniV","MRrbdAiZhgDSD12pRfGmfBTwhp4yt4dkyy","MR6JNqR8GcucDap4LXKktrFUS5DayikmLX","MVtWwExQXWHQaP2W517R3KaCnLkTzUuKfs","MVyFXTtxXLDPmY3QBPyddf7dUQ5xC5AiCh","MC6jfmRo8PdPsveWyWFu8L7WrCC75u7dvM"]},"pruned_txo":{},"seed_version":13,"stored_height":485855,"transactions":{},"tx_fees":{},"txi":{},"txo":{},"use_encryption":false,"verified_tx3":{},"wallet_type":"2of2","winpos-qt":[617,227,840,405],"x1/":{"seed":"speed cruise market wasp ability alarm hold essay grass coconut tissue recipe","type":"bip32","xprv":"xprv9s21ZrQH143K48ig2wcAuZoEKaYdNRaShKFR3hLrgwsNW13QYRhXH6gAG1khxim6dw2RtAzF8RWbQxr1vvWUJFfEu2SJZhYbv6pfreMpuLB","xpub":"xpub661MyMwAqRbcGco98y9BGhjxscP7mtJJ4YB1r5kUFHQMNoNZ5y1mptze7J37JypkbrmBdnqTvSNzxL7cE1FrHg16qoj9S12MUpiYxVbTKQV"},"x2/":{"type":"bip32","xprv":null,"xpub":"xpub661MyMwAqRbcGrCDZaVs9VC7Z6579tsGvpqyDYZEHKg2MXoDkxhrWoukqvwDPXKdxVkYA6Hv9XHLETptfZfNpcJZmsUThdXXkTNGoBjQv1o"}}'
        self._upgrade_storage(wallet_str)

##########

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
        from electrum_sum.plugin import Plugins
        from electrum_sum.simple_config import SimpleConfig

        cls.electrum_path = tempfile.mkdtemp()
        config = SimpleConfig({'electrum_path': cls.electrum_path})

        gui_name = 'cmdline'
        # TODO it's probably wasteful to load all plugins... only need Trezor
        Plugins(config, gui_name)

    @classmethod
    def tearDownClass(cls):
        super().tearDownClass()
        shutil.rmtree(cls.electrum_path)

    def _upgrade_storage(self, wallet_json, accounts=1):
        if accounts == 1:
            # test manual upgrades
            storage = self._load_storage_from_json_string(wallet_json=wallet_json,
                                                          path=self.wallet_path,
                                                          manual_upgrades=True)
            self.assertFalse(storage.requires_split())
            if storage.requires_upgrade():
                storage.upgrade()
                self._sanity_check_upgraded_storage(storage)
            # test automatic upgrades
            path2 = os.path.join(self.user_dir, "somewallet2")
            storage2 = self._load_storage_from_json_string(wallet_json=wallet_json,
                                                           path=path2,
                                                           manual_upgrades=False)
            storage2.write()
            self._sanity_check_upgraded_storage(storage2)
            # test opening upgraded storages again
            s1 = WalletStorage(path2, manual_upgrades=False)
            self._sanity_check_upgraded_storage(s1)
            s2 = WalletStorage(path2, manual_upgrades=True)
            self._sanity_check_upgraded_storage(s2)
        else:
            storage = self._load_storage_from_json_string(wallet_json=wallet_json,
                                                          path=self.wallet_path,
                                                          manual_upgrades=True)
            self.assertTrue(storage.requires_split())
            new_paths = storage.split_accounts()
            self.assertEqual(accounts, len(new_paths))
            for new_path in new_paths:
                new_storage = WalletStorage(new_path, manual_upgrades=False)
                self._sanity_check_upgraded_storage(new_storage)

    def _sanity_check_upgraded_storage(self, storage):
        self.assertFalse(storage.requires_split())
        self.assertFalse(storage.requires_upgrade())
        w = Wallet(storage)

    @staticmethod
    def _load_storage_from_json_string(*, wallet_json, path, manual_upgrades):
        with open(path, "w") as f:
            f.write(wallet_json)
        storage = WalletStorage(path, manual_upgrades=manual_upgrades)
        return storage
