URI: 
       tparse pubkey in segwit_script - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit 65bef5e228934656815192b1f21dc25abb78ba7b
   DIR parent 615a5b3f8e8853dafc62cd6b26c3b6d51768b606
  HTML Author: ThomasV <thomasv@electrum.org>
       Date:   Wed, 12 Apr 2017 16:33:35 +0200
       
       parse pubkey in segwit_script
       
       Diffstat:
         M lib/transaction.py                  |      14 ++++++++------
       
       1 file changed, 8 insertions(+), 6 deletions(-)
       ---
   DIR diff --git a/lib/transaction.py b/lib/transaction.py
       t@@ -293,6 +293,12 @@ def parse_sig(x_sig):
            return s
        
        
       +def safe_parse_pubkey(x):
       +    try:
       +        return xpubkey_to_pubkey(x)
       +    except:
       +        return x
       +
        
        def parse_scriptSig(d, bytes):
            try:
       t@@ -363,12 +369,7 @@ def parse_scriptSig(d, bytes):
                print_error("cannot find address in input script", bytes.encode('hex'))
                return
            x_pubkeys = map(lambda x: x[1].encode('hex'), dec2[1:-2])
       -    def safe_parse(x):
       -        try:
       -            return xpubkey_to_pubkey(x)
       -        except:
       -            return x
       -    pubkeys = [safe_parse(x) for x in x_pubkeys]
       +    pubkeys = [safe_parse_pubkey(x) for x in x_pubkeys]
            redeemScript = multisig_script(pubkeys, m)
            # write result in d
            d['type'] = 'p2sh'
       t@@ -486,6 +487,7 @@ def get_scriptPubKey(addr):
            return script
        
        def segwit_script(pubkey):
       +    pubkey = safe_parse_pubkey(pubkey)
            pkh = hash_160(pubkey.decode('hex')).encode('hex')
            return '00' + push_script(pkh)