Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions doc/release-notes-5772.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
RPC changes
-----------

`quorum getdata` RPC will no longer allow `proTxHash` to be specified when `dataMask` is set to `1`.
5 changes: 4 additions & 1 deletion src/rpc/quorums.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -813,8 +813,8 @@ static RPCHelpMan quorum_getdata()
uint16_t nDataMask = static_cast<uint16_t>(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()) {
Expand All @@ -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");
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it easy to make functional test for this case? 🤔

}

const auto quorum = llmq_ctx.qman->GetQuorum(llmqType, quorumHash);
Expand Down
2 changes: 2 additions & 0 deletions test/functional/p2p_quorum_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Loading