More fixes for PrivateSend after 2612 (#2614)
* Fix CPrivateSendServer::IsSessionReady() Also move it to cpp * Make sure nSessionMaxParticipants is initialized properly * Adjust logging * adjust log a bit more
This commit is contained in:
parent
bade332733
commit
fa18d3e102
@ -615,7 +615,7 @@ bool CPrivateSendServer::AddEntry(const CPrivateSendEntry& entryNew, PoolMessage
|
|||||||
|
|
||||||
vecEntries.push_back(entryNew);
|
vecEntries.push_back(entryNew);
|
||||||
|
|
||||||
LogPrint("privatesend", "CPrivateSendServer::AddEntry -- adding entry\n");
|
LogPrint("privatesend", "CPrivateSendServer::AddEntry -- adding entry %d of %d required\n", GetEntriesCount(), nSessionMaxParticipants);
|
||||||
nMessageIDRet = MSG_ENTRIES_ADDED;
|
nMessageIDRet = MSG_ENTRIES_ADDED;
|
||||||
nTimeLastSuccessfulStep = GetTime();
|
nTimeLastSuccessfulStep = GetTime();
|
||||||
|
|
||||||
@ -738,8 +738,8 @@ bool CPrivateSendServer::CreateNewSession(const CPrivateSendAccept& dsa, PoolMes
|
|||||||
}
|
}
|
||||||
|
|
||||||
vecSessionCollaterals.push_back(MakeTransactionRef(dsa.txCollateral));
|
vecSessionCollaterals.push_back(MakeTransactionRef(dsa.txCollateral));
|
||||||
LogPrintf("CPrivateSendServer::CreateNewSession -- new session created, nSessionID: %d nSessionDenom: %d (%s) vecSessionCollaterals.size(): %d\n",
|
LogPrintf("CPrivateSendServer::CreateNewSession -- new session created, nSessionID: %d nSessionDenom: %d (%s) vecSessionCollaterals.size(): %d nSessionMaxParticipants: %d\n",
|
||||||
nSessionID, nSessionDenom, CPrivateSend::GetDenominationsToString(nSessionDenom), vecSessionCollaterals.size());
|
nSessionID, nSessionDenom, CPrivateSend::GetDenominationsToString(nSessionDenom), vecSessionCollaterals.size(), nSessionMaxParticipants);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -772,12 +772,17 @@ bool CPrivateSendServer::AddUserToExistingSession(const CPrivateSendAccept& dsa,
|
|||||||
nTimeLastSuccessfulStep = GetTime();
|
nTimeLastSuccessfulStep = GetTime();
|
||||||
vecSessionCollaterals.push_back(MakeTransactionRef(dsa.txCollateral));
|
vecSessionCollaterals.push_back(MakeTransactionRef(dsa.txCollateral));
|
||||||
|
|
||||||
LogPrintf("CPrivateSendServer::AddUserToExistingSession -- new user accepted, nSessionID: %d nSessionDenom: %d (%s) vecSessionCollaterals.size(): %d\n",
|
LogPrintf("CPrivateSendServer::AddUserToExistingSession -- new user accepted, nSessionID: %d nSessionDenom: %d (%s) vecSessionCollaterals.size(): %d nSessionMaxParticipants: %d\n",
|
||||||
nSessionID, nSessionDenom, CPrivateSend::GetDenominationsToString(nSessionDenom), vecSessionCollaterals.size());
|
nSessionID, nSessionDenom, CPrivateSend::GetDenominationsToString(nSessionDenom), vecSessionCollaterals.size(), nSessionMaxParticipants);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CPrivateSendServer::IsSessionReady()
|
||||||
|
{
|
||||||
|
return nSessionMaxParticipants != 0 && (int)vecSessionCollaterals.size() >= nSessionMaxParticipants;
|
||||||
|
}
|
||||||
|
|
||||||
void CPrivateSendServer::RelayFinalTransaction(const CTransaction& txFinal, CConnman& connman)
|
void CPrivateSendServer::RelayFinalTransaction(const CTransaction& txFinal, CConnman& connman)
|
||||||
{
|
{
|
||||||
LogPrint("privatesend", "CPrivateSendServer::%s -- nSessionID: %d nSessionDenom: %d (%s)\n",
|
LogPrint("privatesend", "CPrivateSendServer::%s -- nSessionID: %d nSessionDenom: %d (%s)\n",
|
||||||
|
@ -48,7 +48,7 @@ private:
|
|||||||
bool CreateNewSession(const CPrivateSendAccept& dsa, PoolMessage& nMessageIDRet, CConnman& connman);
|
bool CreateNewSession(const CPrivateSendAccept& dsa, PoolMessage& nMessageIDRet, CConnman& connman);
|
||||||
bool AddUserToExistingSession(const CPrivateSendAccept& dsa, PoolMessage& nMessageIDRet);
|
bool AddUserToExistingSession(const CPrivateSendAccept& dsa, PoolMessage& nMessageIDRet);
|
||||||
/// Do we have enough users to take entries?
|
/// Do we have enough users to take entries?
|
||||||
bool IsSessionReady() { return (int)vecSessionCollaterals.size() >= nSessionMaxParticipants; }
|
bool IsSessionReady();
|
||||||
|
|
||||||
/// Check that all inputs are signed. (Are all inputs signed?)
|
/// Check that all inputs are signed. (Are all inputs signed?)
|
||||||
bool IsSignaturesComplete();
|
bool IsSignaturesComplete();
|
||||||
@ -70,7 +70,9 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
CPrivateSendServer() :
|
CPrivateSendServer() :
|
||||||
vecSessionCollaterals(), fUnitTest(false) {}
|
vecSessionCollaterals(),
|
||||||
|
nSessionMaxParticipants(0),
|
||||||
|
fUnitTest(false) {}
|
||||||
|
|
||||||
void ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vRecv, CConnman& connman);
|
void ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vRecv, CConnman& connman);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user