This better encapsulates some optimizations (caching of word lists and better indexing) that were made indepedently on Electron Cash and Electrum:
- https://github.com/Electron-Cash/Electron-Cash/commit/bb2b20edc59c7c195d706a534c14af9266f1dffc
- https://github.com/spesmilo/electrum/pull/5758
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