net|rpc: getpeerinfo - Add verified_pubkey_hash, fix a typo in verified_proregtx_hash docs (#3929)

* net|rpc: Add verified_pubkey_hash in getpeerinfo for MN connections

* Apply suggestions from code review

Co-authored-by: thephez <thephez@users.noreply.github.com>

* rpc: One more typo

Co-authored-by: thephez <thephez@users.noreply.github.com>
This commit is contained in:
dustinface 2021-01-22 23:12:22 +01:00 committed by GitHub
parent ec1281c7ad
commit 0c1a02be2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 1 deletions

View File

@ -820,6 +820,7 @@ void CNode::copyStats(CNodeStats &stats)
{
LOCK(cs_mnauth);
X(verifiedProRegTxHash);
X(verifiedPubKeyHash);
}
X(m_masternode_connection);
}

View File

@ -773,6 +773,8 @@ public:
CAddress addrBind;
// In case this is a verified MN, this value is the proTx of the MN
uint256 verifiedProRegTxHash;
// In case this is a verified MN, this value is the hashed operator pubkey of the MN
uint256 verifiedPubKeyHash;
bool m_masternode_connection;
};

View File

@ -81,8 +81,11 @@ UniValue getpeerinfo(const JSONRPCRequest& request)
" \"addrlocal\":\"ip:port\", (string) Local address as reported by the peer\n"
" \"services\":\"xxxxxxxxxxxxxxxx\", (string) The services offered\n"
" \"verified_proregtx_hash\": h, (hex) Only present when the peer is a masternode and succesfully\n"
" autheticated via MNAUTH. In this case, this field contains the\n"
" authenticated via MNAUTH. In this case, this field contains the\n"
" protx hash of the masternode\n"
" \"verified_pubkey_hash\": h, (hex) Only present when the peer is a masternode and succesfully\n"
" authenticated via MNAUTH. In this case, this field contains the\n"
" hash of the masternode's operator public key\n"
" \"relaytxes\":true|false, (boolean) Whether peer has asked us to relay transactions to it\n"
" \"lastsend\": ttt, (numeric) The time in seconds since epoch (Jan 1 1970 GMT) of the last send\n"
" \"lastrecv\": ttt, (numeric) The time in seconds since epoch (Jan 1 1970 GMT) of the last receive\n"
@ -145,6 +148,9 @@ UniValue getpeerinfo(const JSONRPCRequest& request)
if (!stats.verifiedProRegTxHash.IsNull()) {
obj.pushKV("verified_proregtx_hash", stats.verifiedProRegTxHash.ToString());
}
if (!stats.verifiedPubKeyHash.IsNull()) {
obj.pushKV("verified_pubkey_hash", stats.verifiedPubKeyHash.ToString());
}
obj.pushKV("relaytxes", stats.fRelayTxes);
obj.pushKV("lastsend", stats.nLastSend);
obj.pushKV("lastrecv", stats.nLastRecv);