From 48b55149d34faa216a1f2233b561b79361ad2db8 Mon Sep 17 00:00:00 2001 From: Yahia Chiheb Date: Sun, 20 Mar 2022 20:47:32 +0100 Subject: [PATCH 1/5] Remove unused methods --- NBitcoin/Network.cs | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/NBitcoin/Network.cs b/NBitcoin/Network.cs index 15f663cebf..81f697b59d 100644 --- a/NBitcoin/Network.cs +++ b/NBitcoin/Network.cs @@ -2787,17 +2787,6 @@ public BitcoinSecret CreateBitcoinSecret(Key key) { return new BitcoinSecret(key, this); } - public BitcoinPubKeyAddress CreateBitcoinAddress(KeyId dest) - { - if (dest == null) - throw new ArgumentNullException(nameof(dest)); - return NetworkStringParser.CreateP2PKH(dest, this); - } - - private BitcoinScriptAddress CreateBitcoinScriptAddress(ScriptId scriptId) - { - return NetworkStringParser.CreateP2SH(scriptId, this); - } public Message ParseMessage(byte[] bytes, uint? version = null) { From b9ddafa8bbea3b98ef4424109e82ec9ac2e276f5 Mon Sep 17 00:00:00 2001 From: Yahia Chiheb Date: Sun, 20 Mar 2022 20:52:19 +0100 Subject: [PATCH 2/5] Remove unused methods --- NBitcoin/Network.cs | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/NBitcoin/Network.cs b/NBitcoin/Network.cs index 81f697b59d..406cb4f2f9 100644 --- a/NBitcoin/Network.cs +++ b/NBitcoin/Network.cs @@ -2369,33 +2369,6 @@ private static IEnumerable 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) { From b69673db04cb8acaa4d7ec29c4b8978cd9c95080 Mon Sep 17 00:00:00 2001 From: Yahia Chiheb Date: Sun, 20 Mar 2022 20:55:17 +0100 Subject: [PATCH 3/5] Fix typo --- NBitcoin/Network.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NBitcoin/Network.cs b/NBitcoin/Network.cs index 406cb4f2f9..b72db7314f 100644 --- a/NBitcoin/Network.cs +++ b/NBitcoin/Network.cs @@ -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); From 273fe884b00bc9a64af5fecd98f2af7425672f7a Mon Sep 17 00:00:00 2001 From: Yahia Chiheb Date: Sun, 20 Mar 2022 21:00:35 +0100 Subject: [PATCH 4/5] Remove commented out code --- NBitcoin/Network.cs | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/NBitcoin/Network.cs b/NBitcoin/Network.cs index b72db7314f..42b19fedc5 100644 --- a/NBitcoin/Network.cs +++ b/NBitcoin/Network.cs @@ -2619,16 +2619,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); From 52a1951b6855f6d0a179eda24ee66539d610e6ab Mon Sep 17 00:00:00 2001 From: Yahia Chiheb Date: Mon, 21 Mar 2022 19:35:17 +0100 Subject: [PATCH 5/5] Revert public method removal --- NBitcoin/Network.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/NBitcoin/Network.cs b/NBitcoin/Network.cs index 42b19fedc5..14e78de008 100644 --- a/NBitcoin/Network.cs +++ b/NBitcoin/Network.cs @@ -2750,6 +2750,12 @@ public BitcoinSecret CreateBitcoinSecret(Key key) { return new BitcoinSecret(key, this); } + public BitcoinPubKeyAddress CreateBitcoinAddress(KeyId dest) + { + if (dest == null) + throw new ArgumentNullException(nameof(dest)); + return NetworkStringParser.CreateP2PKH(dest, this); + } public Message ParseMessage(byte[] bytes, uint? version = null) {