From 73f097f2bed1a88164b56a86f1da3afb3ebd38d7 Mon Sep 17 00:00:00 2001 From: nolash Date: Fri, 2 Apr 2021 19:48:13 +0200 Subject: [PATCH] Move chainspec to first position increate method --- chainqueue/query.py | 3 --- chainqueue/tx.py | 2 +- setup.cfg | 3 +++ tests/base.py | 2 +- tests/test_query.py | 8 ++++---- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/chainqueue/query.py b/chainqueue/query.py index a2bd6de..4ec58c7 100644 --- a/chainqueue/query.py +++ b/chainqueue/query.py @@ -240,8 +240,6 @@ def get_upcoming_tx(chain_spec, status=StatusEnum.READYSEND, not_status=None, re func.min(Otx.nonce).label('nonce'), ) q_outer = q_outer.join(TxCache) - q_outer = q_outer.join(Lock, isouter=True) - q_outer = q_outer.filter(or_(Lock.flags==None, Lock.flags.op('&')(LockEnum.SEND.value)==0)) if not is_alive(status): SessionBase.release_session(session) @@ -339,4 +337,3 @@ def get_account_tx(chain_spec, address, as_sender=True, as_recipient=True, count session.close() return txs - diff --git a/chainqueue/tx.py b/chainqueue/tx.py index e2926f1..22a8716 100644 --- a/chainqueue/tx.py +++ b/chainqueue/tx.py @@ -13,7 +13,7 @@ from chainqueue.error import TxStateChangeError logg = logging.getLogger().getChild(__name__) -def create(nonce, holder_address, tx_hash, signed_tx, chain_spec, obsolete_predecessors=True, session=None): +def create(chain_spec, nonce, holder_address, tx_hash, signed_tx, obsolete_predecessors=True, session=None): """Create a new transaction queue record. :param nonce: Transaction nonce diff --git a/setup.cfg b/setup.cfg index d35617a..1a9f6b5 100644 --- a/setup.cfg +++ b/setup.cfg @@ -28,6 +28,9 @@ licence_files = python_requires = >= 3.6 packages = chainqueue + chainqueue.db + chainqueue.db.models + chainqueue.db.migrations #[options.entry_points] #console_scripts = diff --git a/tests/base.py b/tests/base.py index 4b490ce..5fc6e7e 100644 --- a/tests/base.py +++ b/tests/base.py @@ -73,7 +73,7 @@ class TestOtxBase(TestBase): self.nonce = 42 self.alice = add_0x(os.urandom(20).hex()) - tx_hash = create(self.nonce, self.alice, self.tx_hash, self.tx, self.chain_spec, session=self.session) + tx_hash = create(self.chain_spec, self.nonce, self.alice, self.tx_hash, self.tx, session=self.session) self.assertEqual(tx_hash, self.tx_hash) diff --git a/tests/test_query.py b/tests/test_query.py index d3f3c10..c068799 100644 --- a/tests/test_query.py +++ b/tests/test_query.py @@ -41,11 +41,11 @@ class TestTxQuery(TestTxBase): tx_hash = add_0x(os.urandom(32).hex()) signed_tx = add_0x(os.urandom(128).hex()) create( + self.chain_spec, 42, self.alice, tx_hash, signed_tx, - self.chain_spec, session=self.session, ) txc = TxCache( @@ -66,11 +66,11 @@ class TestTxQuery(TestTxBase): tx_hash = add_0x(os.urandom(32).hex()) signed_tx = add_0x(os.urandom(128).hex()) create( + self.chain_spec, 41, self.alice, tx_hash, signed_tx, - self.chain_spec, session=self.session, ) txc = TxCache( @@ -98,11 +98,11 @@ class TestTxQuery(TestTxBase): tx_hash = add_0x(os.urandom(32).hex()) signed_tx = add_0x(os.urandom(128).hex()) create( + self.chain_spec, 43, self.alice, tx_hash, signed_tx, - self.chain_spec, session=self.session, ) txc = TxCache( @@ -127,11 +127,11 @@ class TestTxQuery(TestTxBase): tx_hash = add_0x(os.urandom(32).hex()) signed_tx = add_0x(os.urandom(128).hex()) create( + self.chain_spec, 42, self.bob, tx_hash, signed_tx, - self.chain_spec, session=self.session, ) txc = TxCache(