Skip to content

Commit fad84b7

Browse files
author
MarcoFalke
committed
test: Activate segwit in TestChain100Setup
1 parent fa11ff2 commit fad84b7

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

src/test/util/setup_common.cpp

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -196,12 +196,6 @@ TestingSetup::~TestingSetup()
196196

197197
TestChain100Setup::TestChain100Setup()
198198
{
199-
// CreateAndProcessBlock() does not support building SegWit blocks, so don't activate in these tests.
200-
// TODO: fix the code to support SegWit blocks.
201-
gArgs.ForceSetArg("-segwitheight", "432");
202-
// Need to recreate chainparams
203-
SelectParams(CBaseChainParams::REGTEST);
204-
205199
// Generate a 100-block chain:
206200
coinbaseKey.MakeNewKey(true);
207201
CScript scriptPubKey = CScript() << ToByteVector(coinbaseKey.GetPubKey()) << OP_CHECKSIG;
@@ -222,12 +216,7 @@ CBlock TestChain100Setup::CreateAndProcessBlock(const std::vector<CMutableTransa
222216
for (const CMutableTransaction& tx : txns) {
223217
block.vtx.push_back(MakeTransactionRef(tx));
224218
}
225-
// IncrementExtraNonce creates a valid coinbase and merkleRoot
226-
{
227-
LOCK(cs_main);
228-
unsigned int extraNonce = 0;
229-
IncrementExtraNonce(&block, ::ChainActive().Tip(), extraNonce);
230-
}
219+
RegenerateCommitments(block);
231220

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

0 commit comments

Comments
 (0)