From 74dca62b6cd7a45064ec7aa1e8027e9ed442f2d0 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Thu, 2 Sep 2021 19:54:28 -0600 Subject: [PATCH 1/3] reduce block reward --- src/cryptonote_basic/cryptonote_basic_impl.cpp | 4 +++- src/cryptonote_core/blockchain.cpp | 4 +++- src/version.cpp.in | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/cryptonote_basic/cryptonote_basic_impl.cpp b/src/cryptonote_basic/cryptonote_basic_impl.cpp index 884250261..e1b4a2317 100644 --- a/src/cryptonote_basic/cryptonote_basic_impl.cpp +++ b/src/cryptonote_basic/cryptonote_basic_impl.cpp @@ -144,9 +144,11 @@ namespace cryptonote { assert(reward_lo < base_reward); reward = reward_lo; - if (version >= 10) { + if (version >= 18) { // halving reward since version 10 reward /= 2; + // quartering reward since version 18 + reward /= 4; } return true; } diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index 113f58bce..4b8ca6a35 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -130,7 +130,9 @@ static const struct { // hf 16 increase stake period to 32 days, 2019-08-12@15:00:00+00 { 16, 412780, 0, 1565622000 }, // hf 17 RandomX PoW, 2021-08-18T@12:00:00+00 - { 17, 936150, 0, 1629288000 } + { 17, 936150, 0, 1629288000 }, + // hf 18 reduce block reward, 2021-09-09@00:00:00+00 + { 18, 952260, 0, 1631145600 } }; // static const uint64_t mainnet_hard_fork_version_1_till = 1009826; static const uint64_t mainnet_hard_fork_version_1_till = 1; diff --git a/src/version.cpp.in b/src/version.cpp.in index 0896bd700..c9b4b446d 100644 --- a/src/version.cpp.in +++ b/src/version.cpp.in @@ -1,5 +1,5 @@ #define DEF_GRAFT_VERSION_TAG "@VERSIONTAG@" -#define DEF_GRAFT_VERSION "1.10.0" +#define DEF_GRAFT_VERSION "1.10.1" #define DEF_GRAFT_RELEASE_NAME "Vela Pulsar" #define DEF_GRAFT_VERSION_FULL DEF_GRAFT_VERSION "-" DEF_GRAFT_VERSION_TAG From c3f360745e3a72ca7f204ecad17432dabbff721e Mon Sep 17 00:00:00 2001 From: Ilya Kitaev Date: Tue, 14 Sep 2021 16:37:35 +0300 Subject: [PATCH 2/3] fix: reducing block reward for hf18 --- .../cryptonote_basic_impl.cpp | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/cryptonote_basic/cryptonote_basic_impl.cpp b/src/cryptonote_basic/cryptonote_basic_impl.cpp index e1b4a2317..8a5697aab 100644 --- a/src/cryptonote_basic/cryptonote_basic_impl.cpp +++ b/src/cryptonote_basic/cryptonote_basic_impl.cpp @@ -85,6 +85,19 @@ namespace cryptonote { { return CRYPTONOTE_MAX_TX_SIZE; } + + uint64_t get_adjusted_block_reward(uint64_t reward_in, uint8_t hf_version) + { + uint64_t reward = reward_in; + if (hf_version >= 10) { + // halving reward since version 10 + reward /= 2; + if (hf_version >= 18) + // quartering reward since version 18 + reward /= 4; + } + return reward; + } //----------------------------------------------------------------------------------------------- bool get_block_reward(size_t median_weight, size_t current_block_weight, uint64_t already_generated_coins, uint64_t &reward, uint8_t version) { static_assert(DIFFICULTY_TARGET_V2%60==0&&DIFFICULTY_TARGET_V1%60==0,"difficulty targets must be a multiple of 60"); @@ -113,11 +126,7 @@ namespace cryptonote { } if (current_block_weight <= median_weight) { - reward = base_reward; - if (version >= 10) { - // halving reward since version 10 - reward /= 2; - } + reward = get_adjusted_block_reward(base_reward, version); return true; } @@ -142,14 +151,7 @@ namespace cryptonote { div128_32(reward_hi, reward_lo, static_cast(median_weight), &reward_hi, &reward_lo); assert(0 == reward_hi); assert(reward_lo < base_reward); - - reward = reward_lo; - if (version >= 18) { - // halving reward since version 10 - reward /= 2; - // quartering reward since version 18 - reward /= 4; - } + reward = get_adjusted_block_reward(reward_lo, version); return true; } //------------------------------------------------------------------------------------ From b457688a3f491979dfdc8943730b75031798c3c5 Mon Sep 17 00:00:00 2001 From: Ilya Kitaev Date: Tue, 14 Sep 2021 16:37:59 +0300 Subject: [PATCH 3/3] re-scheduled hf18 --- src/cryptonote_core/blockchain.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index 4b8ca6a35..5963d1407 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -131,8 +131,8 @@ static const struct { { 16, 412780, 0, 1565622000 }, // hf 17 RandomX PoW, 2021-08-18T@12:00:00+00 { 17, 936150, 0, 1629288000 }, - // hf 18 reduce block reward, 2021-09-09@00:00:00+00 - { 18, 952260, 0, 1631145600 } + // hf 18 reduce block reward, 2021-09-21@12:00:00+00 + { 18, 960490, 0, 1632225600 } }; // static const uint64_t mainnet_hard_fork_version_1_till = 1009826; static const uint64_t mainnet_hard_fork_version_1_till = 1; @@ -178,7 +178,9 @@ static const struct { // hf 16 increase stake period to 32 days, 2019-08-05T@09:00:00+00 { 16, 381520, 0, 1564995600 }, // hf 17 RandomX PoW, 2021-07-29T@08:30:00+00 - { 17, 421865, 0, 1627547400 } + { 17, 421865, 0, 1627547400 }, + // hf 18 quartered block reward, 2021-09-17@12:00:00+00 + { 18, 457790, 0, 1631880000 } }; // static const uint64_t testnet_hard_fork_version_1_till = 624633;