HomePhabricator

[electrum] refactor: introduce a Wordlist class for seed phrases

Description

[electrum] refactor: introduce a Wordlist class for seed phrases

Summary:
This better encapsulates some optimizations (caching of word lists and better indexing) that were made indepedently on Electron Cash and Electrum:

Now the optimizations apply both to the MnemonicElectrum class and the old_mnemonic module.
And in a following commit it will also apply to the slip39 mnemonic code.

This is a backport of https://github.com/spesmilo/electrum/commit/a0b096dcb2292c2826f7beae173c529d335142f0

Note that the solution of putting this new class in the mnemo module does not work for us because this module import old_mnemonic so this would cause a circular import. So I put it in an independant wordlist module that is now imported in mnemo and old_mnemonic.

Depends on D17570

Test Plan:
python test_runner.py

Restore a wallet from seed

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D17572

Details

Provenance
PiRKAuthored on Tue, Jan 21, 13:30
PiRKPushed on Tue, Jan 21, 16:31
Reviewer
Restricted Project
Differential Revision
D17572: [electrum] refactor: introduce a Wordlist class for seed phrases
Parents
rABC47615a805bc7: [electrum] seed completer: colour words yellow if only in old electrum list
Branches
Unknown
Tags
Unknown