test: Activate segwit in TestChain100Setup

This commit is contained in:
MarcoFalke 2020-08-21 15:12:45 +02:00
parent fa11ff2980
commit fad84b7e14
No known key found for this signature in database
GPG key ID: CE2B75697E69A548

View file

@ -196,12 +196,6 @@ TestingSetup::~TestingSetup()
TestChain100Setup::TestChain100Setup() 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: // Generate a 100-block chain:
coinbaseKey.MakeNewKey(true); coinbaseKey.MakeNewKey(true);
CScript scriptPubKey = CScript() << ToByteVector(coinbaseKey.GetPubKey()) << OP_CHECKSIG; CScript scriptPubKey = CScript() << ToByteVector(coinbaseKey.GetPubKey()) << OP_CHECKSIG;
@ -222,12 +216,7 @@ CBlock TestChain100Setup::CreateAndProcessBlock(const std::vector<CMutableTransa
for (const CMutableTransaction& tx : txns) { for (const CMutableTransaction& tx : txns) {
block.vtx.push_back(MakeTransactionRef(tx)); block.vtx.push_back(MakeTransactionRef(tx));
} }
// IncrementExtraNonce creates a valid coinbase and merkleRoot RegenerateCommitments(block);
{
LOCK(cs_main);
unsigned int extraNonce = 0;
IncrementExtraNonce(&block, ::ChainActive().Tip(), extraNonce);
}
while (!CheckProofOfWork(block.GetHash(), block.nBits, chainparams.GetConsensus())) ++block.nNonce; while (!CheckProofOfWork(block.GetHash(), block.nBits, chainparams.GetConsensus())) ++block.nNonce;