Add change test for chainqueue entry

This commit is contained in:
lash
2022-04-10 14:00:01 +00:00
parent 0fa12adfa1
commit 01b674d09e
5 changed files with 32 additions and 1 deletions

View File

@@ -115,7 +115,8 @@ class QueueEntry:
def fail(self, block, tx):
if self.__match_state(self.store.NETWORK_ERROR):
return
self.store.set(self.k, self.store.NETWORK_ERROR)
v = self.store.state(self.k)
self.store.change(self.k, v | self.store.NETWORK_ERROR, self.store.QUEUED)
if self.store.cache:
self.store.cache.set_block(self.tx_hash, block, tx)

View File

@@ -1,11 +1,14 @@
# standard imports
import re
import datetime
import logging
# local imports
from chainqueue.cache import CacheTx
from chainqueue.entry import QueueEntry
logg = logging.getLogger(__name__)
def to_key(t, n, k):
return '{}_{}_{}'.format(t, n, k)
@@ -125,6 +128,7 @@ class Store:
def final(self, k, block, tx, error=False):
entry = QueueEntry(self, k)
entry.load()
logg.debug('entry {} {}'.format(k, entry.k))
if error:
entry.fail(block, tx)
else: