Remove GetBlockSubsidy (Not Used - replaced)
This commit is contained in:
parent
c909ac2e09
commit
4c94a061c0
|
@ -13,54 +13,6 @@
|
||||||
|
|
||||||
BOOST_FIXTURE_TEST_SUITE(main_tests, TestingSetup)
|
BOOST_FIXTURE_TEST_SUITE(main_tests, TestingSetup)
|
||||||
|
|
||||||
static void TestBlockSubsidyHalvings(const Consensus::Params& consensusParams)
|
|
||||||
{
|
|
||||||
// tested in dogecoin_tests.cpp
|
|
||||||
//int maxHalvings = 64;
|
|
||||||
//CAmount nInitialSubsidy = 50 * COIN;
|
|
||||||
|
|
||||||
//CAmount nPreviousSubsidy = nInitialSubsidy * 2; // for height == 0
|
|
||||||
//BOOST_CHECK_EQUAL(nPreviousSubsidy, nInitialSubsidy * 2);
|
|
||||||
//for (int nHalvings = 0; nHalvings < maxHalvings; nHalvings++) {
|
|
||||||
// int nHeight = nHalvings * consensusParams.nSubsidyHalvingInterval;
|
|
||||||
// CAmount nSubsidy = GetBlockSubsidy(nHeight, consensusParams);
|
|
||||||
// BOOST_CHECK(nSubsidy <= nInitialSubsidy);
|
|
||||||
// BOOST_CHECK_EQUAL(nSubsidy, nPreviousSubsidy / 2);
|
|
||||||
// nPreviousSubsidy = nSubsidy;
|
|
||||||
//}
|
|
||||||
//BOOST_CHECK_EQUAL(GetBlockSubsidy(maxHalvings * consensusParams.nSubsidyHalvingInterval, consensusParams), 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void TestBlockSubsidyHalvings(int nSubsidyHalvingInterval)
|
|
||||||
{
|
|
||||||
// tested in dogecoin_tests.cpp
|
|
||||||
//Consensus::Params consensusParams;
|
|
||||||
//consensusParams.nSubsidyHalvingInterval = nSubsidyHalvingInterval;
|
|
||||||
//TestBlockSubsidyHalvings(consensusParams);
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(block_subsidy_test)
|
|
||||||
{
|
|
||||||
// tested in dogecoin_tests.cpp
|
|
||||||
//TestBlockSubsidyHalvings(Params(CBaseChainParams::MAIN).GetConsensus()); // As in main
|
|
||||||
//TestBlockSubsidyHalvings(150); // As in regtest
|
|
||||||
//TestBlockSubsidyHalvings(1000); // Just another interval
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(subsidy_limit_test)
|
|
||||||
{
|
|
||||||
// tested in dogecoin_tests.cpp
|
|
||||||
//const Consensus::Params& consensusParams = Params(CBaseChainParams::MAIN).GetConsensus();
|
|
||||||
//CAmount nSum = 0;
|
|
||||||
//for (int nHeight = 0; nHeight < 14000000; nHeight += 1000) {
|
|
||||||
// CAmount nSubsidy = GetBlockSubsidy(nHeight, consensusParams);
|
|
||||||
// BOOST_CHECK(nSubsidy <= 50 * COIN);
|
|
||||||
// nSum += nSubsidy * 1000;
|
|
||||||
// BOOST_CHECK(MoneyRange(nSum));
|
|
||||||
//}
|
|
||||||
//BOOST_CHECK_EQUAL(nSum, 2099999997690000ULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ReturnFalse() { return false; }
|
bool ReturnFalse() { return false; }
|
||||||
bool ReturnTrue() { return true; }
|
bool ReturnTrue() { return true; }
|
||||||
|
|
||||||
|
|
|
@ -1219,19 +1219,6 @@ bool ReadBlockHeaderFromDisk(CBlockHeader& block, const CBlockIndex* pindex, con
|
||||||
return ReadBlockOrHeader(block, pindex, consensusParams, fCheckPOW);
|
return ReadBlockOrHeader(block, pindex, consensusParams, fCheckPOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams)
|
|
||||||
{
|
|
||||||
int halvings = nHeight / consensusParams.nSubsidyHalvingInterval;
|
|
||||||
// Force block reward to zero when right shift is undefined.
|
|
||||||
if (halvings >= 64)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
CAmount nSubsidy = 50 * COIN;
|
|
||||||
// Subsidy is cut in half every 210,000 blocks which will occur approximately every 4 years.
|
|
||||||
nSubsidy >>= halvings;
|
|
||||||
return nSubsidy;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IsInitialBlockDownload()
|
bool IsInitialBlockDownload()
|
||||||
{
|
{
|
||||||
const CChainParams& chainParams = Params();
|
const CChainParams& chainParams = Params();
|
||||||
|
|
|
@ -289,7 +289,6 @@ std::string GetWarnings(const std::string& strFor);
|
||||||
bool GetTransaction(const uint256 &hash, CTransactionRef &tx, const Consensus::Params& params, uint256 &hashBlock, bool fAllowSlow = false);
|
bool GetTransaction(const uint256 &hash, CTransactionRef &tx, const Consensus::Params& params, uint256 &hashBlock, bool fAllowSlow = false);
|
||||||
/** Find the best known block, and make it the tip of the block chain */
|
/** Find the best known block, and make it the tip of the block chain */
|
||||||
bool ActivateBestChain(CValidationState& state, const CChainParams& chainparams, std::shared_ptr<const CBlock> pblock = std::shared_ptr<const CBlock>());
|
bool ActivateBestChain(CValidationState& state, const CChainParams& chainparams, std::shared_ptr<const CBlock> pblock = std::shared_ptr<const CBlock>());
|
||||||
CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams);
|
|
||||||
|
|
||||||
/** Guess verification progress (as a fraction between 0.0=genesis and 1.0=current tip). */
|
/** Guess verification progress (as a fraction between 0.0=genesis and 1.0=current tip). */
|
||||||
double GuessVerificationProgress(const ChainTxData& data, CBlockIndex* pindex);
|
double GuessVerificationProgress(const ChainTxData& data, CBlockIndex* pindex);
|
||||||
|
|
Loading…
Reference in a new issue