Drop new connection instead of old one when duplicate MNAUTH is received (#3272)

This commit is contained in:
Alexander Block 2020-01-04 22:17:17 +01:00 committed by UdjinM6
parent 817cd9a177
commit ebf529e8aa

View File

@ -101,12 +101,16 @@ void CMNAuth::ProcessMessage(CNode* pnode, const std::string& strCommand, CDataS
connman.ForEachNode([&](CNode* pnode2) {
if (pnode2->verifiedProRegTxHash == mnauth.proRegTxHash) {
LogPrint(BCLog::NET, "CMNAuth::ProcessMessage -- Masternode %s has already verified as peer %d, dropping old connection. peer=%d\n",
LogPrint(BCLog::NET, "CMNAuth::ProcessMessage -- Masternode %s has already verified as peer %d, dropping new connection. peer=%d\n",
mnauth.proRegTxHash.ToString(), pnode2->GetId(), pnode->GetId());
pnode2->fDisconnect = true;
pnode->fDisconnect = true;
}
});
if (pnode->fDisconnect) {
return;
}
{
LOCK(pnode->cs_mnauth);
pnode->verifiedProRegTxHash = mnauth.proRegTxHash;