From a67e6614339e3ce3fd31d28240a8d10f6585c7b5 Mon Sep 17 00:00:00 2001 From: Alexander Block Date: Mon, 15 Apr 2019 15:25:27 +0200 Subject: [PATCH] Don't disconnect peers on MNAUTH verification failure (#2868) * Don't disconnect peers on MNAUTH verification failure Only give them a DoS score. * Re-add cs_main lock Co-Authored-By: codablock --- src/evo/mnauth.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/evo/mnauth.cpp b/src/evo/mnauth.cpp index 62eb16541abca..4810f88239f91 100644 --- a/src/evo/mnauth.cpp +++ b/src/evo/mnauth.cpp @@ -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; } @@ -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; }