Skip to content

Commit

Permalink
add warning for find_word
Browse files Browse the repository at this point in the history
  • Loading branch information
plebhash committed Sep 1, 2024
1 parent b100bf3 commit f9fa56b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/language/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ impl Language {
}

/// Get the index of the word in the word list.
///
/// WARNING: indices returned by this function start with `0`,
/// while indices start with `1` in a lookup against [BIP39 on github](https://github.com/bitcoin/bips/blob/master/bip-0039/english.txt) (and most wallet docs).
/// In other words `find_word("abandon")` returns `Some(0)` instead of `Some(1)` (which a naive user could assume).
#[inline]
pub fn find_word(self, word: &str) -> Option<u16> {
match self {
Expand Down

0 comments on commit f9fa56b

Please sign in to comment.