chainqueue

Blockchain transaction queue control
Log | Files | Refs | LICENSE

commit c85851f37080ef0a529befcbabbe94814de9cbd0
parent 3b990a9a87ba279986d853d4e3d452ad07dde41d
Author: nolash <dev@holbrook.no>
Date:   Sat, 28 Aug 2021 06:28:38 +0200

Remove inconistent data normalization

Diffstat:
Mchainqueue/encode.py | 3++-
Mchainqueue/sql/query.py | 9+++------
Mchainqueue/sql/tx.py | 3---
3 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/chainqueue/encode.py b/chainqueue/encode.py @@ -30,7 +30,8 @@ class TxHexNormalizer: def __hex_normalize(self, data, context): - r = add_0x(hex_uniform(strip_0x(data))) + #r = add_0x(hex_uniform(strip_0x(data))) + r = hex_uniform(strip_0x(data)) logg.debug('normalize {} {} -> {}'.format(context, data, r)) return r diff --git a/chainqueue/sql/query.py b/chainqueue/sql/query.py @@ -133,8 +133,6 @@ def get_nonce_tx_cache(chain_spec, nonce, sender, decoder=None, session=None): :returns: Transactions :rtype: dict, with transaction hash as key, signed raw transaction as value """ - sender = add_0x(hex_uniform(strip_0x(sender))) - session = SessionBase.bind_session(session) q = session.query(Otx) q = q.join(TxCache) @@ -146,7 +144,7 @@ def get_nonce_tx_cache(chain_spec, nonce, sender, decoder=None, session=None): tx_signed_bytes = bytes.fromhex(r.signed_tx) if decoder != None: tx = decoder(tx_signed_bytes, chain_spec) - tx_from = add_0x(hex_uniform(strip_0x(tx['from']))) + tx_from = tx['from'] if sender != None and tx_from != sender: raise CacheIntegrityError('Cache sender {} does not match sender {} in tx {} using decoder {}'.format(sender, tx_from, r.tx_hash, str(decoder))) txs[r.tx_hash] = r.signed_tx @@ -187,7 +185,6 @@ def get_paused_tx_cache(chain_spec, status=None, sender=None, session=None, deco q = q.filter(not_(Otx.status.op('&')(StatusBits.IN_NETWORK.value)>0)) if sender != None: - sender = add_0x(hex_uniform(strip_0x(sender))) q = q.filter(TxCache.sender==sender) txs = {} @@ -197,7 +194,8 @@ def get_paused_tx_cache(chain_spec, status=None, sender=None, session=None, deco tx_signed_bytes = bytes.fromhex(r.signed_tx) if decoder != None: tx = decoder(tx_signed_bytes, chain_spec) - tx_from = add_0x(hex_uniform(strip_0x(tx['from']))) + #tx_from = add_0x(hex_uniform(strip_0x(tx['from']))) + tx_from = tx['from'] if sender != None and tx_from != sender: raise CacheIntegrityError('Cache sender {} does not match sender {} in tx {} using decoder {}'.format(sender, tx_from, r.tx_hash, str(decoder))) gas += tx['gas'] * tx['gasPrice'] @@ -414,7 +412,6 @@ def get_account_tx(chain_spec, address, as_sender=True, as_recipient=True, count txs = {} session = SessionBase.bind_session(session) - address = add_0x(hex_uniform(strip_0x(address))) try: filter_offset = sql_range_filter(session, criteria=since) diff --git a/chainqueue/sql/tx.py b/chainqueue/sql/tx.py @@ -43,9 +43,6 @@ def create(chain_spec, nonce, holder_address, tx_hash, signed_tx, obsolete_prede """ session = SessionBase.bind_session(session) - holder_address = holder_address.lower() - tx_hash = tx_hash.lower() - signed_tx = signed_tx.lower() o = Otx.add( nonce=nonce, tx_hash=tx_hash,