Skip to content

Commit

Permalink
Don't disconnect peers on MNAUTH verification failure (#2868)
Browse files Browse the repository at this point in the history
* Don't disconnect peers on MNAUTH verification failure

Only give them a DoS score.

* Re-add cs_main lock

Co-Authored-By: codablock <ablock84@gmail.com>
  • Loading branch information
codablock committed Apr 15, 2019
1 parent 1d8c722 commit a67e661
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/evo/mnauth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,10 @@ void CMNAuth::ProcessMessage(CNode* pnode, const std::string& strCommand, CDataS
auto dmn = mnList.GetValidMN(mnauth.proRegTxHash);
if (!dmn) {
LOCK(cs_main);
// in case he was unlucky and not up to date, just let him be connected as a regular node, which gives him
// a chance to get up-to-date and thus realize by himself that he's not a MN anymore. We still give him a
// low DoS score.
Misbehaving(pnode->id, 10);
// in case he was unlucky and not up to date, let him retry the whole verification process
pnode->fDisconnect = true;
return;
}

Expand All @@ -90,9 +91,9 @@ void CMNAuth::ProcessMessage(CNode* pnode, const std::string& strCommand, CDataS

if (!mnauth.sig.VerifyInsecure(dmn->pdmnState->pubKeyOperator, signHash)) {
LOCK(cs_main);
// Same as above, MN seems to not know about his fate yet, so give him a chance to update. If this is a
// malicious actor (DoSing us), we'll ban him soon.
Misbehaving(pnode->id, 10);
// in case he was unlucky and not up to date, let him retry the whole verification process
pnode->fDisconnect = true;
return;
}

Expand Down

0 comments on commit a67e661

Please sign in to comment.