commit b56fe237cdc604e5b527248acd5fb61e46a8a48c
parent 87a080d30e0897a5e9ec865a266eba7ee74a87d0
Author: SomberNight <somber.night@protonmail.com>
Date: Fri, 12 Feb 2021 04:47:53 +0100
ledger: give clear error that old HW.1 cannot send to bech32 address
maybe related #7022
Diffstat:
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/electrum/plugins/ledger/ledger.py b/electrum/plugins/ledger/ledger.py
@@ -7,7 +7,7 @@ from typing import Optional, Tuple
from electrum import ecc
from electrum import bip32
from electrum.crypto import hash_160
-from electrum.bitcoin import int_to_hex, var_int, is_segwit_script_type
+from electrum.bitcoin import int_to_hex, var_int, is_segwit_script_type, is_b58_address
from electrum.bip32 import BIP32Node, convert_bip32_intpath_to_strpath
from electrum.i18n import _
from electrum.keystore import Hardware_KeyStore
@@ -415,6 +415,8 @@ class Ledger_KeyStore(Hardware_KeyStore):
if len(tx.outputs()) > 2:
self.give_error("Transaction with more than 2 outputs not supported")
for txout in tx.outputs():
+ if client_electrum.is_hw1() and txout.address and not is_b58_address(txout.address):
+ self.give_error(_("This {} device can only send to base58 addresses.").format(self.device))
if not txout.address:
if client_electrum.is_hw1():
self.give_error(_("Only address outputs are supported by {}").format(self.device))