fix signatures returned by get_address_from_input_script. fixes #653
This commit is contained in:
parent
4a79769af4
commit
cba7a5d68d
|
@ -301,19 +301,21 @@ def get_address_from_input_script(bytes):
|
||||||
except Exception:
|
except Exception:
|
||||||
# coinbase transactions raise an exception
|
# coinbase transactions raise an exception
|
||||||
print_error("cannot find address in input script", bytes.encode('hex'))
|
print_error("cannot find address in input script", bytes.encode('hex'))
|
||||||
return [], [], "(None)"
|
return [], {}, "(None)"
|
||||||
|
|
||||||
# payto_pubkey
|
# payto_pubkey
|
||||||
match = [ opcodes.OP_PUSHDATA4 ]
|
match = [ opcodes.OP_PUSHDATA4 ]
|
||||||
if match_decoded(decoded, match):
|
if match_decoded(decoded, match):
|
||||||
return None, None, "(pubkey)"
|
return None, {}, "(pubkey)"
|
||||||
|
|
||||||
# non-generated TxIn transactions push a signature
|
# non-generated TxIn transactions push a signature
|
||||||
# (seventy-something bytes) and then their public key
|
# (seventy-something bytes) and then their public key
|
||||||
# (65 bytes) onto the stack:
|
# (65 bytes) onto the stack:
|
||||||
match = [ opcodes.OP_PUSHDATA4, opcodes.OP_PUSHDATA4 ]
|
match = [ opcodes.OP_PUSHDATA4, opcodes.OP_PUSHDATA4 ]
|
||||||
if match_decoded(decoded, match):
|
if match_decoded(decoded, match):
|
||||||
return None, None, public_key_to_bc_address(decoded[1][1])
|
sig = decoded[0][1].encode('hex')
|
||||||
|
pubkey = decoded[1][1].encode('hex')
|
||||||
|
return [pubkey], {pubkey:sig}, public_key_to_bc_address(pubkey.decode('hex'))
|
||||||
|
|
||||||
# p2sh transaction, 2 of n
|
# p2sh transaction, 2 of n
|
||||||
match = [ opcodes.OP_0 ]
|
match = [ opcodes.OP_0 ]
|
||||||
|
@ -341,7 +343,7 @@ def get_address_from_input_script(bytes):
|
||||||
return pubkeys, signatures, hash_160_to_bc_address(hash_160(redeemScript), 5)
|
return pubkeys, signatures, hash_160_to_bc_address(hash_160(redeemScript), 5)
|
||||||
|
|
||||||
print_error("cannot find address in input script", bytes.encode('hex'))
|
print_error("cannot find address in input script", bytes.encode('hex'))
|
||||||
return [], [], "(None)"
|
return [], {}, "(None)"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue