Review report

bitcoin/bitcoin: PR #36642

1 suggestion

Optional improvements

Link

[suggestion] · The new batch tests do not require a null error id

Both new batch cases would accept an incorrect numeric error id, so comparing the complete invalid-element reply would better protect the reset behavior.

Location: test/functional/interface_rpc.py:186 (head).

Details and suggested fix

For the non-object element, parse() resets the id to null and the version to legacy before throwing. The batch handler therefore produces invalid_element = {"result": None, "error": {"code": RPC_INVALID_REQUEST, "message": "Invalid Request object"}, "id": None} in both cases. However, changing the new id reset to a numeric value such as 0 would still satisfy both tests. The notification case also checks no id at all: if it remained absent while the version reset to legacy, the error would be included without an id and that case would accept it. Compare response[1] with invalid_element in the first case and response with [invalid_element] in the second. This pins down the intended error reply and makes the assert_not_equal import unnecessary.


Coverage details