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);
|
||||
|
||||
LogPrint("privatesend", "CPrivateSendServer::AddEntry -- adding entry\n");
|
||||
LogPrint("privatesend", "CPrivateSendServer::AddEntry -- adding entry %d of %d required\n", GetEntriesCount(), nSessionMaxParticipants);
|
||||
nMessageIDRet = MSG_ENTRIES_ADDED;
|
||||
nTimeLastSuccessfulStep = GetTime();
|
||||
|
||||
@ -738,8 +738,8 @@ bool CPrivateSendServer::CreateNewSession(const CPrivateSendAccept& dsa, PoolMes
|
||||
}
|
||||
|
||||
vecSessionCollaterals.push_back(MakeTransactionRef(dsa.txCollateral));
|
||||
LogPrintf("CPrivateSendServer::CreateNewSession -- new session created, nSessionID: %d nSessionDenom: %d (%s) vecSessionCollaterals.size(): %d\n",
|
||||
nSessionID, nSessionDenom, CPrivateSend::GetDenominationsToString(nSessionDenom), vecSessionCollaterals.size());
|
||||
LogPrintf("CPrivateSendServer::CreateNewSession -- new session created, nSessionID: %d nSessionDenom: %d (%s) vecSessionCollaterals.size(): %d nSessionMaxParticipants: %d\n",
|
||||
nSessionID, nSessionDenom, CPrivateSend::GetDenominationsToString(nSessionDenom), vecSessionCollaterals.size(), nSessionMaxParticipants);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -772,12 +772,17 @@ bool CPrivateSendServer::AddUserToExistingSession(const CPrivateSendAccept& dsa,
|
||||
nTimeLastSuccessfulStep = GetTime();
|
||||
vecSessionCollaterals.push_back(MakeTransactionRef(dsa.txCollateral));
|
||||
|
||||
LogPrintf("CPrivateSendServer::AddUserToExistingSession -- new user accepted, nSessionID: %d nSessionDenom: %d (%s) vecSessionCollaterals.size(): %d\n",
|
||||
nSessionID, nSessionDenom, CPrivateSend::GetDenominationsToString(nSessionDenom), vecSessionCollaterals.size());
|
||||
LogPrintf("CPrivateSendServer::AddUserToExistingSession -- new user accepted, nSessionID: %d nSessionDenom: %d (%s) vecSessionCollaterals.size(): %d nSessionMaxParticipants: %d\n",
|
||||
nSessionID, nSessionDenom, CPrivateSend::GetDenominationsToString(nSessionDenom), vecSessionCollaterals.size(), nSessionMaxParticipants);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CPrivateSendServer::IsSessionReady()
|
||||
{
|
||||
return nSessionMaxParticipants != 0 && (int)vecSessionCollaterals.size() >= nSessionMaxParticipants;
|
||||
}
|
||||
|
||||
void CPrivateSendServer::RelayFinalTransaction(const CTransaction& txFinal, CConnman& connman)
|
||||
{
|
||||
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 AddUserToExistingSession(const CPrivateSendAccept& dsa, PoolMessage& nMessageIDRet);
|
||||
/// 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?)
|
||||
bool IsSignaturesComplete();
|
||||
@ -70,7 +70,9 @@ private:
|
||||
|
||||
public:
|
||||
CPrivateSendServer() :
|
||||
vecSessionCollaterals(), fUnitTest(false) {}
|
||||
vecSessionCollaterals(),
|
||||
nSessionMaxParticipants(0),
|
||||
fUnitTest(false) {}
|
||||
|
||||
void ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vRecv, CConnman& connman);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user