@@ -277,11 +277,12 @@ class CTestNetParams : public CChainParams {
277
277
*/
278
278
class SigNetParams : public CChainParams {
279
279
public:
280
- explicit SigNetParams (const ArgsManager& args) {
280
+ explicit SigNetParams (const SigNetOptions& options)
281
+ {
281
282
std::vector<uint8_t > bin;
282
283
vSeeds.clear ();
283
284
284
- if (!args. IsArgSet ( " -signetchallenge " ) ) {
285
+ if (!options. challenge ) {
285
286
bin = ParseHex (" 512103ad5e0edad18cb1f0fc0d28a3d4f1f3e445640337489abb10404f2d1e086be430210359ef5021964fe22d6f8e05b2463c9540ce96883fe3b278760f048f5189f2e6c452ae" );
286
287
vSeeds.emplace_back (" seed.signet.bitcoin.sprovoost.nl." );
287
288
@@ -300,12 +301,7 @@ class SigNetParams : public CChainParams {
300
301
.dTxRate = 0.02336701143027275 ,
301
302
};
302
303
} else {
303
- const auto signet_challenge = args.GetArgs (" -signetchallenge" );
304
- if (signet_challenge.size () != 1 ) {
305
- throw std::runtime_error (strprintf (" %s: -signetchallenge cannot be multiple values." , __func__));
306
- }
307
- bin = ParseHex (signet_challenge[0 ]);
308
-
304
+ bin = *options.challenge ;
309
305
consensus.nMinimumChainWork = uint256{};
310
306
consensus.defaultAssumeValid = uint256{};
311
307
m_assumed_blockchain_size = 0 ;
@@ -315,11 +311,11 @@ class SigNetParams : public CChainParams {
315
311
0 ,
316
312
0 ,
317
313
};
318
- LogPrintf (" Signet with challenge %s\n " , signet_challenge[ 0 ] );
314
+ LogPrintf (" Signet with challenge %s\n " , HexStr (bin) );
319
315
}
320
316
321
- if (args. IsArgSet ( " -signetseednode " ) ) {
322
- vSeeds = args. GetArgs ( " -signetseednode " ) ;
317
+ if (options. seeds ) {
318
+ vSeeds = *options. seeds ;
323
319
}
324
320
325
321
strNetworkID = CBaseChainParams::SIGNET;
@@ -382,11 +378,26 @@ class SigNetParams : public CChainParams {
382
378
}
383
379
};
384
380
381
+ void ReadSigNetArgs (const ArgsManager& args, CChainParams::SigNetOptions& options)
382
+ {
383
+ if (args.IsArgSet (" -signetseednode" )) {
384
+ options.seeds .emplace (args.GetArgs (" -signetseednode" ));
385
+ }
386
+ if (args.IsArgSet (" -signetchallenge" )) {
387
+ const auto signet_challenge = args.GetArgs (" -signetchallenge" );
388
+ if (signet_challenge.size () != 1 ) {
389
+ throw std::runtime_error (strprintf (" %s: -signetchallenge cannot be multiple values." , __func__));
390
+ }
391
+ options.challenge .emplace (ParseHex (signet_challenge[0 ]));
392
+ }
393
+ }
394
+
385
395
/* *
386
396
* Regression test: intended for private networks only. Has minimal difficulty to ensure that
387
397
* blocks can be found instantly.
388
398
*/
389
- class CRegTestParams : public CChainParams {
399
+ class CRegTestParams : public CChainParams
400
+ {
390
401
public:
391
402
explicit CRegTestParams (const ArgsManager& args) {
392
403
strNetworkID = CBaseChainParams::REGTEST;
@@ -570,7 +581,9 @@ std::unique_ptr<const CChainParams> CreateChainParams(const ArgsManager& args, c
570
581
} else if (chain == CBaseChainParams::TESTNET) {
571
582
return std::unique_ptr<CChainParams>(new CTestNetParams ());
572
583
} else if (chain == CBaseChainParams::SIGNET) {
573
- return std::unique_ptr<CChainParams>(new SigNetParams (args));
584
+ auto opts = CChainParams::SigNetOptions{};
585
+ ReadSigNetArgs (args, opts);
586
+ return std::make_unique<const SigNetParams>(opts);
574
587
} else if (chain == CBaseChainParams::REGTEST) {
575
588
return std::unique_ptr<CChainParams>(new CRegTestParams (args));
576
589
}
0 commit comments