commit d0dbaad1f2e4a20551389b5c120238e024947c63
parent 8c2905b8010a50eeb1c9b1bec431e092bc8dab65
Author: lash <dev@holbrook.no>
Date: Sun, 10 Apr 2022 16:21:52 +0000
Skip not local transaction in sync
Diffstat:
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/chaind/filter.py b/chaind/filter.py
@@ -1,8 +1,14 @@
+# standard imports
+import logging
+
# external imports
from chainlib.status import Status as TxStatus
+from chainsyncer.filter import SyncFilter
+from chainqueue.error import NotLocalTxError
+logg = logging.getLogger(__name__)
-class StateFilter:
+class StateFilter(SyncFilter):
def __init__(self, adapter, throttler=None):
self.adapter = adapter
@@ -10,10 +16,16 @@ class StateFilter:
def filter(self, conn, block, tx, session=None):
- cache_tx = self.adapter.get(tx.hash)
+ try:
+ cache_tx = self.adapter.get(tx.hash)
+ except NotLocalTxError:
+ logg.debug('skipping not local transaction {}'.format(tx.hash))
+ return False
if tx.status == TxStatus.SUCCESS:
self.adapter.succeed(block, tx)
else:
self.adapter.fail(block, tx)
if self.throttler != None:
self.throttler.dec(tx.hash)
+
+ return False