File tree 2 files changed +10
-5
lines changed
2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -169,7 +169,7 @@ def raise_contract_logic_error_on_revert(response: RPCResponse) -> RPCResponse:
169
169
170
170
def raise_transaction_indexing_error_if_indexing (response : RPCResponse ) -> RPCResponse :
171
171
"""
172
- Raise an error if ``eth_getTransactionReceipt`` returns a response indicating that
172
+ Raise an error if ``eth_getTransactionReceipt`` returns an error indicating that
173
173
transactions are still being indexed.
174
174
"""
175
175
Original file line number Diff line number Diff line change @@ -49,16 +49,21 @@ def test_my_w3(w3, request_mocker):
49
49
50
50
async def test_my_w3(async_w3, request_mocker):
51
51
def _iter_responses():
52
- yield {"error": {"code": -32000, "message": "indexing in progress"}}
53
- yield {"error": {"code": -32000, "message": "indexing in progress"}}
54
- yield {"result": "0x1"}
52
+ while True:
53
+ yield {"error": {"message": "transaction indexing in progress"}}
54
+ yield {"error": {"message": "transaction indexing in progress"}}
55
+ yield {"result": {"status": "0x1"}}
55
56
56
57
iter_responses = _iter_responses()
57
58
58
59
async with request_mocker(
59
60
async_w3,
60
- mock_responses={"eth_getTransactionReceipt": next(iter_responses)}
61
+ mock_responses={
62
+ "eth_getTransactionReceipt": lambda *_: next(iter_responses)
63
+ },
61
64
):
65
+ # assert that the first two error responses are handled and the result
66
+ # is eventually returned when present
62
67
assert await w3.eth.get_transaction_receipt("0x1") == "0x1"
63
68
64
69
You can’t perform that action at this time.
0 commit comments