Skip to content

Commit

Permalink
Update BIP39 recovery script to use new xpub API
Browse files Browse the repository at this point in the history
  • Loading branch information
lukechilds committed Jul 3, 2020
1 parent 68ebc21 commit 41827cf
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion electrum/scripts/bip39_recovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
from electrum.util import json_encode, print_msg, create_and_start_event_loop, log_exceptions
from electrum.simple_config import SimpleConfig
from electrum.network import Network
from electrum.keystore import bip39_to_seed
from electrum.bip32 import BIP32Node
from electrum.bip39_recovery import account_discovery

try:
Expand All @@ -24,7 +26,13 @@
@log_exceptions
async def f():
try:
active_accounts = await account_discovery(network, mnemonic, passphrase)
def get_account_xpub(account_path):
root_seed = bip39_to_seed(mnemonic, passphrase)
root_node = BIP32Node.from_rootseed(root_seed, xtype="standard")
account_node = root_node.subkey_at_private_derivation(account_path)
account_xpub = account_node.to_xpub()
return account_xpub
active_accounts = await account_discovery(network, get_account_xpub)
print_msg(json_encode(active_accounts))
finally:
stopping_fut.set_result(1)
Expand Down

0 comments on commit 41827cf

Please sign in to comment.