diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index 0440cb6b6..a441533f3 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -9372,8 +9372,15 @@ bool simple_wallet::churn(const std::vector &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 - pause_time = rand()%(120 + 1 - 60) + 60; // wait between 1 to 2 hours per interval - float total_time = static_cast(churn_number*pause_time)/60; // calculate how long churning will take in hours + + std::stack 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 + pauses.push(pause_time); + total_time += static_cast(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(churn_number * 0.015) : static_cast(churn_number * 0.032654); // usual 2/2 tx fee @@ -9420,7 +9427,8 @@ bool simple_wallet::churn(const std::vector &args_) else { message_writer() << tr("\nInterval pause, please wait...\n"); - sleep(pause_time*60); + sleep(pauses.top()*60); + pauses.pop(); } }