Merge pull request #10538 from f321x/fix_10536
wizard: catch NotLegacySinglesigScriptType during private key import
This commit is contained in:
@@ -413,11 +413,10 @@ class ElectrumGui(BaseElectrumGui, Logger):
|
||||
self.logger.exception('')
|
||||
if isinstance(e, UserFacingException) \
|
||||
or isinstance(e, WalletFileException) and not e.should_report_crash:
|
||||
err_text = str(e) if isinstance(e, WalletFileException) else repr(e)
|
||||
custom_message_box(icon=QMessageBox.Icon.Warning,
|
||||
parent=None,
|
||||
title=_('Error'),
|
||||
text=_('Cannot load wallet') + '(2) :\n' + err_text)
|
||||
text=_('Cannot load wallet') + '(2) :\n' + str(e))
|
||||
else:
|
||||
send_exception_to_crash_reporter(e)
|
||||
if app_is_starting:
|
||||
|
||||
+7
-2
@@ -16,7 +16,7 @@ from electrum.storage import WalletStorage, StorageEncryptionVersion, StorageRea
|
||||
from electrum.util import UserFacingException
|
||||
from electrum.wallet_db import WalletDB
|
||||
from electrum.bip32 import normalize_bip32_derivation, xpub_type
|
||||
from electrum import keystore, mnemonic, bitcoin
|
||||
from electrum import descriptor, keystore, mnemonic, bitcoin
|
||||
from electrum.mnemonic import is_any_2fa_seed_type, can_seed_have_passphrase
|
||||
from electrum.util import multisig_type
|
||||
|
||||
@@ -702,7 +702,12 @@ class NewWalletWizard(KeystoreWizard):
|
||||
for pk in keys:
|
||||
assert bitcoin.is_private_key(pk)
|
||||
txin_type, pubkey = k.import_privkey(pk, None)
|
||||
addr = bitcoin.pubkey_to_address(txin_type, pubkey)
|
||||
try:
|
||||
addr = bitcoin.pubkey_to_address(txin_type, pubkey)
|
||||
except descriptor.NotLegacySinglesigScriptType as e:
|
||||
raise UserFacingException(
|
||||
_("Importing individual private keys of type '{}' is not supported.").format(txin_type),
|
||||
) from e
|
||||
addresses[addr] = {'type': txin_type, 'pubkey': pubkey}
|
||||
elif 'address_list' in data:
|
||||
for addr in data['address_list'].split():
|
||||
|
||||
Reference in New Issue
Block a user