From 727e940c0c932e41efd1347af57bb538595c4515 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Thu, 11 Oct 2018 17:32:51 +0300 Subject: [PATCH] Fix recently introduced PS bugs (#2330) * backward compatibility fix for dsq * fix StartNewQueue --- src/privatesend-client.cpp | 4 ++-- src/privatesend.cpp | 9 ++++++++- src/privatesend.h | 4 +++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/privatesend-client.cpp b/src/privatesend-client.cpp index f0bd2a6de..48ef4dece 100644 --- a/src/privatesend-client.cpp +++ b/src/privatesend-client.cpp @@ -1083,6 +1083,8 @@ 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()); @@ -1090,8 +1092,6 @@ bool CPrivateSendClientSession::StartNewQueue(CAmount nValueMin, CAmount nBalanc 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", diff --git a/src/privatesend.cpp b/src/privatesend.cpp index ab0d4978d..0e3c3bf67 100644 --- a/src/privatesend.cpp +++ b/src/privatesend.cpp @@ -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() diff --git a/src/privatesend.h b/src/privatesend.h index 14636f5c6..b505c7fbc 100644 --- a/src/privatesend.h +++ b/src/privatesend.h @@ -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 @@ -183,6 +184,7 @@ public: CDarksendQueue() : nDenom(0), + nInputCount(0), masternodeOutpoint(COutPoint()), nTime(0), fReady(false), @@ -192,6 +194,7 @@ public: CDarksendQueue(int nDenom, COutPoint outpoint, int64_t nTime, bool fReady) : nDenom(nDenom), + nInputCount(0), masternodeOutpoint(outpoint), nTime(nTime), fReady(fReady), @@ -206,7 +209,6 @@ public: READWRITE(nDenom); int nVersion = s.GetVersion(); if (nVersion > 70208 && nVersion <= 70210) { - int nInputCount = 0; READWRITE(nInputCount); } READWRITE(masternodeOutpoint);