check modified_on

This commit is contained in:
Lex Berezhny 2019-03-12 09:42:28 -04:00
parent a914de155a
commit 96f1883fc4

View file

@ -16,7 +16,6 @@ from aiohttp import web
from functools import wraps from functools import wraps
from torba.client.wallet import Wallet from torba.client.wallet import Wallet
from torba.client.baseaccount import SingleKey, HierarchicalDeterministic from torba.client.baseaccount import SingleKey, HierarchicalDeterministic
from torba.client.hash import sha256
from lbrynet import __version__, utils from lbrynet import __version__, utils
from lbrynet.conf import Config, Setting, SLACK_WEBHOOK from lbrynet.conf import Config, Setting, SLACK_WEBHOOK
@ -1083,6 +1082,7 @@ class Daemon(metaclass=JSONRPCServerType):
change_made = True change_made = True
if change_made: if change_made:
account.modified_on = time.time()
self.default_wallet.save() self.default_wallet.save()
result = account.to_dict() result = account.to_dict()
@ -1252,6 +1252,10 @@ class Daemon(metaclass=JSONRPCServerType):
await self.analytics_manager.send_credits_sent() await self.analytics_manager.send_credits_sent()
return result return result
SYNC_DOC = """
Wallet synchronization.
"""
@requires("wallet") @requires("wallet")
def jsonrpc_sync_hash(self): def jsonrpc_sync_hash(self):
""" """
@ -1297,6 +1301,7 @@ class Daemon(metaclass=JSONRPCServerType):
local_match = local_account local_match = local_account
break break
if local_match is not None: if local_match is not None:
if account_data.get('modified_on', 0) > local_match.modified_on:
local_match.name = account_data.get('name', local_match.name) local_match.name = account_data.get('name', local_match.name)
local_match.certificates.update(account_data.get('certificates', {})) local_match.certificates.update(account_data.get('certificates', {}))
else: else: