Make difficulty trend correction asymmetric
Some checks failed
build / Cross-Mac aarch64 (push) Successful in 11m45s
build / ARM v8 (push) Successful in 8m28s
build / ARM v7 (push) Successful in 8m29s
build / i686 Linux (push) Successful in 7m6s
build / i686 Win (push) Successful in 6m56s
build / RISCV 64bit (push) Successful in 13m10s
build / Cross-Mac x86_64 (push) Failing after 2s
build / x86_64 Linux (push) Successful in 6m5s
build / x86_64 Freebsd (push) Successful in 5m12s
build / Win64 (push) Successful in 7m0s
Some checks failed
build / Cross-Mac aarch64 (push) Successful in 11m45s
build / ARM v8 (push) Successful in 8m28s
build / ARM v7 (push) Successful in 8m29s
build / i686 Linux (push) Successful in 7m6s
build / i686 Win (push) Successful in 6m56s
build / RISCV 64bit (push) Successful in 13m10s
build / Cross-Mac x86_64 (push) Failing after 2s
build / x86_64 Linux (push) Successful in 6m5s
build / x86_64 Freebsd (push) Successful in 5m12s
build / Win64 (push) Successful in 7m0s
This commit is contained in:
@@ -301,7 +301,8 @@
|
|||||||
#define DIFFICULTY_TREND_OLDER_WINDOW 15
|
#define DIFFICULTY_TREND_OLDER_WINDOW 15
|
||||||
#define DIFFICULTY_TREND_SMOOTHING_NUM 3
|
#define DIFFICULTY_TREND_SMOOTHING_NUM 3
|
||||||
#define DIFFICULTY_TREND_SMOOTHING_DEN 10
|
#define DIFFICULTY_TREND_SMOOTHING_DEN 10
|
||||||
#define DIFFICULTY_TREND_MAX_ADJUST_PERCENT 5
|
#define DIFFICULTY_TREND_MAX_UP_PERCENT 3
|
||||||
|
#define DIFFICULTY_TREND_MAX_DOWN_PERCENT 10
|
||||||
|
|
||||||
//The limit is enough for the mandatory transaction content with 16 outputs (547 bytes),
|
//The limit is enough for the mandatory transaction content with 16 outputs (547 bytes),
|
||||||
//a custom tag (1 byte) and up to 32 bytes of custom data for each recipient.
|
//a custom tag (1 byte) and up to 32 bytes of custom data for each recipient.
|
||||||
|
|||||||
@@ -191,11 +191,12 @@ namespace
|
|||||||
int64_t adjust_scaled = 10000 +
|
int64_t adjust_scaled = 10000 +
|
||||||
(deviation * DIFFICULTY_TREND_SMOOTHING_NUM) / DIFFICULTY_TREND_SMOOTHING_DEN;
|
(deviation * DIFFICULTY_TREND_SMOOTHING_NUM) / DIFFICULTY_TREND_SMOOTHING_DEN;
|
||||||
|
|
||||||
const int64_t max_adjust = DIFFICULTY_TREND_MAX_ADJUST_PERCENT * 100;
|
const int64_t max_adjust_up = DIFFICULTY_TREND_MAX_UP_PERCENT * 100;
|
||||||
if (adjust_scaled > 10000 + max_adjust)
|
const int64_t max_adjust_down = DIFFICULTY_TREND_MAX_DOWN_PERCENT * 100;
|
||||||
adjust_scaled = 10000 + max_adjust;
|
if (adjust_scaled > 10000 + max_adjust_up)
|
||||||
if (adjust_scaled < 10000 - max_adjust)
|
adjust_scaled = 10000 + max_adjust_up;
|
||||||
adjust_scaled = 10000 - max_adjust;
|
if (adjust_scaled < 10000 - max_adjust_down)
|
||||||
|
adjust_scaled = 10000 - max_adjust_down;
|
||||||
|
|
||||||
cryptonote::difficulty_type adjusted = (calculated_difficulty * adjust_scaled) / 10000;
|
cryptonote::difficulty_type adjusted = (calculated_difficulty * adjust_scaled) / 10000;
|
||||||
if (adjusted < 1)
|
if (adjusted < 1)
|
||||||
|
|||||||
Reference in New Issue
Block a user