Merge pull request #3002 from lbryio/modified_on_int

fixed sync'ing issues related to `modified_on` timestamps having varying floating value between OSes
This commit is contained in:
Lex Berezhny 2020-07-20 20:22:43 -04:00 committed by GitHub
commit 2b84f4d407
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -1714,7 +1714,7 @@ class Daemon(metaclass=JSONRPCServerType):
change_made = True change_made = True
if change_made: if change_made:
account.modified_on = time.time() account.modified_on = int(time.time())
wallet.save() wallet.save()
return account return account

View file

@ -311,7 +311,7 @@ class Account:
private_key=private_key, private_key=private_key,
public_key=public_key, public_key=public_key,
address_generator=d.get('address_generator', {}), address_generator=d.get('address_generator', {}),
modified_on=d.get('modified_on', time.time()), modified_on=d.get('modified_on', int(time.time())),
channel_keys=d.get('certificates', {}) channel_keys=d.get('certificates', {})
) )
@ -343,7 +343,7 @@ class Account:
def merge(self, d: dict): def merge(self, d: dict):
if d.get('modified_on', 0) > self.modified_on: if d.get('modified_on', 0) > self.modified_on:
self.name = d['name'] self.name = d['name']
self.modified_on = d.get('modified_on', time.time()) self.modified_on = d.get('modified_on', int(time.time()))
assert self.address_generator.name == d['address_generator']['name'] assert self.address_generator.name == d['address_generator']['name']
for chain_name in ('change', 'receiving'): for chain_name in ('change', 'receiving'):
if chain_name in d['address_generator']: if chain_name in d['address_generator']: