Fix potential DoS vector for masternode payments (#2071)
* Skip only already verified mn payments vote duplicates * Update mn payment vote stats only if mn payment vote sig is ok
This commit is contained in:
parent
ef85d5144d
commit
cf71f5767d
@ -351,8 +351,8 @@ void CMasternodePayments::ProcessMessage(CNode* pfrom, const std::string& strCom
|
||||
|
||||
auto res = mapMasternodePaymentVotes.emplace(nHash, vote);
|
||||
|
||||
// Avoid processing same vote multiple times
|
||||
if(!res.second) {
|
||||
// Avoid processing same vote multiple times if it was already verified earlier
|
||||
if(!res.second && res.first->second.IsVerified()) {
|
||||
LogPrint("mnpayments", "MASTERNODEPAYMENTVOTE -- hash=%s, nBlockHeight=%d/%d seen\n",
|
||||
nHash.ToString(), vote.nBlockHeight, nCachedBlockHeight);
|
||||
return;
|
||||
@ -375,11 +375,6 @@ void CMasternodePayments::ProcessMessage(CNode* pfrom, const std::string& strCom
|
||||
return;
|
||||
}
|
||||
|
||||
if(!UpdateLastVote(vote)) {
|
||||
LogPrintf("MASTERNODEPAYMENTVOTE -- masternode already voted, masternode=%s\n", vote.masternodeOutpoint.ToStringShort());
|
||||
return;
|
||||
}
|
||||
|
||||
masternode_info_t mnInfo;
|
||||
if(!mnodeman.GetMasternodeInfo(vote.masternodeOutpoint, mnInfo)) {
|
||||
// mn was not found, so we can't check vote, some info is probably missing
|
||||
@ -407,6 +402,11 @@ void CMasternodePayments::ProcessMessage(CNode* pfrom, const std::string& strCom
|
||||
return;
|
||||
}
|
||||
|
||||
if(!UpdateLastVote(vote)) {
|
||||
LogPrintf("MASTERNODEPAYMENTVOTE -- masternode already voted, masternode=%s\n", vote.masternodeOutpoint.ToStringShort());
|
||||
return;
|
||||
}
|
||||
|
||||
CTxDestination address1;
|
||||
ExtractDestination(vote.payee, address1);
|
||||
CBitcoinAddress address2(address1);
|
||||
|
Loading…
Reference in New Issue
Block a user