Add `RegtestDeactivateCanopy` calls to restore shared regtest params.

This commit is contained in:
Kris Nuttycombe 2020-07-06 12:47:12 -06:00
parent 8b363e9a70
commit 0141aacc67
2 changed files with 8 additions and 3 deletions

View File

@ -96,9 +96,10 @@ protected:
mtx.vout[0].nValue = 0; mtx.vout[0].nValue = 0;
// Give it a Founder's Reward vout for height 1. // Give it a Founder's Reward vout for height 1.
auto rewardScript = Params().GetFoundersRewardScriptAtHeight(1);
mtx.vout.push_back(CTxOut( mtx.vout.push_back(CTxOut(
GetBlockSubsidy(1, Params().GetConsensus())/5, GetBlockSubsidy(1, Params().GetConsensus())/5,
Params().GetFoundersRewardScriptAtHeight(1))); rewardScript));
return mtx; return mtx;
} }

View File

@ -127,7 +127,7 @@ TEST(FoundersRewardTest, General) {
EXPECT_DEATH(params.GetFoundersRewardAddressAtHeight(maxHeight+1), "nHeight"); EXPECT_DEATH(params.GetFoundersRewardAddressAtHeight(maxHeight+1), "nHeight");
} }
TEST(founders_reward_test, regtest_get_last_block_blossom) { TEST(FoundersRewardTest, RegtestGetLastBlockBlossom) {
int blossomActivationHeight = Consensus::PRE_BLOSSOM_REGTEST_HALVING_INTERVAL / 2; // = 75 int blossomActivationHeight = Consensus::PRE_BLOSSOM_REGTEST_HALVING_INTERVAL / 2; // = 75
auto params = RegtestActivateBlossom(false, blossomActivationHeight); auto params = RegtestActivateBlossom(false, blossomActivationHeight);
int lastFRHeight = params.GetLastFoundersRewardBlockHeight(blossomActivationHeight); int lastFRHeight = params.GetLastFoundersRewardBlockHeight(blossomActivationHeight);
@ -136,7 +136,7 @@ TEST(founders_reward_test, regtest_get_last_block_blossom) {
RegtestDeactivateBlossom(); RegtestDeactivateBlossom();
} }
TEST(founders_reward_test, mainnet_get_last_block) { TEST(FoundersRewardTest, MainnetGetLastBlock) {
SelectParams(CBaseChainParams::MAIN); SelectParams(CBaseChainParams::MAIN);
auto params = Params().GetConsensus(); auto params = Params().GetConsensus();
int lastFRHeight = GetLastFoundersRewardHeight(params); int lastFRHeight = GetLastFoundersRewardHeight(params);
@ -255,6 +255,8 @@ TEST(FundingStreamsRewardTest, Zip207Distribution) {
} }
EXPECT_EQ(totalFunding, blockSubsidy / 5); EXPECT_EQ(totalFunding, blockSubsidy / 5);
} }
RegtestDeactivateCanopy();
} }
TEST(FundingStreamsRewardTest, ParseFundingStream) { TEST(FundingStreamsRewardTest, ParseFundingStream) {
@ -275,4 +277,6 @@ TEST(FundingStreamsRewardTest, ParseFundingStream) {
), ),
std::runtime_error std::runtime_error
); );
RegtestDeactivateCanopy();
} }