Fix recently introduced PS bugs (#2330)

* backward compatibility fix for dsq

* fix StartNewQueue
This commit is contained in:
UdjinM6 2018-10-11 17:32:51 +03:00 committed by GitHub
parent 8deb8e90f2
commit 727e940c0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 4 deletions

View File

@ -1083,6 +1083,8 @@ bool CPrivateSendClientSession::StartNewQueue(CAmount nValueMin, CAmount nBalanc
return false; return false;
} }
privateSendClient.AddUsedMasternode(infoMn.outpoint);
// skip next mn payments winners // skip next mn payments winners
if (mnpayments.IsScheduled(infoMn, 0)) { if (mnpayments.IsScheduled(infoMn, 0)) {
LogPrintf("CPrivateSendClientSession::StartNewQueue -- skipping winner, masternode=%s\n", infoMn.outpoint.ToStringShort()); LogPrintf("CPrivateSendClientSession::StartNewQueue -- skipping winner, masternode=%s\n", infoMn.outpoint.ToStringShort());
@ -1090,8 +1092,6 @@ bool CPrivateSendClientSession::StartNewQueue(CAmount nValueMin, CAmount nBalanc
continue; continue;
} }
privateSendClient.AddUsedMasternode(infoMn.outpoint);
if(infoMn.nLastDsq != 0 && infoMn.nLastDsq + nMnCountEnabled/5 > mnodeman.nDsqCount) { if(infoMn.nLastDsq != 0 && infoMn.nLastDsq + nMnCountEnabled/5 > mnodeman.nDsqCount) {
LogPrintf("CPrivateSendClientSession::StartNewQueue -- Too early to mix on this masternode!" LogPrintf("CPrivateSendClientSession::StartNewQueue -- Too early to mix on this masternode!"
" masternode=%s addr=%s nLastDsq=%d CountEnabled/5=%d nDsqCount=%d\n", " masternode=%s addr=%s nLastDsq=%d CountEnabled/5=%d nDsqCount=%d\n",

View File

@ -35,7 +35,14 @@ bool CDarkSendEntry::AddScriptSig(const CTxIn& txin)
uint256 CDarksendQueue::GetSignatureHash() const 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() bool CDarksendQueue::Sign()

View File

@ -174,6 +174,7 @@ class CDarksendQueue
{ {
public: public:
int nDenom; int nDenom;
int nInputCount; // not used for anything but to calculate correct hash, remove after migration to 70211
COutPoint masternodeOutpoint; COutPoint masternodeOutpoint;
int64_t nTime; int64_t nTime;
bool fReady; //ready for submit bool fReady; //ready for submit
@ -183,6 +184,7 @@ public:
CDarksendQueue() : CDarksendQueue() :
nDenom(0), nDenom(0),
nInputCount(0),
masternodeOutpoint(COutPoint()), masternodeOutpoint(COutPoint()),
nTime(0), nTime(0),
fReady(false), fReady(false),
@ -192,6 +194,7 @@ public:
CDarksendQueue(int nDenom, COutPoint outpoint, int64_t nTime, bool fReady) : CDarksendQueue(int nDenom, COutPoint outpoint, int64_t nTime, bool fReady) :
nDenom(nDenom), nDenom(nDenom),
nInputCount(0),
masternodeOutpoint(outpoint), masternodeOutpoint(outpoint),
nTime(nTime), nTime(nTime),
fReady(fReady), fReady(fReady),
@ -206,7 +209,6 @@ public:
READWRITE(nDenom); READWRITE(nDenom);
int nVersion = s.GetVersion(); int nVersion = s.GetVersion();
if (nVersion > 70208 && nVersion <= 70210) { if (nVersion > 70208 && nVersion <= 70210) {
int nInputCount = 0;
READWRITE(nInputCount); READWRITE(nInputCount);
} }
READWRITE(masternodeOutpoint); READWRITE(masternodeOutpoint);