mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 04:22:55 +01:00
Add helpers GetSentinelString() and GetDaemonString() to CMasternodePing (#2192)
This commit is contained in:
parent
a5643f899d
commit
65b9045269
@ -930,6 +930,16 @@ void CMasternodePing::Relay(CConnman& connman)
|
||||
connman.RelayInv(inv);
|
||||
}
|
||||
|
||||
std::string CMasternodePing::GetSentinelString() const
|
||||
{
|
||||
return nSentinelVersion > DEFAULT_SENTINEL_VERSION ? SafeIntVersionToString(nSentinelVersion) : "Unknown";
|
||||
}
|
||||
|
||||
std::string CMasternodePing::GetDaemonString() const
|
||||
{
|
||||
return nDaemonVersion > DEFAULT_DAEMON_VERSION ? FormatVersion(nDaemonVersion) : "Unknown";
|
||||
}
|
||||
|
||||
void CMasternode::AddGovernanceVote(uint256 nGovernanceObjectHash)
|
||||
{
|
||||
if(mapGovernanceObjectsVotedOn.count(nGovernanceObjectHash)) {
|
||||
|
@ -101,6 +101,9 @@ public:
|
||||
bool CheckAndUpdate(CMasternode* pmn, bool fFromNewBroadcast, int& nDos, CConnman& connman);
|
||||
void Relay(CConnman& connman);
|
||||
|
||||
std::string GetSentinelString() const;
|
||||
std::string GetDaemonString() const;
|
||||
|
||||
explicit operator bool() const;
|
||||
};
|
||||
|
||||
|
@ -557,12 +557,12 @@ UniValue masternodelist(const JSONRPCRequest& request)
|
||||
strOutpoint.find(strFilter) == std::string::npos) continue;
|
||||
obj.push_back(Pair(strOutpoint, strAddress));
|
||||
} else if (strMode == "daemon") {
|
||||
std::string strDaemon = mn.lastPing.nDaemonVersion > DEFAULT_DAEMON_VERSION ? FormatVersion(mn.lastPing.nDaemonVersion) : "Unknown";
|
||||
std::string strDaemon = mn.lastPing.GetDaemonString();
|
||||
if (strFilter !="" && strDaemon.find(strFilter) == std::string::npos &&
|
||||
strOutpoint.find(strFilter) == std::string::npos) continue;
|
||||
obj.push_back(Pair(strOutpoint, strDaemon));
|
||||
} else if (strMode == "sentinel") {
|
||||
std::string strSentinel = mn.lastPing.nSentinelVersion > DEFAULT_SENTINEL_VERSION ? SafeIntVersionToString(mn.lastPing.nSentinelVersion) : "Unknown";
|
||||
std::string strSentinel = mn.lastPing.GetSentinelString();
|
||||
if (strFilter !="" && strSentinel.find(strFilter) == std::string::npos &&
|
||||
strOutpoint.find(strFilter) == std::string::npos) continue;
|
||||
obj.push_back(Pair(strOutpoint, strSentinel));
|
||||
@ -589,7 +589,7 @@ UniValue masternodelist(const JSONRPCRequest& request)
|
||||
CBitcoinAddress(mn.pubKeyCollateralAddress.GetID()).ToString() << " " <<
|
||||
(int64_t)mn.lastPing.sigTime << " " << std::setw(8) <<
|
||||
(int64_t)(mn.lastPing.sigTime - mn.sigTime) << " " <<
|
||||
SafeIntVersionToString(mn.lastPing.nSentinelVersion) << " " <<
|
||||
mn.lastPing.GetSentinelString() << " " <<
|
||||
(mn.lastPing.fSentinelIsCurrent ? "current" : "expired") << " " <<
|
||||
mn.addr.ToString();
|
||||
std::string strInfo = streamInfo.str();
|
||||
@ -603,7 +603,7 @@ UniValue masternodelist(const JSONRPCRequest& request)
|
||||
mn.GetStatus() << " " <<
|
||||
mn.nProtocolVersion << " " <<
|
||||
mn.lastPing.nDaemonVersion << " " <<
|
||||
SafeIntVersionToString(mn.lastPing.nSentinelVersion) << " " <<
|
||||
mn.lastPing.GetSentinelString() << " " <<
|
||||
(mn.lastPing.fSentinelIsCurrent ? "current" : "expired") << " " <<
|
||||
(int64_t)mn.lastPing.sigTime << " " <<
|
||||
(int64_t)(mn.lastPing.sigTime - mn.sigTime) << " " <<
|
||||
@ -617,8 +617,8 @@ UniValue masternodelist(const JSONRPCRequest& request)
|
||||
objMN.push_back(Pair("payee", CBitcoinAddress(mn.pubKeyCollateralAddress.GetID()).ToString()));
|
||||
objMN.push_back(Pair("status", mn.GetStatus()));
|
||||
objMN.push_back(Pair("protocol", mn.nProtocolVersion));
|
||||
objMN.push_back(Pair("daemonversion", mn.lastPing.nDaemonVersion > DEFAULT_DAEMON_VERSION ? FormatVersion(mn.lastPing.nDaemonVersion) : "Unknown"));
|
||||
objMN.push_back(Pair("sentinelversion", mn.lastPing.nSentinelVersion > DEFAULT_SENTINEL_VERSION ? SafeIntVersionToString(mn.lastPing.nSentinelVersion) : "Unknown"));
|
||||
objMN.push_back(Pair("daemonversion", mn.lastPing.GetDaemonString()));
|
||||
objMN.push_back(Pair("sentinelversion", mn.lastPing.GetSentinelString()));
|
||||
objMN.push_back(Pair("sentinelstate", (mn.lastPing.fSentinelIsCurrent ? "current" : "expired")));
|
||||
objMN.push_back(Pair("lastseen", (int64_t)mn.lastPing.sigTime));
|
||||
objMN.push_back(Pair("activeseconds", (int64_t)(mn.lastPing.sigTime - mn.sigTime)));
|
||||
|
Loading…
Reference in New Issue
Block a user