prevent newHeads logs with no "data" field from killing sales state machine

This commit is contained in:
Eric 2023-09-19 14:57:53 +10:00
parent f3d4d1cb82
commit 7cba9bd9be
No known key found for this signature in database

View File

@ -70,6 +70,9 @@ func `%`*(blockTag: BlockTag): JsonNode =
# Log
func fromJson*(json: JsonNode, name: string, result: var Log) =
if not (json.hasKey("data") and json.hasKey("topics")):
raise newException(ValueError, "'data' and/or 'topics' fields not found")
var data: seq[byte]
var topics: seq[Topic]
fromJson(json["data"], "data", data)