A couple of fixes for masternode list rpc (#2615)

* fix payee

* add keyidowner/keyidvoting/pubkeyoperator ifields/filter to "json" option

* fix whitespaces
This commit is contained in:
UdjinM6 2019-01-08 13:36:35 +03:00 committed by GitHub
parent fa18d3e102
commit 55f205eba1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -549,7 +549,7 @@ UniValue masternodelist(const JSONRPCRequest& request)
streamInfo << std::setw(18) << streamInfo << std::setw(18) <<
dmnToStatus(dmn) << " " << dmnToStatus(dmn) << " " <<
payeeStr << " " << payeeStr << " " <<
dmn->pdmnState->addr.ToString(); dmn->pdmnState->addr.ToString();
std::string strInfo = streamInfo.str(); std::string strInfo = streamInfo.str();
if (strFilter !="" && strInfo.find(strFilter) == std::string::npos && if (strFilter !="" && strInfo.find(strFilter) == std::string::npos &&
strOutpoint.find(strFilter) == std::string::npos) return; strOutpoint.find(strFilter) == std::string::npos) return;
@ -557,19 +557,25 @@ UniValue masternodelist(const JSONRPCRequest& request)
} else if (strMode == "json") { } else if (strMode == "json") {
std::ostringstream streamInfo; std::ostringstream streamInfo;
streamInfo << dmn->pdmnState->addr.ToString() << " " << streamInfo << dmn->pdmnState->addr.ToString() << " " <<
CBitcoinAddress(dmn->pdmnState->scriptPayout).ToString() << " " << payeeStr << " " <<
dmnToStatus(dmn) << " " << dmnToStatus(dmn) << " " <<
dmnToLastPaidTime(dmn) << " " << dmnToLastPaidTime(dmn) << " " <<
dmn->pdmnState->nLastPaidHeight; dmn->pdmnState->nLastPaidHeight << " " <<
HexStr(dmn->pdmnState->keyIDOwner) << " " <<
HexStr(dmn->pdmnState->keyIDVoting) << " " <<
dmn->pdmnState->pubKeyOperator.ToString();
std::string strInfo = streamInfo.str(); std::string strInfo = streamInfo.str();
if (strFilter !="" && strInfo.find(strFilter) == std::string::npos && if (strFilter !="" && strInfo.find(strFilter) == std::string::npos &&
strOutpoint.find(strFilter) == std::string::npos) return; strOutpoint.find(strFilter) == std::string::npos) return;
UniValue objMN(UniValue::VOBJ); UniValue objMN(UniValue::VOBJ);
objMN.push_back(Pair("address", dmn->pdmnState->addr.ToString())); objMN.push_back(Pair("address", dmn->pdmnState->addr.ToString()));
objMN.push_back(Pair("payee", CBitcoinAddress(dmn->pdmnState->scriptPayout).ToString())); objMN.push_back(Pair("payee", payeeStr));
objMN.push_back(Pair("status", dmnToStatus(dmn))); objMN.push_back(Pair("status", dmnToStatus(dmn)));
objMN.push_back(Pair("lastpaidtime", dmnToLastPaidTime(dmn))); objMN.push_back(Pair("lastpaidtime", dmnToLastPaidTime(dmn)));
objMN.push_back(Pair("lastpaidblock", dmn->pdmnState->nLastPaidHeight)); objMN.push_back(Pair("lastpaidblock", dmn->pdmnState->nLastPaidHeight));
objMN.push_back(Pair("keyidowner", HexStr(dmn->pdmnState->keyIDOwner)));
objMN.push_back(Pair("keyidvoting", HexStr(dmn->pdmnState->keyIDVoting)));
objMN.push_back(Pair("pubkeyoperator", dmn->pdmnState->pubKeyOperator.ToString()));
obj.push_back(Pair(strOutpoint, objMN)); obj.push_back(Pair(strOutpoint, objMN));
} else if (strMode == "lastpaidblock") { } else if (strMode == "lastpaidblock") {
if (strFilter !="" && strOutpoint.find(strFilter) == std::string::npos) return; if (strFilter !="" && strOutpoint.find(strFilter) == std::string::npos) return;