Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove dead code in Network.cs #1090

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 1 addition & 43 deletions NBitcoin/Network.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2092,7 +2092,7 @@ public INetworkSet NetworkSet
internal static Network Register(NetworkBuilder builder)
{
if (builder._Name == null)
throw new InvalidOperationException("A network name need to be provided");
throw new InvalidOperationException("A network name needs to be provided");
if (GetNetwork(builder._Name) != null)
throw new InvalidOperationException("The network " + builder._Name + " is already registered");
Network network = new Network(builder._Name, builder._Genesis.ToArray(), builder._Magic, builder._UriScheme, builder._NetworkSet);
Expand Down Expand Up @@ -2369,33 +2369,6 @@ private static IEnumerable<NetworkAddress> LoadNetworkAddresses(byte[] payload)
}
}
#endif
private Block CreateGenesisBlock(uint nTime, uint nNonce, uint nBits, int nVersion, Money genesisReward)
{
string pszTimestamp = "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks";
Script genesisOutputScript = new Script(Op.GetPushOp(Encoders.Hex.DecodeData("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f")), OpcodeType.OP_CHECKSIG);
return CreateGenesisBlock(pszTimestamp, genesisOutputScript, nTime, nNonce, nBits, nVersion, genesisReward);
}

private Block CreateGenesisBlock(string pszTimestamp, Script genesisOutputScript, uint nTime, uint nNonce, uint nBits, int nVersion, Money genesisReward)
{
Transaction txNew = Consensus.ConsensusFactory.CreateTransaction();
txNew.Version = 1;
txNew.Inputs.Add(scriptSig: new Script(Op.GetPushOp(486604799), new Op()
{
Code = (OpcodeType)0x1,
PushData = new[] { (byte)4 }
}, Op.GetPushOp(Encoders.ASCII.DecodeData(pszTimestamp))));
txNew.Outputs.Add(genesisReward, genesisOutputScript);
Block genesis = Consensus.ConsensusFactory.CreateBlock();
genesis.Header.BlockTime = Utils.UnixTimeToDateTime(nTime);
genesis.Header.Bits = nBits;
genesis.Header.Nonce = nNonce;
genesis.Header.Version = nVersion;
genesis.Transactions.Add(txNew);
genesis.Header.HashPrevBlock = uint256.Zero;
genesis.UpdateMerkleRoot();
return genesis;
}

private static void assert(bool v)
{
Expand Down Expand Up @@ -2663,16 +2636,6 @@ private IBase58Data CreateBase58Data(Base58Type type, string base58)
throw new NotSupportedException("Invalid Base58Data type : " + type.ToString());
}

//private BitcoinWitScriptAddress CreateWitScriptAddress(string base58)
//{
// return new BitcoinWitScriptAddress(base58, this);
//}

//private BitcoinWitPubKeyAddress CreateWitPubKeyAddress(string base58)
//{
// return new BitcoinWitPubKeyAddress(base58, this);
//}

private BitcoinColoredAddress CreateColoredAddress(string base58)
{
return new BitcoinColoredAddress(base58, this);
Expand Down Expand Up @@ -2811,11 +2774,6 @@ public BitcoinPubKeyAddress CreateBitcoinAddress(KeyId dest)
return NetworkStringParser.CreateP2PKH(dest, this);
}

private BitcoinScriptAddress CreateBitcoinScriptAddress(ScriptId scriptId)
{
return NetworkStringParser.CreateP2SH(scriptId, this);
}

public Message ParseMessage(byte[] bytes, uint? version = null)
{
BitcoinStream bstream = new BitcoinStream(bytes);
Expand Down