diff --git a/lib/bitcoin.py b/lib/bitcoin.py index 68c6a7358..20625a594 100644 --- a/lib/bitcoin.py +++ b/lib/bitcoin.py @@ -404,7 +404,7 @@ def public_key_from_private_key(sec): def address_from_private_key(sec): public_key = public_key_from_private_key(sec) - address = public_key_to_bc_address(public_key.decode('hex')) + address = public_key_to_p2pkh(public_key.decode('hex')) return address @@ -470,7 +470,7 @@ def verify_message(address, sig, message): public_key, compressed = pubkey_from_signature(sig, message) # check public key using the address pubkey = point_to_ser(public_key.pubkey.point, compressed) - addr = public_key_to_bc_address(pubkey) + addr = public_key_to_p2pkh(pubkey) if address != addr: raise Exception("Bad signature") # check message diff --git a/lib/transaction.py b/lib/transaction.py index 7cd4fc724..1fd2452c4 100644 --- a/lib/transaction.py +++ b/lib/transaction.py @@ -820,7 +820,7 @@ class Transaction: if type == TYPE_ADDRESS: addr = x elif type == TYPE_PUBKEY: - addr = public_key_to_bc_address(x.decode('hex')) + addr = bitcoin.public_key_to_p2pkh(x.decode('hex')) else: addr = 'SCRIPT ' + x.encode('hex') o.append((addr,v)) # consider using yield (addr, v) diff --git a/lib/wallet.py b/lib/wallet.py index 8e3dcb95c..789aaee26 100644 --- a/lib/wallet.py +++ b/lib/wallet.py @@ -619,7 +619,7 @@ class Abstract_Wallet(PrintError): if _type == TYPE_ADDRESS: addr = x elif _type == TYPE_PUBKEY: - addr = public_key_to_bc_address(x.decode('hex')) + addr = bitcoin.public_key_to_p2pkh(x.decode('hex')) else: addr = None if addr and self.is_mine(addr): diff --git a/plugins/trezor/plugin.py b/plugins/trezor/plugin.py index 14270ceb0..0bd2ad68c 100644 --- a/plugins/trezor/plugin.py +++ b/plugins/trezor/plugin.py @@ -6,7 +6,7 @@ from binascii import hexlify, unhexlify from functools import partial from electrum.bitcoin import (bc_address_to_hash_160, xpub_from_pubkey, - public_key_to_bc_address, EncodeBase58Check, + public_key_to_p2pkh, EncodeBase58Check, TYPE_ADDRESS, TYPE_SCRIPT) from electrum.i18n import _ from electrum.plugins import BasePlugin, hook @@ -29,7 +29,7 @@ class TrezorCompatibleKeyStore(Hardware_KeyStore): def decrypt_message(self, pubkey, message, password): raise RuntimeError(_('Electrum and %s encryption and decryption are currently incompatible') % self.device) - address = public_key_to_bc_address(pubkey.decode('hex')) + address = public_key_to_p2pkh(pubkey.decode('hex')) client = self.get_client() address_path = self.address_id(address) address_n = client.expand_path(address_path)