-
Notifications
You must be signed in to change notification settings - Fork 524
Closed
Description
Monitoring and parsing of transaction fails
Please note: I cross posted this here (from the algosdk), because I am not sure if this is an algod error, or if this is something on the python side. It seems to me that the json itself coming from algod is broken, so this might need to be fixed on the node end.
Using the following code to monitor a transaction for notes will fail randomly because the json of the transaction is malformed.
Steps to reproduce
on testnet:
block = algod_client.block_info(16183011)
Then this happens:
Traceback (most recent call last):
File ".../lib/python3.9/site-packages/algosdk/v2client/algod.py", line 83, in algod_request
return json.load(resp)
File ".../lib/python3.9/json/__init__.py", line 293, in load
return loads(fp.read(),
File ".../lib/python3.9/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File ".../lib/python3.9/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File ".../lib/python3.9/json/decoder.py", line 353, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 82 column 13 (char 2957)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File ".../algorand_test.py", line 186, in <module>
# parse_notes()
File ".../algorand_test.py", line 165, in parse_notes
block = algod_client.block_info(last_round)["block"]
File ".../lib/python3.9/site-packages/algosdk/v2client/algod.py", line 155, in block_info
res = self.algod_request("GET", req, query, response_format=response_format, **kwargs)
File ".../lib/python3.9/site-packages/algosdk/v2client/algod.py", line 85, in algod_request
raise error.AlgodResponseError("Failed to parse JSON response from algod") from e
algosdk.error.AlgodResponseError: Failed to parse JSON response from algod
Your environment
algod -v
2.9.1.stable [rel/stable] (commit #7b53f6f0)
Time since last block: 1.2s
Sync Time: 0.0s
Last consensus protocol: https://github.com/algorandfoundation/specs/tree/abc54f79f9ad679d2d22f0fb9909fb005c16f8a1
Next consensus protocol: https://github.com/algorandfoundation/specs/tree/abc54f79f9ad679d2d22f0fb9909fb005c16f8a1
Round for next consensus protocol: 16183137
Next consensus protocol supported: true
Last Catchpoint:
Genesis ID: testnet-v1.0
Genesis hash: SGO1GKSzyE7IEPItTxCByw9x8FmnrCDexi9/cOUJOiI=
- OS: Arch Linux x86_64, 5.13.10-arch1-1
Expected behaviour
It should not crash.
Actual behaviour
It crashes because the json is broken.