Add checked date bump
This commit is contained in:
parent
70f03d1b9d
commit
4c520e3433
@ -185,10 +185,10 @@ def get_paused_tx_cache(chain_spec, status=None, sender=None, session=None, deco
|
|||||||
q = q.filter(Otx.status>StatusEnum.PENDING.value)
|
q = q.filter(Otx.status>StatusEnum.PENDING.value)
|
||||||
q = q.filter(not_(Otx.status.op('&')(StatusBits.IN_NETWORK.value)==0))
|
q = q.filter(not_(Otx.status.op('&')(StatusBits.IN_NETWORK.value)==0))
|
||||||
q = q.filter(not_(Otx.status.op('&')(StatusBits.FINAL.value)==0))
|
q = q.filter(not_(Otx.status.op('&')(StatusBits.FINAL.value)==0))
|
||||||
if sender != None:
|
|
||||||
q = q.filter(TxCache.sender==sender)
|
|
||||||
if exclude_obsolete:
|
if exclude_obsolete:
|
||||||
q = q.filter(not_(Otx.status.op('&')(StatusBits.OBSOLETE.value)==0))
|
q = q.filter(not_(Otx.status.op('&')(StatusBits.OBSOLETE.value)==0))
|
||||||
|
if sender != None:
|
||||||
|
q = q.filter(TxCache.sender==sender)
|
||||||
|
|
||||||
txs = {}
|
txs = {}
|
||||||
gas = 0
|
gas = 0
|
||||||
@ -210,7 +210,7 @@ def get_paused_tx_cache(chain_spec, status=None, sender=None, session=None, deco
|
|||||||
return txs
|
return txs
|
||||||
|
|
||||||
|
|
||||||
def get_status_tx_cache(chain_spec, status, not_status=None, before=None, exact=False, limit=0, session=None, decoder=None):
|
def get_status_tx_cache(chain_spec, status, not_status=None, before=None, exact=False, compare_checked=False, limit=0, session=None, decoder=None):
|
||||||
"""Retrieve transaction with a specific queue status.
|
"""Retrieve transaction with a specific queue status.
|
||||||
|
|
||||||
:param chain_spec: Chain spec for transaction network
|
:param chain_spec: Chain spec for transaction network
|
||||||
@ -235,7 +235,10 @@ def get_status_tx_cache(chain_spec, status, not_status=None, before=None, exact=
|
|||||||
q = session.query(Otx)
|
q = session.query(Otx)
|
||||||
q = q.join(TxCache)
|
q = q.join(TxCache)
|
||||||
if before != None:
|
if before != None:
|
||||||
q = q.filter(Otx.date_updated<before)
|
if compare_checked:
|
||||||
|
q = q.filter(Otx.date_updated<before)
|
||||||
|
else:
|
||||||
|
q = q.filter(TxCache.date_checked<before)
|
||||||
if exact:
|
if exact:
|
||||||
q = q.filter(Otx.status==status)
|
q = q.filter(Otx.status==status)
|
||||||
else:
|
else:
|
||||||
|
@ -424,3 +424,33 @@ def obsolete_by_cache(chain_spec, tx_hash, final, session=None):
|
|||||||
SessionBase.release_session(session)
|
SessionBase.release_session(session)
|
||||||
|
|
||||||
return tx_hash
|
return tx_hash
|
||||||
|
|
||||||
|
|
||||||
|
def set_checked(chain_spec, tx_hash, session=None):
|
||||||
|
"""Set the checked date for the transaction to current datetime
|
||||||
|
|
||||||
|
:param chain_spec: Chain spec for transaction network
|
||||||
|
:type chain_spec: chainlib.chain.ChainSpec
|
||||||
|
:param tx_hash: Transaction hash of record to modify
|
||||||
|
:type tx_hash: str, 0x-hex
|
||||||
|
:param session: Backend state integrity session
|
||||||
|
:type session: varies
|
||||||
|
:raises NotLocalTxError: If transaction not found in queue.
|
||||||
|
:rtype: str
|
||||||
|
:returns: Transaction hash, in hex
|
||||||
|
"""
|
||||||
|
|
||||||
|
session = SessionBase.bind_session(session)
|
||||||
|
o = TxCache.load(tx_hash, session=session)
|
||||||
|
if o == None:
|
||||||
|
SessionBase.release_session(session)
|
||||||
|
raise NotLocalTxError('queue does not contain tx hash {}'.format(tx_hash))
|
||||||
|
|
||||||
|
session.flush()
|
||||||
|
|
||||||
|
o.check()
|
||||||
|
session.add(o)
|
||||||
|
session.commit()
|
||||||
|
SessionBase.release_session(session)
|
||||||
|
|
||||||
|
return tx_hash
|
||||||
|
Loading…
Reference in New Issue
Block a user