Skip to content

Commit 426bee0

Browse files
[BugFix] entering a mnemonic without any mising words will report its validity instead of crashing
1 parent d7eedd1 commit 426bee0

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

Src/FinderOuter/Services/MnemonicSevice.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1503,6 +1503,30 @@ public async void FindMissing(string mnemonic, char missChar, string pass, strin
15031503
return;
15041504
else
15051505
{
1506+
if (missCount == 0)
1507+
{
1508+
try
1509+
{
1510+
if (mnType == MnemonicTypes.BIP39)
1511+
{
1512+
using BIP0039 temp = new BIP0039(mnemonic, wl, pass);
1513+
}
1514+
else if (mnType == MnemonicTypes.Electrum)
1515+
{
1516+
using ElectrumMnemonic temp = new ElectrumMnemonic(mnemonic, wl, pass);
1517+
}
1518+
1519+
report.Pass($"Given mnemonic is a valid {mnType}.");
1520+
}
1521+
catch (Exception ex)
1522+
{
1523+
report.Fail($"Mnemonic is not missing any characters but is invalid. Error: {ex.Message}.");
1524+
}
1525+
1526+
return;
1527+
}
1528+
1529+
15061530
mnBytes = GetSeedByte(words.Length, maxWordLen);
15071531

15081532
wordBytes = new Dictionary<uint, byte[]>(2048);

0 commit comments

Comments
 (0)