Skip to content

Commit

Permalink
Fix recent changes in DSA conditions (#2494)
Browse files Browse the repository at this point in the history
* pr2487 bugfix

* push reject msg
  • Loading branch information
InhumanPerfection authored and UdjinM6 committed Nov 25, 2018
1 parent 6480ad1 commit bb11f1a
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions src/privatesend-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,24 +50,26 @@ void CPrivateSendServer::ProcessMessage(CNode* pfrom, const std::string& strComm
return;
}

{
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;
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");
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;
Expand Down

0 comments on commit bb11f1a

Please sign in to comment.