forked from MetacoSA/NBitcoin
-
Notifications
You must be signed in to change notification settings - Fork 61
Open
Description
One cannot run NetworkBuilder.BuildAndRegister() to create a Network before triggering the static ctor of Network one time before so that it already creates BitcoinMain. Otherwise, this line will crash:
assert(consensus.HashGenesisBlock == uint256.Parse("0x000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f"));
This can be worked around like shown below, but it's very confusing :-)
public static void Main(string[] args)
{
var fix= Network.Main; // execute static constructor of Network before everything else, or crash
var network = !args.Contains("-testnet")
? MyNetworks.RegisterMain()
: MyNetworks.RegisterTest();
if (NodeSettings.PrintHelp(args, network))
return;
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels