diff --git a/src/clientversion.h b/src/clientversion.h index e30d7b842c..ac24782d0b 100644 --- a/src/clientversion.h +++ b/src/clientversion.h @@ -9,7 +9,7 @@ #define CLIENT_VERSION_MAJOR 0 #define CLIENT_VERSION_MINOR 10 #define CLIENT_VERSION_REVISION 16 -#define CLIENT_VERSION_BUILD 15 +#define CLIENT_VERSION_BUILD 16 // Set to true for release, false for prerelease or test build #define CLIENT_VERSION_IS_RELEASE true diff --git a/src/darksend.cpp b/src/darksend.cpp index 426336c4f8..13f9f0712d 100644 --- a/src/darksend.cpp +++ b/src/darksend.cpp @@ -606,6 +606,8 @@ void CDarkSendPool::ChargeFees(){ if(fMasterNode) { //we don't need to charge collateral for every offence. int offences = 0; + int r = rand()%100; + if(r > 33) return; if(state == POOL_STATUS_ACCEPTING_ENTRIES){ BOOST_FOREACH(const CTransaction& txCollateral, vecSessionCollateral) { @@ -636,7 +638,7 @@ void CDarkSendPool::ChargeFees(){ } } - int r = rand()%100; + r = rand()%100; int target = 0; //mostly offending? @@ -774,7 +776,7 @@ void CDarkSendPool::CheckTimeout(){ // if it's a masternode, the entries are stored in "entries", otherwise they're stored in myEntries std::vector *vec = &myEntries; - if(fMasterNode) vec = &entries; + if(fMasterNode) vec = &entries; // check for a timeout and reset if needed vector::iterator it2; @@ -794,7 +796,7 @@ void CDarkSendPool::CheckTimeout(){ c++; } - if(GetTimeMillis()-lastTimeChanged >= 30000+addLagTime){ + if(GetTimeMillis()-lastTimeChanged >= (DARKSEND_QUEUE_TIMEOUT*1000)+addLagTime){ lastTimeChanged = GetTimeMillis(); ChargeFees(); @@ -807,7 +809,7 @@ void CDarkSendPool::CheckTimeout(){ UpdateState(POOL_STATUS_ACCEPTING_ENTRIES); } - } else if(GetTimeMillis()-lastTimeChanged >= 30000+addLagTime){ + } else if(GetTimeMillis()-lastTimeChanged >= (DARKSEND_QUEUE_TIMEOUT*1000)+addLagTime){ if(fDebug) LogPrintf("CDarkSendPool::CheckTimeout() -- Session timed out (30s) -- resetting\n"); SetNull(); UnlockCoins(); @@ -817,7 +819,7 @@ void CDarkSendPool::CheckTimeout(){ } - if(state == POOL_STATUS_SIGNING && GetTimeMillis()-lastTimeChanged >= 10000+addLagTime ) { + if(state == POOL_STATUS_SIGNING && GetTimeMillis()-lastTimeChanged >= (DARKSEND_SIGNING_TIMEOUT*1000)+addLagTime ) { if(fDebug) LogPrintf("CDarkSendPool::CheckTimeout() -- Session timed out -- restting\n"); ChargeFees(); SetNull(); @@ -1483,6 +1485,7 @@ bool CDarkSendPool::DoAutomaticDenominating(bool fDryRun, bool ready) CService addr; if(dsq.time == 0) continue; if(!dsq.GetAddress(addr)) continue; + if(dsq.IsExpired()) continue; //don't reuse masternodes BOOST_FOREACH(CTxIn usedVin, vecMasternodesUsed){ diff --git a/src/darksend.h b/src/darksend.h index d75140ea98..2cd297919d 100644 --- a/src/darksend.h +++ b/src/darksend.h @@ -33,6 +33,9 @@ class CDarksendQueue; #define MASTERNODE_REJECTED 0 #define MASTERNODE_RESET -1 +#define DARKSEND_QUEUE_TIMEOUT 120 +#define DARKSEND_SIGNING_TIMEOUT 10 + extern CDarkSendPool darkSendPool; extern CDarkSendSigner darkSendSigner; extern std::vector darkSendDenominations; @@ -118,7 +121,7 @@ public: bool IsExpired() { - return (GetTime() - addedTime) > 120;// 120 seconds + return (GetTime() - addedTime) > DARKSEND_QUEUE_TIMEOUT;// 120 seconds } }; @@ -168,7 +171,7 @@ public: bool IsExpired() { - return (GetTime() - time) > 120;// 120 seconds + return (GetTime() - time) > DARKSEND_QUEUE_TIMEOUT;// 120 seconds } bool CheckSignature(); @@ -401,4 +404,4 @@ void ConnectToDarkSendMasterNodeWinner(); void ThreadCheckDarkSendPool(); -#endif \ No newline at end of file +#endif