-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
feat: implement new RPCs getrawislocks and getrawbestchainlock #6455
base: develop
Are you sure you want to change the base?
Conversation
Guix Automation has began to build this PR tagged as v22.1.0-devpr6455.a4256c92. A new comment will be made when the image is pushed. |
Guix Automation has completed; a release should be present here: https://github.com/dashpay/dash-dev-branches/releases/tag/v22.1.0-devpr6455.a4256c92. The image should be on dockerhub soon. |
src/rpc/rawtransaction.cpp
Outdated
for (const auto idx : irange::range(txids.size())) { | ||
const uint256 txid(ParseHashV(txids[idx], "txid")); | ||
|
||
LLMQContext& llmq_ctx = EnsureLLMQContext(node); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider defining llmq_ctx
outside the loop
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will wait feedback from pshenmic first
src/rpc/rawtransaction.cpp
Outdated
const uint256 txid(ParseHashV(txids[idx], "txid")); | ||
|
||
LLMQContext& llmq_ctx = EnsureLLMQContext(node); | ||
llmq::CInstantSendLockPtr islock = llmq_ctx.isman->GetInstantSendLockByTxid(txid); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider
if (auto islock = CHECK_NONFATAL(llmq_ctx.isman)->GetInstantSendLockByTxid(txid); islock != nullptr) {
CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION);
ssTx << *islock;
result_arr.push_back(HexStr(ssTx));
} else {
result_arr.push_back("None");
}
Guix Automation has began to build this PR tagged as v22.1.0-devpr6455.756b7722. A new comment will be made when the image is pushed. |
WalkthroughThe pull request introduces enhancements to the blockchain and transaction-related RPC interfaces in the Dash cryptocurrency implementation. Specifically, two new RPC methods are added: The These additions are accompanied by updates to the RPC command registration process in the relevant source files. The changes include modifying the Corresponding functional tests have been added to the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
src/rpc/rawtransaction.cpp (1)
369-420
: LGTM! Implementation looks solid.The new RPC method is well-structured with proper input validation, error handling, and serialization.
Consider using CHECK_NONFATAL for llmq_ctx.isman
For better error handling consistency with the codebase:
-if (const llmq::CInstantSendLockPtr islock = llmq_ctx.isman->GetInstantSendLockByTxid(txid); islock != nullptr) { +if (const llmq::CInstantSendLockPtr islock = CHECK_NONFATAL(llmq_ctx.isman)->GetInstantSendLockByTxid(txid); islock != nullptr) {src/rpc/blockchain.cpp (1)
272-301
: LGTM! Implementation looks solid.The new RPC method is well-structured with proper error handling and serialization.
Consider using RPC_INVALID_REQUEST for consistency
For better error code consistency with other RPC methods:
- throw JSONRPCError(RPC_MISC_ERROR, "Unable to find any ChainLock"); + throw JSONRPCError(RPC_INVALID_REQUEST, "Unable to find any ChainLock");
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
src/rpc/blockchain.cpp
(2 hunks)src/rpc/client.cpp
(1 hunks)src/rpc/rawtransaction.cpp
(3 hunks)test/functional/interface_zmq_dash.py
(4 hunks)
🔇 Additional comments (4)
src/rpc/client.cpp (1)
118-118
: LGTM!The new entry for
getrawislocks
is correctly added to thevRPCConvertParams
array, maintaining alphabetical order and following the established pattern.test/functional/interface_zmq_dash.py (1)
139-140
: LGTM! Test coverage looks good.The added test assertions provide good coverage for both the new RPC methods:
- Tests error case for
getrawbestchainlock
when no ChainLock exists- Tests both negative and positive cases for
getrawislocks
(before and after InstantSend lock)Also applies to: 291-291, 311-311
src/rpc/rawtransaction.cpp (1)
1984-1984
: LGTM! Command registration looks good.The new RPC command is properly registered in the command table.
src/rpc/blockchain.cpp (1)
2705-2705
: LGTM! Command registration looks good.The new RPC command is properly registered in the command table.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's rework to combine with getbestchainlock and add json to islock
as discussed, RPC will be changed:
|
Guix Automation has completed; a release should be present here: https://github.com/dashpay/dash-dev-branches/releases/tag/v22.1.0-devpr6455.756b7722. The image should be on dockerhub soon. |
Issue being fixed or feature implemented
#6391
What was done?
Implemented 2 new RPC
getrawislocks
andgetrawbestchainlock
which output is similar to ZMQ output.How Has This Been Tested?
See new asserts in functional test interface_zmq_dash.py
Breaking Changes
N/A
Checklist: