Show penalty score in masternode rpc (#4751)

* Show penalty score in masternode rpc

* Added documentation
This commit is contained in:
Odysseas Gabrielides 2022-04-07 00:50:21 +03:00 committed by GitHub
parent d7bf68d02d
commit 6313374bbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View File

@ -0,0 +1,3 @@
Miscellaneous RPC Changes
-------------------------
- In rpc `masternodelist` with parameters `full`, `info` and `json` the PoS penalty score of the MN will be returned. For `json` parameter, the field `pospenaltyscore` was added.

View File

@ -637,6 +637,7 @@ static UniValue masternodelist(const JSONRPCRequest& request)
std::ostringstream streamFull;
streamFull << std::setw(18) <<
dmnToStatus(dmn) << " " <<
dmn.pdmnState->nPoSePenalty << " " <<
payeeStr << " " << std::setw(10) <<
dmnToLastPaidTime(dmn) << " " << std::setw(6) <<
dmn.pdmnState->nLastPaidHeight << " " <<
@ -649,6 +650,7 @@ static UniValue masternodelist(const JSONRPCRequest& request)
std::ostringstream streamInfo;
streamInfo << std::setw(18) <<
dmnToStatus(dmn) << " " <<
dmn.pdmnState->nPoSePenalty << " " <<
payeeStr << " " <<
dmn.pdmnState->addr.ToString();
std::string strInfo = streamInfo.str();
@ -661,6 +663,7 @@ static UniValue masternodelist(const JSONRPCRequest& request)
dmn.pdmnState->addr.ToString() << " " <<
payeeStr << " " <<
dmnToStatus(dmn) << " " <<
dmn.pdmnState->nPoSePenalty << " " <<
dmnToLastPaidTime(dmn) << " " <<
dmn.pdmnState->nLastPaidHeight << " " <<
EncodeDestination(dmn.pdmnState->keyIDOwner) << " " <<
@ -675,6 +678,7 @@ static UniValue masternodelist(const JSONRPCRequest& request)
objMN.pushKV("address", dmn.pdmnState->addr.ToString());
objMN.pushKV("payee", payeeStr);
objMN.pushKV("status", dmnToStatus(dmn));
objMN.pushKV("pospenaltyscore", dmn.pdmnState->nPoSePenalty);
objMN.pushKV("lastpaidtime", dmnToLastPaidTime(dmn));
objMN.pushKV("lastpaidblock", dmn.pdmnState->nLastPaidHeight);
objMN.pushKV("owneraddress", EncodeDestination(dmn.pdmnState->keyIDOwner));