diff --git a/src/cryptonote_basic/cryptonote_basic_impl.cpp b/src/cryptonote_basic/cryptonote_basic_impl.cpp index 884250261..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,12 +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 >= 10) { - // halving reward since version 10 - reward /= 2; - } + reward = get_adjusted_block_reward(reward_lo, version); return true; } //------------------------------------------------------------------------------------ diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index 113f58bce..5963d1407 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-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; @@ -176,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; 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