remove excessive bool arg in dscomplete (#1124)

This commit is contained in:
UdjinM6 2016-11-07 03:27:51 +04:00 committed by GitHub
parent f2d2b25130
commit fef8752cd0
2 changed files with 16 additions and 26 deletions

View File

@ -403,9 +403,8 @@ void CDarksendPool::ProcessMessage(CNode* pfrom, std::string& strCommand, CDataS
}
int nMsgSessionID;
bool fMsgError;
int nMsgMessageID;
vRecv >> nMsgSessionID >> fMsgError >> 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);
nCachedLastSuccessBlock = pCurrentBlockIndex->nHeight;
} else {
LogPrintf("CompletedTransaction -- error\n");
}
UnlockCoins();
SetNull();
// To avoid race conditions, we'll only let DS run once per block
nCachedLastSuccessBlock = pCurrentBlockIndex->nHeight;
}
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)

View File

@ -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<CAmount>& 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;