diff --git a/src/darksend.cpp b/src/darksend.cpp index ece76a570..6820aed5b 100644 --- a/src/darksend.cpp +++ b/src/darksend.cpp @@ -402,10 +402,9 @@ void CDarksendPool::ProcessMessage(CNode* pfrom, std::string& strCommand, CDataS return; } - int nMsgSessionID; - bool fMsgError; - int nMsgMessageID; - vRecv >> nMsgSessionID >> fMsgError >> nMsgMessageID; + int nMsgSessionID; + int nMsgMessageID; + vRecv >> nMsgSessionID >> nMsgMessageID; if(nMsgMessageID < MSG_POOL_MIN || nMsgMessageID > MSG_POOL_MAX) { LogPrint("privatesend", "DSCOMPLETE -- nMsgMessageID is out of bounds: %d\n", nMsgMessageID); @@ -419,7 +418,7 @@ void CDarksendPool::ProcessMessage(CNode* pfrom, std::string& strCommand, CDataS LogPrint("privatesend", "DSCOMPLETE -- nMsgSessionID %d nMsgMessageID %d (%s)\n", nMsgSessionID, nMsgMessageID, GetMessageByID(PoolMessage(nMsgMessageID))); - CompletedTransaction(fMsgError, PoolMessage(nMsgMessageID)); + CompletedTransaction(PoolMessage(nMsgMessageID)); } } @@ -630,7 +629,7 @@ void CDarksendPool::CommitFinalTransaction() // not much we can do in this case SetState(POOL_STATE_ACCEPTING_ENTRIES); - RelayCompletedTransaction(true, ERR_INVALID_TX); + RelayCompletedTransaction(ERR_INVALID_TX); return; } } @@ -650,7 +649,7 @@ void CDarksendPool::CommitFinalTransaction() RelayInv(inv); // Tell the clients it was successful - RelayCompletedTransaction(false, MSG_SUCCESS); + RelayCompletedTransaction(MSG_SUCCESS); // Randomly charge clients ChargeRandomFees(); @@ -1294,27 +1293,18 @@ void CDarksendPool::NewBlock() } // mixing transaction was completed (failed or successful) -void CDarksendPool::CompletedTransaction(bool fError, PoolMessage nMessageID) +void CDarksendPool::CompletedTransaction(PoolMessage nMessageID) { if(fMasterNode) return; - if(fError) { - LogPrintf("CompletedTransaction -- error\n"); - SetState(POOL_STATE_ERROR); - - CheckPool(); - UnlockCoins(); - SetNull(); - } else { + if(nMessageID == MSG_SUCCESS) { LogPrintf("CompletedTransaction -- success\n"); - SetState(POOL_STATE_SUCCESS); - - UnlockCoins(); - SetNull(); - - // To avoid race conditions, we'll only let DS run once per block nCachedLastSuccessBlock = pCurrentBlockIndex->nHeight; + } else { + LogPrintf("CompletedTransaction -- error\n"); } + UnlockCoins(); + SetNull(); strLastMessage = GetMessageByID(nMessageID); } @@ -2417,12 +2407,12 @@ void CDarksendPool::RelayStatus(PoolStatusUpdate nStatusUpdate, PoolMessage nMes PushStatus(pnode, nStatusUpdate, nMessageID); } -void CDarksendPool::RelayCompletedTransaction(bool fError, PoolMessage nMessageID) +void CDarksendPool::RelayCompletedTransaction(PoolMessage nMessageID) { LOCK(cs_vNodes); BOOST_FOREACH(CNode* pnode, vNodes) if(pnode->nVersion >= MIN_PRIVATESEND_PEER_PROTO_VERSION) - pnode->PushMessage(NetMsgType::DSCOMPLETE, nSessionID, fError, (int)nMessageID); + pnode->PushMessage(NetMsgType::DSCOMPLETE, nSessionID, (int)nMessageID); } void CDarksendPool::SetState(PoolState nStateNew) diff --git a/src/darksend.h b/src/darksend.h index 4ba5a7e1e..45c4cfa32 100644 --- a/src/darksend.h +++ b/src/darksend.h @@ -364,7 +364,7 @@ private: void CreateFinalTransaction(); void CommitFinalTransaction(); - void CompletedTransaction(bool fError, PoolMessage nMessageID); + void CompletedTransaction(PoolMessage nMessageID); /// Get the denominations for a specific amount of dash. int GetDenominationsByAmounts(const std::vector& vecAmount); @@ -422,7 +422,7 @@ private: void RelayIn(const CDarkSendEntry& entry); void PushStatus(CNode* pnode, PoolStatusUpdate nStatusUpdate, PoolMessage nMessageID); void RelayStatus(PoolStatusUpdate nStatusUpdate = STATUS_SET_STATE, PoolMessage nMessageID = MSG_NOERR); - void RelayCompletedTransaction(bool fError, PoolMessage nMessageID); + void RelayCompletedTransaction(PoolMessage nMessageID); public: CMasternode* pSubmittedToMasternode;