Fix/update comments

This commit is contained in:
Eirik Ogilvie-Wigley 2019-08-05 12:41:31 -06:00
parent 9f70b74692
commit 7ddcf427c0
4 changed files with 7 additions and 10 deletions

View File

@ -15,11 +15,11 @@ namespace Consensus {
// floor((BlossomActivationHeight - SlowStartShift) / PreBlossomHalvingInterval + (height - BlossomActivationHeight) / PostBlossomHalvingInterval), otherwise
if (NetworkUpgradeActive(nHeight, Consensus::UPGRADE_BLOSSOM)) {
int blossomActivationHeight = vUpgrades[Consensus::UPGRADE_BLOSSOM].nActivationHeight;
// // Ideally we would say:
// Ideally we would say:
// halvings = (blossomActivationHeight - consensusParams.SubsidySlowStartShift()) / consensusParams.nPreBlossomSubsidyHalvingInterval
// + (nHeight - blossomActivationHeight) / consensusParams.nPostBlossomSubsidyHalvingInterval;
// But, (blossomActivationHeight - consensusParams.SubsidySlowStartShift()) / consensusParams.nPreBlossomSubsidyHalvingInterval
// needs to be a treated rational number or this does not work.
// would need to be treated as a rational number in order for this to work.
// Define scaledHalvings := halvings * consensusParams.nPreBlossomSubsidyHalvingInterval;
int scaledHalvings = (blossomActivationHeight - SubsidySlowStartShift())
+ (nHeight - blossomActivationHeight) / Consensus::BLOSSOM_POW_TARGET_SPACING_RATIO;

View File

@ -6662,13 +6662,10 @@ CMutableTransaction CreateNewContextualCMutableTransaction(const Consensus::Para
}
// NOTE: If the expiry height crosses into an incompatible consensus epoch, and it is changed to the last block
// of the current epoch (see below: Overwinter->Sapling), the transaction will be rejected if it falls within
// the expiring soon threshold of 3 blocks (for DoS mitigation) based on the current height.
// of the current epoch, the transaction will be rejected if it falls within the expiring soon threshold of
// TX_EXPIRING_SOON_THRESHOLD (3) blocks (for DoS mitigation) based on the current height.
auto nextActivationHeight = NextActivationHeight(nHeight, consensusParams);
if (nextActivationHeight) {
// We need to add TX_EXPIRING_SOON_THRESHOLD otherwise we cannot send transactions just prior to the next epoch
// The idea is that the transaction will not be rejected as expiring soon until the same block that it is
// The rejected for being created during the last epoch.
mtx.nExpiryHeight = std::min(mtx.nExpiryHeight, static_cast<uint32_t>(nextActivationHeight.get()) - 1);
}
}

View File

@ -392,6 +392,8 @@ void PartitionAlertTestImpl(const Consensus::Params& params, int startTime, int
CCriticalSection csDummy;
CBlockIndex indexDummy[800];
// Generate fake blockchain timestamps relative to
// an arbitrary time:
int64_t start = startTime;
for (int i = 0; i < 800; i++)
{
@ -402,8 +404,6 @@ void PartitionAlertTestImpl(const Consensus::Params& params, int startTime, int
// Other members don't matter, the partition check code doesn't
// use them
}
// Generate fake blockchain timestamps relative to
// an arbitrary time:
int64_t now = indexDummy[799].nTime + params.PoWTargetSpacing(800);
SetMockTime(now);

View File

@ -66,7 +66,7 @@ BOOST_AUTO_TEST_CASE(block_subsidy_test)
TestBlockSubsidyHalvings(20000, Consensus::PRE_BLOSSOM_HALVING_INTERVAL, Consensus::NetworkUpgrade::NO_ACTIVATION_HEIGHT); // Pre-Blossom
TestBlockSubsidyHalvings(50, 150, 80); // As in regtest
TestBlockSubsidyHalvings(500, 1000, 900); // Just another interval
TestBlockSubsidyHalvings(500, 1000, 3000); // Multiple halvings before activation
TestBlockSubsidyHalvings(500, 1000, 3000); // Multiple halvings before Blossom activation
}
BOOST_AUTO_TEST_CASE(subsidy_limit_test)