chainsyncer

Blockchain syncer driver
Log | Files | Refs | LICENSE

commit 2b5383e9e0877521046f70df27b6669ef56cf5e0
parent 43249a9ec0468ae7acc0ed28965d08dda341ad82
Author: lash <dev@holbrook.no>
Date:   Sat, 19 Mar 2022 01:13:37 +0000

Correct first target state filename

Diffstat:
Mchainsyncer/store/fs.py | 4++--
Mtests/test_fs.py | 15+++++++++++++++
2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/chainsyncer/store/fs.py b/chainsyncer/store/fs.py @@ -236,9 +236,9 @@ class SyncFsStore: self.item_keys.append(block_number) logg.info('added existing {}'.format(o)) - fp = os.path.join(self.session_path, str(target)) + fp = os.path.join(self.session_path, 'target') if len(thresholds) == 0: - logg.info('syncer first run') + logg.info('syncer first run target {}'.format(target)) self.first = True f = open(fp, 'w') f.write(str(target)) diff --git a/tests/test_fs.py b/tests/test_fs.py @@ -203,5 +203,20 @@ class TestFs(unittest.TestCase): o = store.get(2) + def test_sync_history_interrupted(self): + store = SyncFsStore(self.path, session_id='foo') + session = SyncSession(store) + + session.start(target=13) + o = session.get(0) + o.next(advance_block=True) + o.next(advance_block=True) + session.stop(o) + + store = SyncFsStore(self.path, session_id='foo') + store.start() + o = store.get(0) + + if __name__ == '__main__': unittest.main()