electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 65bef5e228934656815192b1f21dc25abb78ba7b
parent 615a5b3f8e8853dafc62cd6b26c3b6d51768b606
Author: ThomasV <thomasv@electrum.org>
Date:   Wed, 12 Apr 2017 16:33:35 +0200

parse pubkey in segwit_script

Diffstat:
Mlib/transaction.py | 14++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/lib/transaction.py b/lib/transaction.py @@ -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: @@ -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' @@ -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)