Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Randomize DoAuto timeouts #909

Merged
merged 1 commit into from
Jul 15, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/darksend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2308,6 +2308,7 @@ void ThreadCheckDarkSendPool()
RenameThread("dash-privatesend");

unsigned int c = 0;
unsigned int nDoAutoNextRun = c + DARKSEND_AUTO_TIMEOUT_MIN;

while (true)
{
Expand Down Expand Up @@ -2335,8 +2336,10 @@ void ThreadCheckDarkSendPool()
darkSendPool.CheckTimeout();
darkSendPool.CheckForCompleteQueue();

if(darkSendPool.GetState() == POOL_STATUS_IDLE && c % 15 == 0){
darkSendPool.DoAutomaticDenominating();
if(nDoAutoNextRun == c) {
if(darkSendPool.GetState() == POOL_STATUS_IDLE) darkSendPool.DoAutomaticDenominating();

nDoAutoNextRun = c + DARKSEND_AUTO_TIMEOUT_MIN + insecure_rand()%(DARKSEND_AUTO_TIMEOUT_MAX - DARKSEND_AUTO_TIMEOUT_MIN);
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/darksend.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ class CActiveMasternode;
#define MASTERNODE_REJECTED 0
#define MASTERNODE_RESET -1

#define DARKSEND_AUTO_TIMEOUT_MIN 5
#define DARKSEND_AUTO_TIMEOUT_MAX 15
#define DARKSEND_QUEUE_TIMEOUT 30
#define DARKSEND_SIGNING_TIMEOUT 15

Expand Down