storage: fix some madness about get_data_ref() and put() interacting badly
previously load_transactions() had to be called before upgrade();
now we reverse this order.
to reproduce/illustrate issue, before this commit:
try running convert_version_17 and convert_version_18
(e.g. see testcase test_upgrade_from_client_2_9_3_old_seeded_with_realistic_history)
and then in qt console:
>> wallet.storage.db.get_data_ref('spent_outpoints') == wallet.storage.db.spent_outpoints
False
>> wallet.storage.db.get_data_ref('verified_tx3') == wallet.storage.db.verified_tx
False
This commit is contained in:
@@ -226,6 +226,9 @@ class WalletStorage(Logger):
|
||||
raise Exception("storage not yet decrypted!")
|
||||
return self.db.requires_upgrade()
|
||||
|
||||
def is_ready_to_be_used_by_wallet(self):
|
||||
return not self.requires_upgrade() and self.db._called_after_upgrade_tasks
|
||||
|
||||
def upgrade(self):
|
||||
self.db.upgrade()
|
||||
self.write()
|
||||
@@ -240,6 +243,7 @@ class WalletStorage(Logger):
|
||||
path = self.path + '.' + data['suffix']
|
||||
storage = WalletStorage(path)
|
||||
storage.db.data = data
|
||||
storage.db._called_after_upgrade_tasks = False
|
||||
storage.db.upgrade()
|
||||
storage.write()
|
||||
out.append(path)
|
||||
|
||||
Reference in New Issue
Block a user