Fix ProcessVerifyBroadcast (#1423)

- check if mn rank can be calculated
- fix "is in top" condition
This commit is contained in:
UdjinM6 2017-04-01 20:40:28 +03:00 committed by GitHub
parent d8fd73fcd5
commit 7f4ff495c9

View File

@ -1293,9 +1293,16 @@ void CMasternodeMan::ProcessVerifyBroadcast(CNode* pnode, const CMasternodeVerif
}
int nRank = GetMasternodeRank(mnv.vin2, mnv.nBlockHeight, MIN_POSE_PROTO_VERSION);
if(nRank < MAX_POSE_RANK) {
LogPrint("masternode", "MasternodeMan::ProcessVerifyBroadcast -- Mastrernode is not in top %d, current rank %d, peer=%d\n",
(int)MAX_POSE_RANK, nRank, pnode->id);
if (nRank == -1) {
LogPrint("masternode", "CMasternodeMan::ProcessVerifyBroadcast -- Can't calculate rank for masternode %s\n",
mnv.vin2.prevout.ToStringShort());
return;
}
if(nRank > MAX_POSE_RANK) {
LogPrint("masternode", "CMasternodeMan::ProcessVerifyBroadcast -- Mastrernode %s is not in top %d, current rank %d, peer=%d\n",
mnv.vin2.prevout.ToStringShort(), (int)MAX_POSE_RANK, nRank, pnode->id);
return;
}