Skip to content

Commit

Permalink
test: Activate segwit in TestChain100Setup
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoFalke committed Aug 21, 2020
1 parent fa11ff2 commit fad84b7
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions src/test/util/setup_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,6 @@ TestingSetup::~TestingSetup()

TestChain100Setup::TestChain100Setup()
{
// CreateAndProcessBlock() does not support building SegWit blocks, so don't activate in these tests.
// TODO: fix the code to support SegWit blocks.
gArgs.ForceSetArg("-segwitheight", "432");
// Need to recreate chainparams
SelectParams(CBaseChainParams::REGTEST);

// Generate a 100-block chain:
coinbaseKey.MakeNewKey(true);
CScript scriptPubKey = CScript() << ToByteVector(coinbaseKey.GetPubKey()) << OP_CHECKSIG;
Expand All @@ -222,12 +216,7 @@ CBlock TestChain100Setup::CreateAndProcessBlock(const std::vector<CMutableTransa
for (const CMutableTransaction& tx : txns) {
block.vtx.push_back(MakeTransactionRef(tx));
}
// IncrementExtraNonce creates a valid coinbase and merkleRoot
{
LOCK(cs_main);
unsigned int extraNonce = 0;
IncrementExtraNonce(&block, ::ChainActive().Tip(), extraNonce);
}
RegenerateCommitments(block);

while (!CheckProofOfWork(block.GetHash(), block.nBits, chainparams.GetConsensus())) ++block.nNonce;

Expand Down

0 comments on commit fad84b7

Please sign in to comment.