mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-12-24 06:07:46 +00:00
cryptonote_core: avoid gratuitous recalculations in check_block_rate()
This commit is contained in:
parent
7e2483e1d5
commit
b3067962fa
1 changed files with 2 additions and 1 deletions
|
@ -1716,7 +1716,8 @@ namespace cryptonote
|
|||
for (size_t n = 0; n < sizeof(seconds)/sizeof(seconds[0]); ++n)
|
||||
{
|
||||
unsigned int b = 0;
|
||||
for (time_t ts: timestamps) b += ts >= now - static_cast<time_t>(seconds[n]);
|
||||
const time_t time_boundary = now - static_cast<time_t>(seconds[n]);
|
||||
for (time_t ts: timestamps) b += ts >= time_boundary;
|
||||
const double p = probability(b, seconds[n] / DIFFICULTY_TARGET_V2);
|
||||
MDEBUG("blocks in the last " << seconds[n] / 60 << " minutes: " << b << " (probability " << p << ")");
|
||||
if (p < threshold)
|
||||
|
|
Loading…
Reference in a new issue