From 6313374bbd9b98f655dc97b9aeaf36f3b4260e0c Mon Sep 17 00:00:00 2001 From: Odysseas Gabrielides Date: Thu, 7 Apr 2022 00:50:21 +0300 Subject: [PATCH] Show penalty score in masternode rpc (#4751) * Show penalty score in masternode rpc * Added documentation --- doc/release-notes-4751.md | 3 +++ src/rpc/masternode.cpp | 4 ++++ 2 files changed, 7 insertions(+) create mode 100644 doc/release-notes-4751.md diff --git a/doc/release-notes-4751.md b/doc/release-notes-4751.md new file mode 100644 index 0000000000..0adde8ca36 --- /dev/null +++ b/doc/release-notes-4751.md @@ -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. diff --git a/src/rpc/masternode.cpp b/src/rpc/masternode.cpp index f66d36fe07..696193f7d4 100644 --- a/src/rpc/masternode.cpp +++ b/src/rpc/masternode.cpp @@ -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));