Skip to content

Commit

Permalink
Fix some Sonar issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Apolixit committed Jan 31, 2024
1 parent e25ca6f commit 0c32cb8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Substrate.NetApi/Mnemonic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public static string MnemonicToEntropy(string mnemonic, BIP39Wordlist wordlistTy
var newChecksum = DeriveChecksumBits(entropyBytes);

if (newChecksum != checksumBits)
throw new Exception("InvalidChecksum");
throw new InvalidOperationException("InvalidChecksum");

var result = BitConverter
.ToString(entropyBytes)
Expand All @@ -259,7 +259,7 @@ private static void CheckValidEntropy(byte[] entropyBytes)
private static string DeriveChecksumBits(byte[] entropyBytes)
{
var ent = entropyBytes.Length * 8;
var cs = (int)ent / 32;
var cs = ent / 32;

var sha256Provider = SHA256.Create();
var hash = sha256Provider.ComputeHash(entropyBytes);
Expand Down Expand Up @@ -302,7 +302,7 @@ private static Wordlist GetWordlist(BIP39Wordlist language)
return new Portuguese();

default:
throw new Exception($"Unknown {language} in BIP39 implementation!");
throw new InvalidOperationException($"Unknown {language} in BIP39 implementation!");
}
}

Expand Down

0 comments on commit 0c32cb8

Please sign in to comment.