Compare commits

...

2 Commits

Author SHA1 Message Date
lash
537b5c2bbc
Bump version 2022-04-09 19:02:00 +00:00
lash
fd62ad7075
Avoid double sync of history when caught up 2022-04-09 18:58:47 +00:00
3 changed files with 10 additions and 3 deletions

View File

@ -11,7 +11,7 @@ from chainsyncer.db.models.filter import BlockchainSyncFilter
from chainsyncer.db.models.base import SessionBase
from .base import Backend
logg = logging.getLogger().getChild(__name__)
logg = logging.getLogger(__name__)
class SQLBackend(Backend):
@ -267,7 +267,8 @@ class SQLBackend(Backend):
session.flush()
#if block_height != block_resume:
if highest_unsynced_block < block_resume:
logg.info('last live id {} {} {}'.format(last_live_id, highest_unsynced_block, block_resume))
if highest_unsynced_block <= block_resume:
q = session.query(BlockchainSyncFilter)
q = q.filter(BlockchainSyncFilter.chain_sync_id==last_live_id)

View File

@ -65,6 +65,12 @@ class BlockPollSyncer(Syncer):
:returns: See chainsyncer.backend.base.Backend.get
"""
(pair, fltr) = self.backend.get()
(target, fltr_target) = self.backend.target()
if target == pair[0]:
logg.info('syncer was done before it started: {}'.format(self))
raise SyncDone(target)
start_tx = pair[1]

View File

@ -1,6 +1,6 @@
[metadata]
name = chainsyncer
version = 0.1.0
version = 0.1.1
description = Generic blockchain syncer driver
author = Louis Holbrook
author_email = dev@holbrook.no