From dfe99c950763670493e55157d8d9aaf76934081e Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Thu, 5 Dec 2019 21:28:53 +0300 Subject: [PATCH] Decouple cs_mnauth/cs_main (#3220) --- src/evo/mnauth.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/evo/mnauth.cpp b/src/evo/mnauth.cpp index 19211884e7..44f52d7ad6 100644 --- a/src/evo/mnauth.cpp +++ b/src/evo/mnauth.cpp @@ -55,14 +55,16 @@ void CMNAuth::ProcessMessage(CNode* pnode, const std::string& strCommand, CDataS CMNAuth mnauth; vRecv >> mnauth; + // only one MNAUTH allowed + bool fAlreadyHaveMNAUTH = false; { LOCK(pnode->cs_mnauth); - // only one MNAUTH allowed - if (!pnode->verifiedProRegTxHash.IsNull()) { - LOCK(cs_main); - Misbehaving(pnode->GetId(), 100); - return; - } + fAlreadyHaveMNAUTH = !pnode->verifiedProRegTxHash.IsNull(); + } + if (fAlreadyHaveMNAUTH) { + LOCK(cs_main); + Misbehaving(pnode->GetId(), 100); + return; } if (mnauth.proRegTxHash.IsNull() || !mnauth.sig.IsValid()) {