Use pre-Blossom max FR height when calculating address change interval

This commit is contained in:
Eirik Ogilvie-Wigley 2019-08-02 20:53:41 -06:00
parent 797713284c
commit 3eb90d4040
1 changed files with 3 additions and 4 deletions

View File

@ -571,7 +571,7 @@ bool SelectParamsFromCommandLine()
// Block height must be >0 and <=last founders reward block height
// Index variable i ranges from 0 - (vFoundersRewardAddress.size()-1)
std::string CChainParams::GetFoundersRewardAddressAtHeight(int nHeight) const {
int maxHeight = consensus.GetLastFoundersRewardBlockHeight(nHeight);
int preBlossomMaxHeight = consensus.GetLastFoundersRewardBlockHeight(0);
// zip208
// FounderAddressAdjustedHeight(height) :=
// height, if not IsBlossomActivated(height)
@ -581,9 +581,8 @@ std::string CChainParams::GetFoundersRewardAddressAtHeight(int nHeight) const {
int blossomActivationHeight = consensus.vUpgrades[Consensus::UPGRADE_BLOSSOM].nActivationHeight;
nHeight = blossomActivationHeight + ((nHeight - blossomActivationHeight) / Consensus::BLOSSOM_POW_TARGET_SPACING_RATIO);
}
assert(nHeight > 0 && nHeight <= maxHeight);
size_t addressChangeInterval = (maxHeight + vFoundersRewardAddress.size()) / vFoundersRewardAddress.size();
assert(nHeight > 0 && nHeight <= preBlossomMaxHeight);
size_t addressChangeInterval = (preBlossomMaxHeight + vFoundersRewardAddress.size()) / vFoundersRewardAddress.size();
size_t i = nHeight / addressChangeInterval;
return vFoundersRewardAddress[i];
}