Add test for nonce txs, paused txs queries

This commit is contained in:
nolash 2021-04-02 14:56:57 +02:00
parent fb14961c1b
commit 39afbb71c1
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746

View File

@ -123,7 +123,7 @@ def get_nonce_tx_cache(chain_spec, nonce, sender, decoder=None):
for r in q.all(): for r in q.all():
tx_signed_bytes = bytes.fromhex(r.signed_tx) tx_signed_bytes = bytes.fromhex(r.signed_tx)
if decoder != None: if decoder != None:
tx = unpack(tx_signed_bytes, chain_id) tx = decoder(tx_signed_bytes, chain_spec)
if sender != None and tx['from'] != sender: if sender != None and tx['from'] != sender:
raise IntegrityError('Cache sender {} does not match sender in tx {} using decoder {}'.format(sender, r.tx_hash, str(decoder))) raise IntegrityError('Cache sender {} does not match sender in tx {} using decoder {}'.format(sender, r.tx_hash, str(decoder)))
txs[r.tx_hash] = r.signed_tx txs[r.tx_hash] = r.signed_tx
@ -168,13 +168,11 @@ def get_paused_tx_cache(chain_spec, status=None, sender=None, session=None, deco
for r in q.all(): for r in q.all():
tx_signed_bytes = bytes.fromhex(r.signed_tx) tx_signed_bytes = bytes.fromhex(r.signed_tx)
if decoder != None: if decoder != None:
tx = unpack(tx_signed_bytes, chain_id) tx = decoder(tx_signed_bytes, chain_spec)
if sender != None and tx['from'] != sender: if sender != None and tx['from'] != sender:
raise IntegrityError('Cache sender {} does not match sender in tx {} using decoder {}'.format(sender, r.tx_hash, str(decoder))) raise IntegrityError('Cache sender {} does not match sender in tx {} using decoder {}'.format(sender, r.tx_hash, str(decoder)))
gas += tx['gas'] * tx['gasPrice'] gas += tx['gas'] * tx['gasPrice']
#tx = unpack(tx_signed_bytes, chain_id)
#if sender == None or tx['from'] == sender:
txs[r.tx_hash] = r.signed_tx txs[r.tx_hash] = r.signed_tx
SessionBase.release_session(session) SessionBase.release_session(session)