diff --git a/doc/release-notes-5447.md b/doc/release-notes-5447.md new file mode 100644 index 0000000000..ac9e37c390 --- /dev/null +++ b/doc/release-notes-5447.md @@ -0,0 +1,6 @@ +Updated RPCs +-------- + +- `masternodelist`: New mode `hpmn` filters only HPMNs. +- `protx list`: New type `hpmn` filters only HPMNs. + diff --git a/src/rpc/evo.cpp b/src/rpc/evo.cpp index 1823904962..c82d079fc4 100644 --- a/src/rpc/evo.cpp +++ b/src/rpc/evo.cpp @@ -1203,6 +1203,7 @@ static void protx_list_help(const JSONRPCRequest& request) " registered - List all ProTx which are registered at the given chain height.\n" " This will also include ProTx which failed PoSe verification.\n" " valid - List only ProTx which are active/valid at the given chain height.\n" + " hpmn - List only ProTx corresponding to HPMNs at the given chain height.\n" #ifdef ENABLE_WALLET " wallet - List only ProTx which are found in your wallet at the given chain height.\n" " This will also include ProTx which failed PoSe verification.\n" @@ -1348,7 +1349,7 @@ static UniValue protx_list(const JSONRPCRequest& request) } }); #endif - } else if (type == "valid" || type == "registered") { + } else if (type == "valid" || type == "registered" || type == "hpmn") { if (request.params.size() > 3) { protx_list_help(request); } @@ -1364,7 +1365,9 @@ static UniValue protx_list(const JSONRPCRequest& request) CDeterministicMNList mnList = deterministicMNManager->GetListForBlock(::ChainActive()[height]); bool onlyValid = type == "valid"; + bool onlyHPMN = type == "hpmn"; mnList.ForEachMN(onlyValid, [&](const auto& dmn) { + if (onlyHPMN && dmn.nType != MnType::HighPerformance) return; ret.push_back(BuildDMNListEntry(wallet.get(), dmn, detailed)); }); } else { diff --git a/src/rpc/masternode.cpp b/src/rpc/masternode.cpp index 63ebb8a2d7..43ae732b1a 100644 --- a/src/rpc/masternode.cpp +++ b/src/rpc/masternode.cpp @@ -37,6 +37,7 @@ static void masternode_list_help(const JSONRPCRequest& request) "Available modes:\n" " addr - Print ip address associated with a masternode (can be additionally filtered, partial match)\n" " recent - Print info in JSON format for active and recently banned masternodes (can be additionally filtered, partial match)\n" + " hpmn - Print info in JSON format for HPMNs only\n" " full - Print info in format 'status payee lastpaidtime lastpaidblock IP'\n" " (can be additionally filtered, partial match)\n" " info - Print info in format 'status payee IP'\n" @@ -581,7 +582,7 @@ static UniValue masternodelist(const JSONRPCRequest& request) strMode != "owneraddress" && strMode != "votingaddress" && strMode != "lastpaidtime" && strMode != "lastpaidblock" && strMode != "payee" && strMode != "pubkeyoperator" && - strMode != "status" && strMode != "recent")) + strMode != "status" && strMode != "recent" && strMode != "hpmn")) { masternode_list_help(request); } @@ -609,6 +610,7 @@ static UniValue masternodelist(const JSONRPCRequest& request) }; bool showRecentMnsOnly = strMode == "recent"; + bool showHPMNsOnly = strMode == "hpmn"; int tipHeight = WITH_LOCK(cs_main, return ::ChainActive().Tip()->nHeight); mnList.ForEachMN(false, [&](auto& dmn) { if (showRecentMnsOnly && mnList.IsMNPoSeBanned(dmn)) { @@ -616,6 +618,9 @@ static UniValue masternodelist(const JSONRPCRequest& request) return; } } + if (showHPMNsOnly && dmn.nType != MnType::HighPerformance) { + return; + } std::string strOutpoint = dmn.collateralOutpoint.ToStringShort(); Coin coin; @@ -663,7 +668,7 @@ static UniValue masternodelist(const JSONRPCRequest& request) if (strFilter !="" && strInfo.find(strFilter) == std::string::npos && strOutpoint.find(strFilter) == std::string::npos) return; obj.pushKV(strOutpoint, strInfo); - } else if (strMode == "json" || strMode == "recent") { + } else if (strMode == "json" || strMode == "recent" || strMode == "hpmn") { std::ostringstream streamInfo; streamInfo << dmn.proTxHash.ToString() << " " << dmn.pdmnState->addr.ToString() << " " <<