From a8eedce9032f3648cb67c940167b460814af1a10 Mon Sep 17 00:00:00 2001 From: quantumagi Date: Wed, 10 Nov 2021 15:02:58 +1100 Subject: [PATCH] Resolve warnings found in NBitcoin --- src/NBitcoin/BIP39/Mnemonic.cs | 8 ++++---- src/NBitcoin/Money.cs | 2 +- src/NBitcoin/TransactionBuilder.cs | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/NBitcoin/BIP39/Mnemonic.cs b/src/NBitcoin/BIP39/Mnemonic.cs index 6b322a5905..ddfca69f04 100644 --- a/src/NBitcoin/BIP39/Mnemonic.cs +++ b/src/NBitcoin/BIP39/Mnemonic.cs @@ -27,7 +27,7 @@ public Mnemonic(string mnemonic, Wordlist wordlist = null) wordlist = Wordlist.AutoDetect(mnemonic) ?? Wordlist.English; string[] words = mnemonic.Split((char[])null, StringSplitOptions.RemoveEmptyEntries); - _Mnemonic = string.Join(wordlist.Space.ToString(), words); + this._Mnemonic = string.Join(wordlist.Space.ToString(), words); //if the sentence is not at least 12 characters or cleanly divisible by 3, it is bad! if (!CorrectWordCount(words.Length)) @@ -54,7 +54,7 @@ public Mnemonic(Wordlist wordList, byte[] entropy = null) int i = Array.IndexOf(entArray, entropy.Length * 8); if(i == -1) - throw new ArgumentException("The length for entropy should be : " + String.Join(",", entArray), "entropy"); + throw new ArgumentException("The length for entropy should be : " + string.Join(",", entArray), "entropy"); int cs = csArray[i]; byte[] checksum = Hashes.SHA256(entropy); @@ -200,10 +200,10 @@ public ExtKey DeriveExtKey(string passphrase = null) return new ExtKey(DeriveSeed(passphrase)); } - private static Byte[] Concat(Byte[] source1, Byte[] source2) + private static byte[] Concat(byte[] source1, byte[] source2) { //Most efficient way to merge two arrays this according to http://stackoverflow.com/questions/415291/best-way-to-combine-two-or-more-byte-arrays-in-c-sharp - var buffer = new Byte[source1.Length + source2.Length]; + var buffer = new byte[source1.Length + source2.Length]; Buffer.BlockCopy(source1, 0, buffer, 0, source1.Length); Buffer.BlockCopy(source2, 0, buffer, source1.Length, source2.Length); diff --git a/src/NBitcoin/Money.cs b/src/NBitcoin/Money.cs index 4fdeb62091..03f485c08d 100644 --- a/src/NBitcoin/Money.cs +++ b/src/NBitcoin/Money.cs @@ -857,7 +857,7 @@ public string Format(string format, object arg, IFormatProvider formatProvider) i++; } char unit = format[i]; - var unitToUseInCalc = MoneyUnit.BTC; + MoneyUnit unitToUseInCalc = MoneyUnit.BTC; switch (unit) { case 'B': diff --git a/src/NBitcoin/TransactionBuilder.cs b/src/NBitcoin/TransactionBuilder.cs index cb8cc12014..994aea9e4e 100644 --- a/src/NBitcoin/TransactionBuilder.cs +++ b/src/NBitcoin/TransactionBuilder.cs @@ -1584,7 +1584,7 @@ public int EstimateSize(Transaction tx, bool virtualSize) int witSize = 0; if (tx.HasWitness) witSize += 2; - foreach (var txin in tx.Inputs.AsIndexedInputs()) + foreach (IndexedTxIn txin in tx.Inputs.AsIndexedInputs()) { ICoin coin = FindSignableCoin(txin) ?? FindCoin(txin.PrevOut); if (coin == null)