Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(rpc)!: require proTxHash to be unspecified when not asking for ENCRYPTED_CONTRIBUTIONS in quorum getdata rpc #5772

Draft
wants to merge 3 commits into
base: develop
Choose a base branch
from
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.
Jump to
Jump to file
Failed to load files.
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 @@ -720,8 +720,8 @@ static UniValue quorum_getdata(const JSONRPCRequest& request, const LLMQContext&
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 @@ -730,6 +730,9 @@ static UniValue quorum_getdata(const JSONRPCRequest& request, const LLMQContext&
} 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
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 CBlockIndex* pQuorumBaseBlockIndex = WITH_LOCK(cs_main, return chainman.m_blockman.LookupBlockIndex(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 @@ -393,6 +393,8 @@ def test_rpc_quorum_getdata_protx_hash():
assert_raises_rpc_error(-8, "proTxHash invalid",
mn1.node.quorum, "getdata", 0, 100, quorum_hash, 0x03,
"0000000000000000000000000000000000000000000000000000000000000000")
assert_raises_rpc_error(-8, "Should not specify proTxHash",
mn1.node.quorum, "getdata", 0, 100, quorum_hash, 0x01, mn1.proTxHash)

# Enable DKG and disable ChainLocks
self.nodes[0].sporkupdate("SPORK_17_QUORUM_DKG_ENABLED", 0)
Expand Down