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
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ if test "$enable_debug" = "yes"; then
AX_CHECK_PREPROC_FLAG([-DDEBUG_CORE], [DEBUG_CPPFLAGS="$DEBUG_CPPFLAGS -DDEBUG_CORE"], [], [$CXXFLAG_WERROR])
AX_CHECK_PREPROC_FLAG([-DDEBUG_LOCKORDER], [DEBUG_CPPFLAGS="$DEBUG_CPPFLAGS -DDEBUG_LOCKORDER"], [], [$CXXFLAG_WERROR])
AX_CHECK_PREPROC_FLAG([-DDEBUG_LOCKCONTENTION], [DEBUG_CPPFLAGS="$DEBUG_CPPFLAGS -DDEBUG_LOCKCONTENTION"], [], [$CXXFLAG_WERROR])
AX_CHECK_PREPROC_FLAG([-DRPC_DOC_CHECK], [DEBUG_CPPFLAGS="$DEBUG_CPPFLAGS -DRPC_DOC_CHECK"], [], [$CXXFLAG_WERROR])
AX_CHECK_PREPROC_FLAG([-DABORT_ON_FAILED_ASSUME], [DEBUG_CPPFLAGS="$DEBUG_CPPFLAGS -DABORT_ON_FAILED_ASSUME"], [], [$CXXFLAG_WERROR])
AX_CHECK_COMPILE_FLAG([-ftrapv], [DEBUG_CXXFLAGS="$DEBUG_CXXFLAGS -ftrapv"], [], [$CXXFLAG_WERROR])
else
Expand Down
5 changes: 5 additions & 0 deletions doc/release-notes/release-notes-24408.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
New RPCs
--------

- A new `gettxspendingprevout` RPC has been added, which scans the mempool to find
transactions spending any of the given outpoints. (#24408)
1 change: 1 addition & 0 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,7 @@ void SetupServerArgs(ArgsManager& argsman)
argsman.AddArg("-rpcallowip=<ip>", "Allow JSON-RPC connections from specified source. Valid values for <ip> are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0), a network/CIDR (e.g. 1.2.3.4/24), all ipv4 (0.0.0.0/0), or all ipv6 (::/0). This option can be specified multiple times", ArgsManager::ALLOW_ANY, OptionsCategory::RPC);
argsman.AddArg("-rpcauth=<userpw>", "Username and HMAC-SHA-256 hashed password for JSON-RPC connections. The field <userpw> comes in the format: <USERNAME>:<SALT>$<HASH>. A canonical python script is included in share/rpcuser. The client then connects normally using the rpcuser=<USERNAME>/rpcpassword=<PASSWORD> pair of arguments. This option can be specified multiple times", ArgsManager::ALLOW_ANY | ArgsManager::SENSITIVE, OptionsCategory::RPC);
argsman.AddArg("-rpcbind=<addr>[:port]", "Bind to given address to listen for JSON-RPC connections. Do not expose the RPC server to untrusted networks such as the public internet! This option is ignored unless -rpcallowip is also passed. Port is optional and overrides -rpcport. Use [host]:port notation for IPv6. This option can be specified multiple times (default: 127.0.0.1 and ::1 i.e., localhost, or if -rpcallowip has been specified, 0.0.0.0 and :: i.e., all addresses)", ArgsManager::ALLOW_ANY | ArgsManager::NETWORK_ONLY, OptionsCategory::RPC);
argsman.AddArg("-rpcdoccheck", strprintf("Throw a non-fatal error at runtime if the documentation for an RPC is incorrect (default: %u)", DEFAULT_RPC_DOC_CHECK), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::RPC);
argsman.AddArg("-rpccookiefile=<loc>", "Location of the auth cookie. Relative paths will be prefixed by a net-specific datadir location. (default: data dir)", ArgsManager::ALLOW_ANY, OptionsCategory::RPC);
argsman.AddArg("-rpcexternaluser=<users>", "List of comma-separated usernames for JSON-RPC external connections", ArgsManager::ALLOW_ANY | ArgsManager::SENSITIVE, OptionsCategory::RPC);
argsman.AddArg("-rpcexternalworkqueue=<n>", strprintf("Set the depth of the work queue to service external RPC calls (default: %d)", DEFAULT_HTTP_WORKQUEUE), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::RPC);
Expand Down
76 changes: 34 additions & 42 deletions src/rpc/blockchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2759,48 +2759,40 @@ UniValue CreateUTXOSnapshot(
return result;
}


void RegisterBlockchainRPCCommands(CRPCTable &t)
{
// clang-format off
static const CRPCCommand commands[] =
{ // category actor (function)
// --------------------- ------------------------
{ "blockchain", &getblockchaininfo, },
{ "blockchain", &getchaintxstats, },
{ "blockchain", &getblockstats, },
{ "blockchain", &getbestblockhash, },
{ "blockchain", &getbestchainlock, },
{ "blockchain", &getblockcount, },
{ "blockchain", &getblock, },
{ "blockchain", &getblockfrompeer, },
{ "blockchain", &getblockhashes, },
{ "blockchain", &getblockhash, },
{ "blockchain", &getblockheader, },
{ "blockchain", &getblockheaders, },
{ "blockchain", &getmerkleblocks, },
{ "blockchain", &getchaintips, },
{ "blockchain", &getdifficulty, },
{ "blockchain", &getspecialtxes, },
{ "blockchain", &gettxout, },
{ "blockchain", &gettxoutsetinfo, },
{ "blockchain", &pruneblockchain, },
{ "blockchain", &verifychain, },

{ "blockchain", &preciousblock, },
{ "blockchain", &scantxoutset, },
{ "blockchain", &getblockfilter, },

/* Not shown in help */
{ "hidden", &invalidateblock, },
{ "hidden", &reconsiderblock, },
{ "hidden", &waitfornewblock, },
{ "hidden", &waitforblock, },
{ "hidden", &waitforblockheight, },
{ "hidden", &syncwithvalidationinterfacequeue, },
{ "hidden", &dumptxoutset, },
};
// clang-format on
void RegisterBlockchainRPCCommands(CRPCTable& t)
{
static const CRPCCommand commands[]{
{"blockchain", &getblockchaininfo},
{"blockchain", &getchaintxstats},
{"blockchain", &getblockstats},
{"blockchain", &getbestblockhash},
{"blockchain", &getbestchainlock},
{"blockchain", &getblockcount},
{"blockchain", &getblock},
{"blockchain", &getblockfrompeer},
{"blockchain", &getblockhashes},
{"blockchain", &getblockhash},
{"blockchain", &getblockheader},
{"blockchain", &getblockheaders},
{"blockchain", &getmerkleblocks},
{"blockchain", &getchaintips},
{"blockchain", &getdifficulty},
{"blockchain", &getspecialtxes},
{"blockchain", &gettxout},
{"blockchain", &gettxoutsetinfo},
{"blockchain", &pruneblockchain},
{"blockchain", &verifychain},
{"blockchain", &preciousblock},
{"blockchain", &scantxoutset},
{"blockchain", &getblockfilter},
{"hidden", &invalidateblock},
{"hidden", &reconsiderblock},
{"hidden", &waitfornewblock},
{"hidden", &waitforblock},
{"hidden", &waitforblockheight},
{"hidden", &syncwithvalidationinterfacequeue},
{"hidden", &dumptxoutset},
};
for (const auto& c : commands) {
t.appendCommand(c.name, &c);
}
Expand Down
1 change: 1 addition & 0 deletions src/rpc/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ static const CRPCConvertParam vRPCConvertParams[] =
{ "setwalletflag", 1, "value" },
{ "getmempoolancestors", 1, "verbose" },
{ "getmempooldescendants", 1, "verbose" },
{ "gettxspendingprevout", 0, "outputs" },
{ "logging", 0, "include" },
{ "logging", 1, "exclude" },
{ "sporkupdate", 1, "value" },
Expand Down
42 changes: 17 additions & 25 deletions src/rpc/coinjoin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ static RPCHelpMan coinjoin()
{
{"command", RPCArg::Type::STR, RPCArg::Optional::NO, "The command to execute"},
},
RPCResults{},
RPCResult{RPCResult::Type::NONE, "", ""},
RPCExamples{""},
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
{
Expand Down Expand Up @@ -231,7 +231,7 @@ static RPCHelpMan coinjoinsalt()
{
{"command", RPCArg::Type::STR, RPCArg::Optional::NO, "The command to execute"},
},
RPCResults{},
RPCResult{RPCResult::Type::NONE, "", ""},
RPCExamples{""},
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
{
Expand Down Expand Up @@ -503,35 +503,27 @@ static RPCHelpMan getcoinjoininfo()
#ifdef ENABLE_WALLET
Span<const CRPCCommand> GetWalletCoinJoinRPCCommands()
{
// clang-format off
static const CRPCCommand commands[] =
{ // category actor (function)
// --------------------- -----------------------
{ "dash", &coinjoin, },
{ "dash", &coinjoin_reset, },
{ "dash", &coinjoin_start, },
{ "dash", &coinjoin_status, },
{ "dash", &coinjoin_stop, },
{ "dash", &coinjoinsalt, },
{ "dash", &coinjoinsalt_generate, },
{ "dash", &coinjoinsalt_get, },
{ "dash", &coinjoinsalt_set, },
{ "dash", &getcoinjoininfo, },
};
// clang-format on
static const CRPCCommand commands[]{
{"dash", &coinjoin},
{"dash", &coinjoin_reset},
{"dash", &coinjoin_start},
{"dash", &coinjoin_status},
{"dash", &coinjoin_stop},
{"dash", &coinjoinsalt},
{"dash", &coinjoinsalt_generate},
{"dash", &coinjoinsalt_get},
{"dash", &coinjoinsalt_set},
{"dash", &getcoinjoininfo},
};
return commands;
}
#endif // ENABLE_WALLET

void RegisterCoinJoinRPCCommands(CRPCTable& t)
{
// clang-format off
static const CRPCCommand commands_wallet[] =
{ // category actor (function)
// --------------------- -----------------------
{ "dash", &getcoinjoininfo, },
};
// clang-format on
static const CRPCCommand commands_wallet[]{
{"dash", &getcoinjoininfo},
};
// If we aren't compiling with wallet support, we still need to register RPCs that are
// capable of working without wallet support. We have to do this even if wallet support
// is compiled in but is disabled at runtime because runtime disablement prohibits
Expand Down
123 changes: 78 additions & 45 deletions src/rpc/evo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1404,7 +1404,16 @@ static RPCHelpMan protx_list()
{"detailed", RPCArg::Type::BOOL, RPCArg::Default{false}, "If not specified, only the hashes of the ProTx will be returned."},
{"height", RPCArg::Type::NUM, RPCArg::DefaultHint{"current chain-tip"}, ""},
},
RPCResults{},
RPCResult{
RPCResult::Type::ARR, "", "list of masternodes",
{
{RPCResult::Type::OBJ, "", "",
{
// TODO: list fields of output for RPC help instead ELISION
{RPCResult::Type::ELISION, "", ""}
}},
},
},
RPCExamples{""},
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
{
Expand Down Expand Up @@ -1511,6 +1520,7 @@ static RPCHelpMan protx_info()
RPCResult{
RPCResult::Type::OBJ, "", "Details about a specific deterministic masternode",
{
// TODO: implement proper doc for protx info
{RPCResult::Type::ELISION, "", ""}
}
},
Expand Down Expand Up @@ -1644,8 +1654,40 @@ static RPCHelpMan protx_listdiff()
{"baseBlock", RPCArg::Type::NUM, RPCArg::Optional::NO, "The starting block height."},
{"block", RPCArg::Type::NUM, RPCArg::Optional::NO, "The ending block height."},
},
RPCResults{},
RPCExamples{""},
RPCResult {
RPCResult::Type::OBJ, "", "",
{
{RPCResult::Type::NUM, "baseHeight", "height of base (starting) block"},
{RPCResult::Type::NUM, "blockHeight", "height of target (ending) block"},
{RPCResult::Type::ARR, "addedMNs", "added masternodes",
{
{RPCResult::Type::OBJ, "", "",
{
// TODO: list fields of output for RPC help instead ELISION
{RPCResult::Type::ELISION, "", ""}
}},
},
},
{RPCResult::Type::ARR, "removedMns", "added masternodes",
{
{RPCResult::Type::STR_HEX, "protx", "ProTx of removed masternode"},
},
},
{RPCResult::Type::ARR, "addedMNs", "added masternodes",
{
{RPCResult::Type::OBJ, "", "",
{
{RPCResult::Type::OBJ, "protx", "ProTx of updated masternode",
{
// TODO: list fields of output for RPC help instead ELISION
{RPCResult::Type::ELISION, "", ""}
}},
}},
},
},
},
},
Comment on lines +1657 to +1689
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

protx listdiff result doc: “updatedMNs” mislabeled as “addedMNs”

The result actually returns “updatedMNs” (see Lines 1737–1749), but help documents “addedMNs” twice. Fix the second occurrence to “updatedMNs” and adjust the description.

-                        {RPCResult::Type::ARR, "addedMNs", "added masternodes",
+                        {RPCResult::Type::ARR, "updatedMNs", "updated masternodes",
                             {
                                 {RPCResult::Type::OBJ, "", "",
                                 {
-                                    {RPCResult::Type::OBJ, "protx", "ProTx of updated masternode",
+                                    {RPCResult::Type::OBJ, "protx", "ProTx of updated masternode",
                                     {
                                         // TODO: list fields of output for RPC help instead ELISION
                                         {RPCResult::Type::ELISION, "", ""}
                                     }},
                                 }},
                             },
                         },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
RPCResult {
RPCResult::Type::OBJ, "", "",
{
{RPCResult::Type::NUM, "baseHeight", "height of base (starting) block"},
{RPCResult::Type::NUM, "blockHeight", "height of target (ending) block"},
{RPCResult::Type::ARR, "addedMNs", "added masternodes",
{
{RPCResult::Type::OBJ, "", "",
{
// TODO: list fields of output for RPC help instead ELISION
{RPCResult::Type::ELISION, "", ""}
}},
},
},
{RPCResult::Type::ARR, "removedMns", "added masternodes",
{
{RPCResult::Type::STR_HEX, "protx", "ProTx of removed masternode"},
},
},
{RPCResult::Type::ARR, "addedMNs", "added masternodes",
{
{RPCResult::Type::OBJ, "", "",
{
{RPCResult::Type::OBJ, "protx", "ProTx of updated masternode",
{
// TODO: list fields of output for RPC help instead ELISION
{RPCResult::Type::ELISION, "", ""}
}},
}},
},
},
},
},
RPCResult {
RPCResult::Type::OBJ, "", "",
{
{RPCResult::Type::NUM, "baseHeight", "height of base (starting) block"},
{RPCResult::Type::NUM, "blockHeight", "height of target (ending) block"},
{RPCResult::Type::ARR, "addedMNs", "added masternodes",
{
{RPCResult::Type::OBJ, "", "",
{
// TODO: list fields of output for RPC help instead ELISION
{RPCResult::Type::ELISION, "", ""}
}},
},
},
{RPCResult::Type::ARR, "removedMns", "added masternodes",
{
{RPCResult::Type::STR_HEX, "protx", "ProTx of removed masternode"},
},
},
{RPCResult::Type::ARR, "updatedMNs", "updated masternodes",
{
{RPCResult::Type::OBJ, "", "",
{
{RPCResult::Type::OBJ, "protx", "ProTx of updated masternode",
{
// TODO: list fields of output for RPC help instead ELISION
{RPCResult::Type::ELISION, "", ""}
}},
}},
},
},
},
},
🤖 Prompt for AI Agents
In src/rpc/evo.cpp around lines 1657 to 1689 the second array entry for addedMNs
is incorrectly labeled the same as the first; change the second
{RPCResult::Type::ARR, "addedMNs", "added masternodes", ...} entry to use the
key "updatedMNs" and update its description to "updated masternodes" (and ensure
any accompanying help text reflects that these entries are updated masternodes
rather than added ones).

RPCExamples{""},
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
{
const NodeContext& node = EnsureAnyNodeContext(request.context);
Expand Down Expand Up @@ -1743,7 +1785,7 @@ static RPCHelpMan protx_help()
{
{"command", RPCArg::Type::STR, RPCArg::Optional::NO, "The command to execute"},
},
RPCResults{},
RPCResult{RPCResult::Type::NONE, "", ""},
RPCExamples{""},
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
{
Expand Down Expand Up @@ -1833,7 +1875,7 @@ static RPCHelpMan bls_help()
{
{"command", RPCArg::Type::STR, RPCArg::Optional::NO, "The command to execute"},
},
RPCResults{},
RPCResult{RPCResult::Type::NONE, "", ""},
RPCExamples{""},
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
{
Expand All @@ -1845,52 +1887,43 @@ static RPCHelpMan bls_help()
#ifdef ENABLE_WALLET
Span<const CRPCCommand> GetWalletEvoRPCCommands()
{
// clang-format off
static const CRPCCommand commands[] =
{ // category actor (function)
// --------------------- -----------------------
{ "evo", &protx_list, },
{ "evo", &protx_info, },
{ "evo", &protx_register, },
{ "evo", &protx_register_evo, },
{ "evo", &protx_register_fund, },
{ "evo", &protx_register_fund_evo, },
{ "evo", &protx_register_prepare, },
{ "evo", &protx_register_prepare_evo, },
{ "evo", &protx_update_service, },
{ "evo", &protx_update_service_evo, },
{ "evo", &protx_register_submit, },
{ "evo", &protx_update_registrar, },
{ "evo", &protx_revoke, },
{ "hidden", &protx_register_legacy, },
{ "hidden", &protx_register_fund_legacy, },
{ "hidden", &protx_register_prepare_legacy, },
{ "hidden", &protx_update_registrar_legacy, },
};
// clang-format on
static const CRPCCommand commands[]{
{"evo", &protx_list},
{"evo", &protx_info},
{"evo", &protx_register},
{"evo", &protx_register_evo},
{"evo", &protx_register_fund},
{"evo", &protx_register_fund_evo},
{"evo", &protx_register_prepare},
{"evo", &protx_register_prepare_evo},
{"evo", &protx_update_service},
{"evo", &protx_update_service_evo},
{"evo", &protx_register_submit},
{"evo", &protx_update_registrar},
{"evo", &protx_revoke},
{"hidden", &protx_register_legacy},
{"hidden", &protx_register_fund_legacy},
{"hidden", &protx_register_prepare_legacy},
{"hidden", &protx_update_registrar_legacy},
};
return commands;
}
#endif // ENABLE_WALLET

void RegisterEvoRPCCommands(CRPCTable& tableRPC)
{
// clang-format off
static const CRPCCommand commands[] =
{ // category actor (function)
// --------------------- -----------------------
{ "evo", &bls_help, },
{ "evo", &bls_generate, },
{ "evo", &bls_fromsecret, },
{ "evo", &protx_help, },
{ "evo", &protx_diff, },
{ "evo", &protx_listdiff, },
};
static const CRPCCommand commands_wallet[] =
{
{ "evo", &protx_list, },
{ "evo", &protx_info, },
};
// clang-format on
static const CRPCCommand commands[]{
{"evo", &bls_help},
{"evo", &bls_generate},
{"evo", &bls_fromsecret},
{"evo", &protx_help},
{"evo", &protx_diff},
{"evo", &protx_listdiff},
};
static const CRPCCommand commands_wallet[]{
{"evo", &protx_list},
{"evo", &protx_info},
};
for (const auto& command : commands) {
tableRPC.appendCommand(command.name, &command);
}
Expand Down
Loading
Loading