Fixed "last darksend session too recent" issue

This commit is contained in:
Evan Duffield 2014-11-19 08:36:07 -07:00
parent ed61f5762e
commit d72ac4b988
3 changed files with 15 additions and 9 deletions

View File

@ -9,7 +9,7 @@
#define CLIENT_VERSION_MAJOR 0 #define CLIENT_VERSION_MAJOR 0
#define CLIENT_VERSION_MINOR 10 #define CLIENT_VERSION_MINOR 10
#define CLIENT_VERSION_REVISION 16 #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 // Set to true for release, false for prerelease or test build
#define CLIENT_VERSION_IS_RELEASE true #define CLIENT_VERSION_IS_RELEASE true

View File

@ -606,6 +606,8 @@ void CDarkSendPool::ChargeFees(){
if(fMasterNode) { if(fMasterNode) {
//we don't need to charge collateral for every offence. //we don't need to charge collateral for every offence.
int offences = 0; int offences = 0;
int r = rand()%100;
if(r > 33) return;
if(state == POOL_STATUS_ACCEPTING_ENTRIES){ if(state == POOL_STATUS_ACCEPTING_ENTRIES){
BOOST_FOREACH(const CTransaction& txCollateral, vecSessionCollateral) { BOOST_FOREACH(const CTransaction& txCollateral, vecSessionCollateral) {
@ -636,7 +638,7 @@ void CDarkSendPool::ChargeFees(){
} }
} }
int r = rand()%100; r = rand()%100;
int target = 0; int target = 0;
//mostly offending? //mostly offending?
@ -794,7 +796,7 @@ void CDarkSendPool::CheckTimeout(){
c++; c++;
} }
if(GetTimeMillis()-lastTimeChanged >= 30000+addLagTime){ if(GetTimeMillis()-lastTimeChanged >= (DARKSEND_QUEUE_TIMEOUT*1000)+addLagTime){
lastTimeChanged = GetTimeMillis(); lastTimeChanged = GetTimeMillis();
ChargeFees(); ChargeFees();
@ -807,7 +809,7 @@ void CDarkSendPool::CheckTimeout(){
UpdateState(POOL_STATUS_ACCEPTING_ENTRIES); 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"); if(fDebug) LogPrintf("CDarkSendPool::CheckTimeout() -- Session timed out (30s) -- resetting\n");
SetNull(); SetNull();
UnlockCoins(); 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"); if(fDebug) LogPrintf("CDarkSendPool::CheckTimeout() -- Session timed out -- restting\n");
ChargeFees(); ChargeFees();
SetNull(); SetNull();
@ -1483,6 +1485,7 @@ bool CDarkSendPool::DoAutomaticDenominating(bool fDryRun, bool ready)
CService addr; CService addr;
if(dsq.time == 0) continue; if(dsq.time == 0) continue;
if(!dsq.GetAddress(addr)) continue; if(!dsq.GetAddress(addr)) continue;
if(dsq.IsExpired()) continue;
//don't reuse masternodes //don't reuse masternodes
BOOST_FOREACH(CTxIn usedVin, vecMasternodesUsed){ BOOST_FOREACH(CTxIn usedVin, vecMasternodesUsed){

View File

@ -33,6 +33,9 @@ class CDarksendQueue;
#define MASTERNODE_REJECTED 0 #define MASTERNODE_REJECTED 0
#define MASTERNODE_RESET -1 #define MASTERNODE_RESET -1
#define DARKSEND_QUEUE_TIMEOUT 120
#define DARKSEND_SIGNING_TIMEOUT 10
extern CDarkSendPool darkSendPool; extern CDarkSendPool darkSendPool;
extern CDarkSendSigner darkSendSigner; extern CDarkSendSigner darkSendSigner;
extern std::vector<int64> darkSendDenominations; extern std::vector<int64> darkSendDenominations;
@ -118,7 +121,7 @@ public:
bool IsExpired() bool IsExpired()
{ {
return (GetTime() - addedTime) > 120;// 120 seconds return (GetTime() - addedTime) > DARKSEND_QUEUE_TIMEOUT;// 120 seconds
} }
}; };
@ -168,7 +171,7 @@ public:
bool IsExpired() bool IsExpired()
{ {
return (GetTime() - time) > 120;// 120 seconds return (GetTime() - time) > DARKSEND_QUEUE_TIMEOUT;// 120 seconds
} }
bool CheckSignature(); bool CheckSignature();