bugs and autoretry

This commit is contained in:
Evan Duffield 2014-08-06 11:16:56 -07:00
parent 0f7f3bd17a
commit 46576e00ca

View File

@ -6001,7 +6001,7 @@ void CDarkSendPool::SetNull(bool clearEverything){
//printf("CDarkSendPool::SetNull()\n"); //printf("CDarkSendPool::SetNull()\n");
if(fMasterNode){ if(fMasterNode){
// printf("CDarkSendPool - I AM MASTER NODE!\n"); printf("CDarkSendPool - I AM MASTERNODE!\n");
} }
finalTransaction.vin.clear(); finalTransaction.vin.clear();
@ -6017,15 +6017,19 @@ void CDarkSendPool::SetNull(bool clearEverything){
lastEntryAccepted = 0; lastEntryAccepted = 0;
countEntriesAccepted = 0; countEntriesAccepted = 0;
if(clearEverything){
myEntries.clear();
sessionID = 1 + (rand() % 999999);
sessionUsers = 0; sessionUsers = 0;
sessionAmount = 0; sessionAmount = 0;
sessionFoundMasternode = false; sessionFoundMasternode = false;
sessionTries = 0; sessionTries = 0;
if(clearEverything){
myEntries.clear();
if(fMasterNode){
sessionID = 1 + (rand() % 999999);
} else {
sessionID = 0;
}
} }
} }
@ -6150,12 +6154,12 @@ void CDarkSendPool::Check()
} }
if((state == POOL_STATUS_ERROR || state == POOL_STATUS_SUCCESS) && GetTimeMillis()-lastTimeChanged >= 10000) { if((state == POOL_STATUS_ERROR || state == POOL_STATUS_SUCCESS) && GetTimeMillis()-lastTimeChanged >= 10000) {
//bool runAgain = state == POOL_STATUS_SUCCESS; bool runAgain = state == POOL_STATUS_SUCCESS;
printf("CDarkSendPool::Check() -- RESETTING MESSAGE \n"); printf("CDarkSendPool::Check() -- RESETTING MESSAGE \n");
SetNull(true); SetNull(true);
if(fMasterNode) RelayDarkSendStatus(darkSendPool.sessionID, darkSendPool.GetState(), darkSendPool.GetEntriesCount(), -1); if(fMasterNode) RelayDarkSendStatus(darkSendPool.sessionID, darkSendPool.GetState(), darkSendPool.GetEntriesCount(), -1);
UnlockCoins(); UnlockCoins();
//if(runAgain) DoAutomaticDenominating(); if(runAgain) DoAutomaticDenominating();
} }
} }
@ -7428,6 +7432,7 @@ bool CDarkSendPool::IsCompatibleWithEntries(std::vector<CTxOut> vout)
bool CDarkSendPool::IsCompatibleWithSession(int64 nAmount) bool CDarkSendPool::IsCompatibleWithSession(int64 nAmount)
{ {
printf("CDarkSendPool::IsCompatibleWithSession - %"PRI64d" sessionAmount %d sessionUsers %d\n", sessionAmount, sessionUsers);
if(sessionAmount == 0) { if(sessionAmount == 0) {
sessionAmount = nAmount; sessionAmount = nAmount;
sessionUsers++; sessionUsers++;
@ -7436,6 +7441,7 @@ bool CDarkSendPool::IsCompatibleWithSession(int64 nAmount)
} }
if(state != POOL_STATUS_ACCEPTING_ENTRIES || sessionUsers >= POOL_MAX_TRANSACTIONS){ if(state != POOL_STATUS_ACCEPTING_ENTRIES || sessionUsers >= POOL_MAX_TRANSACTIONS){
printf("CDarkSendPool::IsCompatibleWithSession - incompatible mode, return false\n");
return false; return false;
} }
@ -7467,6 +7473,7 @@ bool CDarkSendPool::IsCompatibleWithSession(int64 nAmount)
} }
if(GetDenominations(vout1) != GetDenominations(vout2)) return false; if(GetDenominations(vout1) != GetDenominations(vout2)) return false;
printf("CDarkSendPool::IsCompatibleWithSession - compatible\n");
sessionUsers++; sessionUsers++;
lastTimeChanged = GetTimeMillis(); lastTimeChanged = GetTimeMillis();