diff --git a/doc/release-notes-5772.md b/doc/release-notes-5772.md new file mode 100644 index 000000000000..e771ebe780e9 --- /dev/null +++ b/doc/release-notes-5772.md @@ -0,0 +1,4 @@ +RPC changes +----------- + +`quorum getdata` RPC will no longer allow `proTxHash` to be specified when `dataMask` is set to `1`. diff --git a/src/rpc/quorums.cpp b/src/rpc/quorums.cpp index 5c6f54414fa2..c209a8e96fbd 100644 --- a/src/rpc/quorums.cpp +++ b/src/rpc/quorums.cpp @@ -813,8 +813,8 @@ static RPCHelpMan quorum_getdata() uint16_t nDataMask = static_cast(ParseInt32V(request.params[3], "dataMask")); uint256 proTxHash; - // Check if request wants ENCRYPTED_CONTRIBUTIONS data if (nDataMask & llmq::CQuorumDataRequest::ENCRYPTED_CONTRIBUTIONS) { + // Require proTxHash if request wants ENCRYPTED_CONTRIBUTIONS data if (!request.params[4].isNull()) { proTxHash = ParseHashV(request.params[4], "proTxHash"); if (proTxHash.IsNull()) { @@ -823,6 +823,9 @@ static RPCHelpMan quorum_getdata() } else { throw JSONRPCError(RPC_INVALID_PARAMETER, "proTxHash missing"); } + } else if (!request.params[4].isNull()) { + // Require no proTxHash otherwise + throw JSONRPCError(RPC_INVALID_PARAMETER, "Should not specify proTxHash"); } const auto quorum = llmq_ctx.qman->GetQuorum(llmqType, quorumHash); diff --git a/test/functional/p2p_quorum_data.py b/test/functional/p2p_quorum_data.py index a85616ad8aa2..4f0182e6b959 100755 --- a/test/functional/p2p_quorum_data.py +++ b/test/functional/p2p_quorum_data.py @@ -395,6 +395,8 @@ def test_watchquorums(): def test_rpc_quorum_getdata_protx_hash(): self.log.info("Test optional proTxHash of `quorum getdata`") + assert_raises_rpc_error(-8, "Should not specify proTxHash", + mn1.get_node(self).quorum, "getdata", 0, 100, quorum_hash, 0x01, mn1.proTxHash) assert_raises_rpc_error(-8, "proTxHash missing", mn1.get_node(self).quorum, "getdata", 0, 100, quorum_hash, 0x02) assert_raises_rpc_error(-8, "proTxHash invalid",