diff --git a/blockchain_connector/docker/Dockerfile-ethereum b/blockchain_connector/docker/Dockerfile-ethereum index 5901a9306..a1b8525bd 100644 --- a/blockchain_connector/docker/Dockerfile-ethereum +++ b/blockchain_connector/docker/Dockerfile-ethereum @@ -122,6 +122,9 @@ RUN apt-get update \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* +# Required to create nested asyncio loop +RUN pip3 install nest_asyncio + # Installing web3 for ethereum RUN pip3 install --upgrade setuptools json-rpc web3 py-solc-x nose2 diff --git a/blockchain_connector/ethereum/ethereum_connector/ethereum_connector.py b/blockchain_connector/ethereum/ethereum_connector/ethereum_connector.py index 881e7b9c3..3720becd2 100644 --- a/blockchain_connector/ethereum/ethereum_connector/ethereum_connector.py +++ b/blockchain_connector/ethereum/ethereum_connector/ethereum_connector.py @@ -15,6 +15,7 @@ import json import logging import asyncio +import nest_asyncio from avalon_sdk.connector.blockchains.ethereum.ethereum_listener \ import BlockchainInterface, EventProcessor @@ -92,6 +93,7 @@ def workorder_event_handler_func(event, account, contract): # Listening only for workOrderSubmitted event now listener = w3.newListener(contract, "workOrderSubmitted") + nest_asyncio.apply() try: daemon = EventProcessor(self._config) asyncio.get_event_loop().run_until_complete(daemon.start(