chainqueue

Blockchain transaction queue control
Log | Files | Refs | LICENSE

commit 01ad409077c2166344d2d0b07861dbb28fcaaf60
parent 3a8ec0158887ce494f604dfe2600606300a1694b
Author: lash <dev@holbrook.no>
Date:   Wed,  4 May 2022 18:37:02 +0000

Raise correct error in index store exists check

Diffstat:
MCHANGELOG | 12++++++++++++
Mchainqueue/store/fs.py | 16+++++++++++++---
Msetup.cfg | 2+-
3 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG @@ -1,3 +1,15 @@ +- 0.1.12 + * Raise correct exception from index store exists check +- 0.1.11 + * Allow for sync skip in store instantiation +- 0.1.10 + * Improve logging +- 0.1.9 + * Upgrade deps +- 0.1.8 + * Upgrade deps +- 0.1.7 + * Improve logging - 0.1.6 * Sort upcoming queue item chronologically * Add unit testing for upcoming query method diff --git a/chainqueue/store/fs.py b/chainqueue/store/fs.py @@ -6,7 +6,10 @@ import logging from leveldir.hex import HexDir # local imports -from chainqueue.error import DuplicateTxError +from chainqueue.error import ( + DuplicateTxError, + NotLocalTxError, + ) logg = logging.getLogger(__name__) @@ -22,7 +25,7 @@ class IndexStore(HexDir): existing = None try: existing = self.get(k) - except FileNotFoundError: + except NotLocalTxError: pass return existing != None @@ -37,7 +40,14 @@ class IndexStore(HexDir): def get(self, k): fp = self.store.to_filepath(k) - f = open(fp, 'rb') + f = None + err = None + try: + f = open(fp, 'rb') + except FileNotFoundError as e: + err = e + if err != None: + raise NotLocalTxError(err) v = f.read() f.close() return v.decode('utf-8') diff --git a/setup.cfg b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = chainqueue -version = 0.1.10 +version = 0.1.12 description = Generic blockchain transaction queue control author = Louis Holbrook author_email = dev@holbrook.no