Skip to content

Commit

Permalink
Fix recently introduced PS bugs (#2330)
Browse files Browse the repository at this point in the history
* backward compatibility fix for dsq

* fix StartNewQueue
  • Loading branch information
UdjinM6 authored Oct 11, 2018
1 parent 8deb8e9 commit 727e940
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/privatesend-client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1083,15 +1083,15 @@ bool CPrivateSendClientSession::StartNewQueue(CAmount nValueMin, CAmount nBalanc
return false;
}

privateSendClient.AddUsedMasternode(infoMn.outpoint);

// skip next mn payments winners
if (mnpayments.IsScheduled(infoMn, 0)) {
LogPrintf("CPrivateSendClientSession::StartNewQueue -- skipping winner, masternode=%s\n", infoMn.outpoint.ToStringShort());
nTries++;
continue;
}

privateSendClient.AddUsedMasternode(infoMn.outpoint);

if(infoMn.nLastDsq != 0 && infoMn.nLastDsq + nMnCountEnabled/5 > mnodeman.nDsqCount) {
LogPrintf("CPrivateSendClientSession::StartNewQueue -- Too early to mix on this masternode!"
" masternode=%s addr=%s nLastDsq=%d CountEnabled/5=%d nDsqCount=%d\n",
Expand Down
9 changes: 8 additions & 1 deletion src/privatesend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,14 @@ bool CDarkSendEntry::AddScriptSig(const CTxIn& txin)

uint256 CDarksendQueue::GetSignatureHash() const
{
return SerializeHash(*this);
// Remove after migration to 70211
{
masternode_info_t mnInfo;
mnodeman.GetMasternodeInfo(masternodeOutpoint, mnInfo);
return SerializeHash(*this, SER_GETHASH, mnInfo.nProtocolVersion);
}
// END remove, replace with the code below
// return SerializeHash(*this);
}

bool CDarksendQueue::Sign()
Expand Down
4 changes: 3 additions & 1 deletion src/privatesend.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ class CDarksendQueue
{
public:
int nDenom;
int nInputCount; // not used for anything but to calculate correct hash, remove after migration to 70211
COutPoint masternodeOutpoint;
int64_t nTime;
bool fReady; //ready for submit
Expand All @@ -183,6 +184,7 @@ class CDarksendQueue

CDarksendQueue() :
nDenom(0),
nInputCount(0),
masternodeOutpoint(COutPoint()),
nTime(0),
fReady(false),
Expand All @@ -192,6 +194,7 @@ class CDarksendQueue

CDarksendQueue(int nDenom, COutPoint outpoint, int64_t nTime, bool fReady) :
nDenom(nDenom),
nInputCount(0),
masternodeOutpoint(outpoint),
nTime(nTime),
fReady(fReady),
Expand All @@ -206,7 +209,6 @@ class CDarksendQueue
READWRITE(nDenom);
int nVersion = s.GetVersion();
if (nVersion > 70208 && nVersion <= 70210) {
int nInputCount = 0;
READWRITE(nInputCount);
}
READWRITE(masternodeOutpoint);
Expand Down

0 comments on commit 727e940

Please sign in to comment.