Skip to content

Commit 3f9fedf

Browse files
committed
Reward tweak
We have to keep old undefined calculation so that everyone remains on the same fork. Behavior will be corrected at fork upgrade height.
1 parent 421ccd0 commit 3f9fedf

2 files changed

Lines changed: 13 additions & 9 deletions

File tree

src/CryptoNoteCore/Currency.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,17 @@ bool Currency::generateGenesisBlock() {
105105
}
106106

107107
uint64_t Currency::baseRewardFunction(uint64_t alreadyGeneratedCoins, uint32_t height) const {
108-
uint64_t base_reward = START_BLOCK_REWARD >> (static_cast<uint64_t>(height) / REWARD_HALVING_INTERVAL);
109-
base_reward = (std::max)(base_reward, MIN_BLOCK_REWARD);
110-
//block 704000 reward fix at 12AM CST 8/20/18
111-
if (height >= parameters::UPGRADE_HEIGHT_V6)
112-
base_reward = MIN_BLOCK_REWARD;
113-
base_reward = (std::min)(base_reward, m_moneySupply - alreadyGeneratedCoins);
114-
return base_reward;
108+
uint64_t base_reward;
109+
if (height < parameters::UPGRADE_HEIGHT_V6)
110+
base_reward = START_BLOCK_REWARD >> (static_cast<uint64_t>(height) / REWARD_HALVING_INTERVAL);
111+
else
112+
{
113+
uint64_t shift = static_cast<uint64_t>(height) / REWARD_HALVING_INTERVAL;
114+
base_reward = shift >= 64 ? 0 : START_BLOCK_REWARD >> shift;
115+
}
116+
base_reward = (std::max)(base_reward, MIN_BLOCK_REWARD);
117+
base_reward = (std::min)(base_reward, m_moneySupply - alreadyGeneratedCoins);
118+
return base_reward;
115119
}
116120

117121
size_t Currency::blockGrantedFullRewardZoneByBlockVersion(uint8_t blockMajorVersion) const {

src/version.h.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#define BUILD_COMMIT_ID "@VERSION@"
2-
#define PROJECT_VERSION "6.0.0-beta"
3-
#define PROJECT_VERSION_BUILD_NO "1806"
2+
#define PROJECT_VERSION "6.0.1-beta"
3+
#define PROJECT_VERSION_BUILD_NO "1807"
44
#define PROJECT_VERSION_LONG PROJECT_VERSION "." PROJECT_VERSION_BUILD_NO "(" BUILD_COMMIT_ID ")"

0 commit comments

Comments
 (0)