URI: 
       tfix #3170 - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit 2774126db6c258807d95921936eb13af07047d97
   DIR parent 8d400d69d895d495550b01cb9a37bb8a30ae2f5a
  HTML Author: ThomasV <thomasv@electrum.org>
       Date:   Wed,  1 Nov 2017 22:44:13 +0100
       
       fix #3170
       
       Diffstat:
         M lib/bitcoin.py                      |       7 +++++--
       
       1 file changed, 5 insertions(+), 2 deletions(-)
       ---
   DIR diff --git a/lib/bitcoin.py b/lib/bitcoin.py
       t@@ -71,6 +71,7 @@ XPUB_HEADERS = {
        
        # Bitcoin network constants
        TESTNET = False
       +WIF_PREFIX = 0x80
        ADDRTYPE_P2PKH = 0
        ADDRTYPE_P2SH = 5
        SEGWIT_HRP = "bc"
       t@@ -86,7 +87,9 @@ def set_testnet():
            global GENESIS
            global SEGWIT_HRP
            global DEFAULT_PORTS, SERVERLIST, DEFAULT_SERVERS
       +    global WIF_PREFIX
            TESTNET = True
       +    WIF_PREFIX = 0xef
            ADDRTYPE_P2PKH = 111
            ADDRTYPE_P2SH = 196
            SEGWIT_HRP = "tb"
       t@@ -521,7 +524,7 @@ SCRIPT_TYPES = {
        
        
        def serialize_privkey(secret, compressed, txin_type):
       -    prefix = bytes([(SCRIPT_TYPES[txin_type]+128)&255])
       +    prefix = bytes([(SCRIPT_TYPES[txin_type]+WIF_PREFIX)&255])
            suffix = b'\01' if compressed else b''
            vchIn = prefix + secret + suffix
            return EncodeBase58Check(vchIn)
       t@@ -533,7 +536,7 @@ def deserialize_privkey(key):
            if is_minikey(key):
                return 'p2pkh', minikey_to_private_key(key), True
            elif vch:
       -        txin_type = inv_dict(SCRIPT_TYPES)[vch[0] - 128]
       +        txin_type = inv_dict(SCRIPT_TYPES)[vch[0] - WIF_PREFIX]
                assert len(vch) in [33, 34]
                compressed = len(vch) == 34
                return txin_type, vch[1:33], compressed