Skip to content

Commit

Permalink
clean up per comments in ethereum#2265
Browse files Browse the repository at this point in the history
  • Loading branch information
pacrob committed Dec 17, 2021
1 parent c70f7fb commit b61c882
Showing 1 changed file with 11 additions and 17 deletions.
28 changes: 11 additions & 17 deletions web3/eth.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import asyncio
from typing import (
Any,
Awaitable,
Expand Down Expand Up @@ -282,12 +283,6 @@ def call_munger(
mungers=[default_root_munger]
)

# _get_transaction_receipt_awaitable: Method[Callable[[_Hash32],
# Awaitable[TxReceipt]]] = Method(
# RPC.eth_getTransactionReceipt,
# mungers=[default_root_munger]
# )


class AsyncEth(BaseEth):
is_async = True
Expand Down Expand Up @@ -423,17 +418,16 @@ async def wait_for_transaction_receipt(
self, transaction_hash: _Hash32, timeout: float = 120, poll_latency: float = 0.1
) -> TxReceipt:
try:
with Timeout(timeout) as _timeout:
while True:
try:
tx_receipt = await self._get_transaction_receipt( # type: ignore
transaction_hash
)
except TransactionNotFound:
tx_receipt = None
if tx_receipt is not None:
break
_timeout.sleep(poll_latency)
while True:
try:
tx_receipt = await self._get_transaction_receipt( # type: ignore
transaction_hash
)
except TransactionNotFound:
tx_receipt = None
if tx_receipt is not None:
break
await asyncio.sleep(poll_latency)
return tx_receipt

except Timeout:
Expand Down

0 comments on commit b61c882

Please sign in to comment.