From 96f28607f27efc76ed667fa190d11d2bde9e1f47 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Wed, 21 Feb 2024 14:30:13 +0000 Subject: [PATCH] keystore: "old"-type seeds cannot have a passphrase related: https://github.com/spesmilo/electrum/pull/8906 --- electrum/keystore.py | 2 ++ electrum/plugins/trustedcoin/trustedcoin.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/electrum/keystore.py b/electrum/keystore.py index 40b2946b9..53e304d81 100644 --- a/electrum/keystore.py +++ b/electrum/keystore.py @@ -1159,6 +1159,8 @@ def purpose48_derivation(account_id: int, xtype: str) -> str: def from_seed(seed, passphrase, is_p2sh=False): t = seed_type(seed) if t == 'old': + if passphrase: + raise Exception("'old'-type electrum seed cannot have passphrase") keystore = Old_KeyStore({}) keystore.add_seed(seed) elif t in ['standard', 'segwit']: diff --git a/electrum/plugins/trustedcoin/trustedcoin.py b/electrum/plugins/trustedcoin/trustedcoin.py index c78f2e2e8..318868937 100644 --- a/electrum/plugins/trustedcoin/trustedcoin.py +++ b/electrum/plugins/trustedcoin/trustedcoin.py @@ -565,8 +565,8 @@ class TrustedCoinPlugin(BasePlugin): # note: pre-2.7 2fa seeds were typically 24-25 words, however they # could probabilistically be arbitrarily shorter due to a bug. (see #3611) # the probability of it being < 20 words is about 2^(-(256+12-19*11)) = 2^(-59) - if passphrase != '': - raise Exception('old 2fa seed cannot have passphrase') + if passphrase: + raise Exception("old '2fa'-type electrum seed cannot have passphrase") xprv1, xpub1 = self.get_xkeys(' '.join(words[0:12]), t, '', "m/") xprv2, xpub2 = self.get_xkeys(' '.join(words[12:]), t, '', "m/") elif n == 12: # new scheme