WIP rehabilitate sync tx

This commit is contained in:
nolash 2021-03-26 07:57:35 +01:00
parent e166f3d101
commit 101a1eb050
Signed by untrusted user who does not match committer: lash
GPG Key ID: 21D2E7BB88C2A746
4 changed files with 20 additions and 11 deletions

View File

@ -474,7 +474,7 @@ def reserve_nonce(self, chained_input, signer_address=None):
@celery_app.task(bind=True, throws=(NotFoundEthException,), base=CriticalWeb3Task)
def sync_tx(self, tx_hash_hex, chain_str):
def sync_tx(self, tx_hash_hex, chain_spec_dict):
"""Force update of network status of a simgle transaction
:param tx_hash_hex: Transaction hash
@ -483,11 +483,11 @@ def sync_tx(self, tx_hash_hex, chain_str):
:type chain_str: str
"""
queue = self.request.delivery_info['routing_key']
queue = self.request.delivery_info.get('routing_key')
chain_spec = ChainSpec.from_chain_str(chain_str)
chain_spec = ChainSpec.from_dict(chain_spec_dict)
conn = RPCConnection.connect()
conn = RPCConnection.connect(chain_spec, 'default')
o = transaction(tx_hash_hex)
tx = conn.do(o)
@ -495,8 +495,7 @@ def sync_tx(self, tx_hash_hex, chain_str):
try:
o = receipt(tx_hash_hex)
rcpt = conn.do(o)
#rcpt = c.w3.eth.getTransactionReceipt(tx_hash_hex)
except NotFoundEthException as e: #web3.exceptions.TransactionNotFound as e:
except NotFoundEthException as e:
pass
if rcpt != None:

View File

@ -63,7 +63,8 @@ SessionBase.connect(dsn, pool_size=16, debug=config.true('DATABASE_DEBUG'))
chain_spec = ChainSpec.from_chain_str(config.get('CIC_CHAIN_SPEC'))
RPCConnection.register_location(config.get('ETH_PROVIDER'), chain_spec, 'default')
#RPCConnection.register_location(config.get('ETH_PROVIDER'), chain_spec, 'default')
cic_base.rpc.setup(chain_spec, config.get('ETH_PROVIDER'))
def main():

View File

@ -1,9 +1,8 @@
cic-base~=0.1.2a22
web3==5.12.2
cic-base~=0.1.2a23
celery==4.4.7
crypto-dev-signer~=0.4.14a8
confini~=0.3.6rc3
cic-eth-registry~=0.5.4a4
cic-eth-registry~=0.5.4a5
#cic-bancor~=0.0.6
redis==3.5.3
alembic==1.4.2

View File

@ -19,6 +19,7 @@ from cic_eth.eth.tx import cache_gas_data
logg = logging.getLogger()
@pytest.mark.skip()
def test_tx_send(
init_database,
default_chain_spec,
@ -26,7 +27,7 @@ def test_tx_send(
eth_signer,
agent_roles,
contract_roles,
celery_worker,
celery_session_worker,
):
chain_id = default_chain_spec.chain_id()
@ -56,3 +57,12 @@ def test_tx_send(
o = receipt(tx_hash_hex)
rcpt = eth_rpc.do(o)
assert rcpt['status'] == 1
def test_sync_tx(
default_chain_spec,
eth_rpc,
eth_signer,
celery_worker,
):
pass