diff --git a/lbry/wallet/account.py b/lbry/wallet/account.py index 3af07cfe4..83185cee6 100644 --- a/lbry/wallet/account.py +++ b/lbry/wallet/account.py @@ -311,7 +311,7 @@ class Account: private_key=private_key, public_key=public_key, address_generator=d.get('address_generator', {}), - modified_on=d.get('modified_on', int(time.time())), + modified_on=int(d.get('modified_on', time.time())), channel_keys=d.get('certificates', {}) ) @@ -343,7 +343,7 @@ class Account: def merge(self, d: dict): if d.get('modified_on', 0) > self.modified_on: self.name = d['name'] - self.modified_on = d.get('modified_on', int(time.time())) + self.modified_on = int(d.get('modified_on', time.time())) assert self.address_generator.name == d['address_generator']['name'] for chain_name in ('change', 'receiving'): if chain_name in d['address_generator']: diff --git a/lbry/wallet/wallet.py b/lbry/wallet/wallet.py index 8f3cecc57..0c021af1f 100644 --- a/lbry/wallet/wallet.py +++ b/lbry/wallet/wallet.py @@ -35,7 +35,7 @@ class TimestampedPreferences(UserDict): def __setitem__(self, key, value): self.data[key] = { 'value': value, - 'ts': time.time() + 'ts': int(time.time()) } def __repr__(self): diff --git a/tests/unit/wallet/test_account.py b/tests/unit/wallet/test_account.py index a54962ed6..5ce68f430 100644 --- a/tests/unit/wallet/test_account.py +++ b/tests/unit/wallet/test_account.py @@ -132,7 +132,7 @@ class TestAccount(AsyncioTestCase): async def test_load_and_save_account(self): account_data = { 'name': 'Main Account', - 'modified_on': 123.456, + 'modified_on': 123, 'seed': "carbon smart garage balance margin twelve chest sword toast envelope bottom stomac" "h absent", @@ -183,7 +183,7 @@ class TestAccount(AsyncioTestCase): def test_merge_diff(self): account_data = { 'name': 'My Account', - 'modified_on': 123.456, + 'modified_on': 123, 'seed': "carbon smart garage balance margin twelve chest sword toast envelope bottom stomac" "h absent", @@ -203,7 +203,7 @@ class TestAccount(AsyncioTestCase): account = Account.from_dict(self.ledger, Wallet(), account_data) self.assertEqual(account.name, 'My Account') - self.assertEqual(account.modified_on, 123.456) + self.assertEqual(account.modified_on, 123) self.assertEqual(account.change.gap, 5) self.assertEqual(account.change.maximum_uses_per_address, 2) self.assertEqual(account.receiving.gap, 5) @@ -366,7 +366,7 @@ class TestSingleKeyAccount(AsyncioTestCase): async def test_load_and_save_account(self): account_data = { 'name': 'My Account', - 'modified_on': 123.456, + 'modified_on': 123, 'seed': "carbon smart garage balance margin twelve chest sword toast envelope bottom stomac" "h absent", diff --git a/tests/unit/wallet/test_wallet.py b/tests/unit/wallet/test_wallet.py index dc6e4d3e8..0cdfaa767 100644 --- a/tests/unit/wallet/test_wallet.py +++ b/tests/unit/wallet/test_wallet.py @@ -38,7 +38,7 @@ class TestWalletCreation(AsyncioTestCase): 'certificates': {}, 'name': 'An Account', 'ledger': 'lbc_mainnet', - 'modified_on': 123.456, + 'modified_on': 123, 'seed': "carbon smart garage balance margin twelve chest sword toast envelope bottom stomac" "h absent", @@ -62,7 +62,7 @@ class TestWalletCreation(AsyncioTestCase): wallet = Wallet.from_storage(storage, self.manager) self.assertEqual(wallet.name, 'Main Wallet') self.assertEqual( - hexlify(wallet.hash), b'a75913d2e7339c1a9ac0c89d621a4e10fd3a40dc3560dc01f4cf4ada0a0b05b8' + hexlify(wallet.hash), b'869acc4660dde0f13784ed743796adf89562cdf79fdfc9e5c6dbea98d62ccf90' ) self.assertEqual(len(wallet.accounts), 1) account = wallet.default_account