When completing a mnemonic word, return immediately if one is found in the wordlist that starts with the given word

This commit is contained in:
Chris Rico
2017-01-01 17:38:48 -06:00
parent 434caecd96
commit 3725abb540
2 changed files with 6 additions and 2 deletions

View File

@@ -18648,7 +18648,7 @@ window.Entropy = new (function() {
// mnemonics is populated as required by getLanguage
var mnemonics = { "english": new Mnemonic("english") };
var mnemonic = mnemonics["english"];
var seed = null
var seed = null;
var bip32RootKey = null;
var bip32ExtendedKey = null;
var network = bitcoin.networks.bitcoin;
@@ -19292,6 +19292,8 @@ window.Entropy = new (function() {
var closestWord = words[0];
for (var i=0; i<words.length; i++) {
var comparedTo = words[i];
if (comparedTo.indexOf(word) == 0) return comparedTo;
var distance = Levenshtein.get(word, comparedTo);
if (distance < minDistance) {
closestWord = comparedTo;

View File

@@ -3,7 +3,7 @@
// mnemonics is populated as required by getLanguage
var mnemonics = { "english": new Mnemonic("english") };
var mnemonic = mnemonics["english"];
var seed = null
var seed = null;
var bip32RootKey = null;
var bip32ExtendedKey = null;
var network = bitcoin.networks.bitcoin;
@@ -647,6 +647,8 @@
var closestWord = words[0];
for (var i=0; i<words.length; i++) {
var comparedTo = words[i];
if (comparedTo.indexOf(word) == 0) return comparedTo;
var distance = Levenshtein.get(word, comparedTo);
if (distance < minDistance) {
closestWord = comparedTo;