@@ -70,6 +70,7 @@ class CMainParams : public CChainParams {
70
70
consensus.BIP65Height = 388381 ; // 000000000000000004c2b624ed5d7756c508d90fd0da2c7c679febfa6c4735f0
71
71
consensus.BIP66Height = 363725 ; // 00000000000000000379eaa19dce8c9b722d46ae6a57c2f1a988119488b50931
72
72
consensus.CSVHeight = 419328 ; // 000000000000000004a1b34462cb8aeebd5799177f7a29cf28f2d1961716b5b5
73
+ consensus.SegwitHeight = 481824 ; // 0000000000000000001c8018d9cb3b742ef25114f27563e3fc4a1902167f9893
73
74
consensus.powLimit = uint256S (" 00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff" );
74
75
consensus.nPowTargetTimespan = 14 * 24 * 60 * 60 ; // two weeks
75
76
consensus.nPowTargetSpacing = 10 * 60 ;
@@ -81,11 +82,6 @@ class CMainParams : public CChainParams {
81
82
consensus.vDeployments [Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = 1199145601 ; // January 1, 2008
82
83
consensus.vDeployments [Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = 1230767999 ; // December 31, 2008
83
84
84
- // Deployment of SegWit (BIP141, BIP143, and BIP147)
85
- consensus.vDeployments [Consensus::DEPLOYMENT_SEGWIT].bit = 1 ;
86
- consensus.vDeployments [Consensus::DEPLOYMENT_SEGWIT].nStartTime = 1479168000 ; // November 15th, 2016.
87
- consensus.vDeployments [Consensus::DEPLOYMENT_SEGWIT].nTimeout = 1510704000 ; // November 15th, 2017.
88
-
89
85
// The best chain should have at least this much work.
90
86
consensus.nMinimumChainWork = uint256S (" 0x0000000000000000000000000000000000000000051dc8b82f450202ecb3d471" );
91
87
@@ -180,6 +176,7 @@ class CTestNetParams : public CChainParams {
180
176
consensus.BIP65Height = 581885 ; // 00000000007f6655f22f98e72ed80d8b06dc761d5da09df0fa1dc4be4f861eb6
181
177
consensus.BIP66Height = 330776 ; // 000000002104c8c45e99a8853285a3b592602a3ccde2b832481da85e9e4ba182
182
178
consensus.CSVHeight = 770112 ; // 00000000025e930139bac5c6c31a403776da130831ab85be56578f3fa75369bb
179
+ consensus.SegwitHeight = 834624 ; // 00000000002b980fcd729daaa248fd9316a5200e9b367f4ff2c42453e84201ca
183
180
consensus.powLimit = uint256S (" 00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff" );
184
181
consensus.nPowTargetTimespan = 14 * 24 * 60 * 60 ; // two weeks
185
182
consensus.nPowTargetSpacing = 10 * 60 ;
@@ -191,11 +188,6 @@ class CTestNetParams : public CChainParams {
191
188
consensus.vDeployments [Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = 1199145601 ; // January 1, 2008
192
189
consensus.vDeployments [Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = 1230767999 ; // December 31, 2008
193
190
194
- // Deployment of SegWit (BIP141, BIP143, and BIP147)
195
- consensus.vDeployments [Consensus::DEPLOYMENT_SEGWIT].bit = 1 ;
196
- consensus.vDeployments [Consensus::DEPLOYMENT_SEGWIT].nStartTime = 1462060800 ; // May 1st 2016
197
- consensus.vDeployments [Consensus::DEPLOYMENT_SEGWIT].nTimeout = 1493596800 ; // May 1st 2017
198
-
199
191
// The best chain should have at least this much work.
200
192
consensus.nMinimumChainWork = uint256S (" 0x00000000000000000000000000000000000000000000007dbe94253893cbd463" );
201
193
@@ -268,6 +260,7 @@ class CRegTestParams : public CChainParams {
268
260
consensus.BIP65Height = 1351 ; // BIP65 activated on regtest (Used in functional tests)
269
261
consensus.BIP66Height = 1251 ; // BIP66 activated on regtest (Used in functional tests)
270
262
consensus.CSVHeight = 432 ; // CSV activated on regtest (Used in rpc activation tests)
263
+ consensus.SegwitHeight = 0 ; // SEGWIT is always activated on regtest unless overridden
271
264
consensus.powLimit = uint256S (" 7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" );
272
265
consensus.nPowTargetTimespan = 14 * 24 * 60 * 60 ; // two weeks
273
266
consensus.nPowTargetSpacing = 10 * 60 ;
@@ -278,9 +271,6 @@ class CRegTestParams : public CChainParams {
278
271
consensus.vDeployments [Consensus::DEPLOYMENT_TESTDUMMY].bit = 28 ;
279
272
consensus.vDeployments [Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = 0 ;
280
273
consensus.vDeployments [Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
281
- consensus.vDeployments [Consensus::DEPLOYMENT_SEGWIT].bit = 1 ;
282
- consensus.vDeployments [Consensus::DEPLOYMENT_SEGWIT].nStartTime = Consensus::BIP9Deployment::ALWAYS_ACTIVE;
283
- consensus.vDeployments [Consensus::DEPLOYMENT_SEGWIT].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
284
274
285
275
// The best chain should have at least this much work.
286
276
consensus.nMinimumChainWork = uint256S (" 0x00" );
@@ -297,7 +287,7 @@ class CRegTestParams : public CChainParams {
297
287
m_assumed_blockchain_size = 0 ;
298
288
m_assumed_chain_state_size = 0 ;
299
289
300
- UpdateVersionBitsParametersFromArgs (args);
290
+ UpdateActivationParametersFromArgs (args);
301
291
302
292
genesis = CreateGenesisBlock (1296688602 , 2 , 0x207fffff , 1 , 50 * COIN);
303
293
consensus.hashGenesisBlock = genesis.GetHash ();
@@ -340,11 +330,22 @@ class CRegTestParams : public CChainParams {
340
330
consensus.vDeployments [d].nStartTime = nStartTime;
341
331
consensus.vDeployments [d].nTimeout = nTimeout;
342
332
}
343
- void UpdateVersionBitsParametersFromArgs (const ArgsManager& args);
333
+ void UpdateActivationParametersFromArgs (const ArgsManager& args);
344
334
};
345
335
346
- void CRegTestParams::UpdateVersionBitsParametersFromArgs (const ArgsManager& args)
336
+ void CRegTestParams::UpdateActivationParametersFromArgs (const ArgsManager& args)
347
337
{
338
+ if (gArgs .IsArgSet (" -segwitheight" )) {
339
+ int64_t height = gArgs .GetArg (" -segwitheight" , consensus.SegwitHeight );
340
+ if (height < -1 || height >= std::numeric_limits<int >::max ()) {
341
+ throw std::runtime_error (strprintf (" Activation height %ld for segwit is out of valid range. Use -1 to disable segwit." , height));
342
+ } else if (height == -1 ) {
343
+ LogPrintf (" Segwit disabled for testing\n " );
344
+ height = std::numeric_limits<int >::max ();
345
+ }
346
+ consensus.SegwitHeight = static_cast <int >(height);
347
+ }
348
+
348
349
if (!args.IsArgSet (" -vbparams" )) return ;
349
350
350
351
for (const std::string& strDeployment : args.GetArgs (" -vbparams" )) {
0 commit comments