From bb11f1a638b3343234fdf2f3047636bef5f9698a Mon Sep 17 00:00:00 2001 From: InhumanPerfection <39734219+InhumanPerfection@users.noreply.github.com> Date: Sun, 25 Nov 2018 22:52:56 +0200 Subject: [PATCH] Fix recent changes in DSA conditions (#2494) * pr2487 bugfix * push reject msg --- src/privatesend-server.cpp | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/privatesend-server.cpp b/src/privatesend-server.cpp index 89b0ab2db..57f8267f6 100644 --- a/src/privatesend-server.cpp +++ b/src/privatesend-server.cpp @@ -50,24 +50,26 @@ void CPrivateSendServer::ProcessMessage(CNode* pfrom, const std::string& strComm return; } - { - TRY_LOCK(cs_vecqueue, lockRecv); - if (!lockRecv) return; + if (vecSessionCollaterals.size() == 0) { + { + TRY_LOCK(cs_vecqueue, lockRecv); + if (!lockRecv) return; - for (const auto& q : vecPrivateSendQueue) { - if (q.masternodeOutpoint == activeMasternodeInfo.outpoint) { - // refuse to create another queue this often - LogPrint("privatesend", "DSACCEPT -- last dsq is still in queue, refuse to mix\n"); - return; + for (const auto& q : vecPrivateSendQueue) { + if (q.masternodeOutpoint == activeMasternodeInfo.outpoint) { + // refuse to create another queue this often + LogPrint("privatesend", "DSACCEPT -- last dsq is still in queue, refuse to mix\n"); + PushStatus(pfrom, STATUS_REJECTED, ERR_RECENT, connman); + return; + } } } - } - if (vecSessionCollaterals.size() == 0 && mnInfo.nLastDsq != 0 && - mnInfo.nLastDsq + mnodeman.CountMasternodes() / 5 > mnodeman.nDsqCount) { - LogPrintf("DSACCEPT -- last dsq too recent, must wait: addr=%s\n", pfrom->addr.ToString()); - PushStatus(pfrom, STATUS_REJECTED, ERR_RECENT, connman); - return; + if (mnInfo.nLastDsq != 0 && mnInfo.nLastDsq + mnodeman.CountMasternodes() / 5 > mnodeman.nDsqCount) { + LogPrintf("DSACCEPT -- last dsq too recent, must wait: addr=%s\n", pfrom->addr.ToString()); + PushStatus(pfrom, STATUS_REJECTED, ERR_RECENT, connman); + return; + } } PoolMessage nMessageID = MSG_NOERR;