mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
Merge pull request #199 from fuwa0529/dev-v0.6-churn
randomize churn time
This commit is contained in:
commit
e05dac801f
1 changed files with 11 additions and 3 deletions
|
@ -9372,8 +9372,15 @@ bool simple_wallet::churn(const std::vector<std::string> &args_)
|
|||
int churn_number, pause_time, i;
|
||||
srand (time(NULL)); // seed RNG with current time
|
||||
churn_number = rand()%(8 + 1 - 2) + 2; // churn between 2 to 8 times
|
||||
|
||||
std::stack<int> pauses;
|
||||
float total_time = 0;
|
||||
// no pause for the last churn
|
||||
for (i = 1; i <= churn_number - 1; ++i) {
|
||||
pause_time = rand()%(120 + 1 - 60) + 60; // wait between 1 to 2 hours per interval
|
||||
float total_time = static_cast<float>(churn_number*pause_time)/60; // calculate how long churning will take in hours
|
||||
pauses.push(pause_time);
|
||||
total_time += static_cast<float>(pause_time)/60; // calculate how long churning will take in hours
|
||||
}
|
||||
|
||||
// Calculate fee
|
||||
float churn_fee = m_wallet->use_fork_rules(HF_VERSION_PER_BYTE_FEE) ? static_cast<float>(churn_number * 0.015) : static_cast<float>(churn_number * 0.032654); // usual 2/2 tx fee
|
||||
|
@ -9420,7 +9427,8 @@ bool simple_wallet::churn(const std::vector<std::string> &args_)
|
|||
else
|
||||
{
|
||||
message_writer() << tr("\nInterval pause, please wait...\n");
|
||||
sleep(pause_time*60);
|
||||
sleep(pauses.top()*60);
|
||||
pauses.pop();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue