1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-27 01:48:17 +00:00

check for known scriptPubKey asm

This commit is contained in:
Pavol Rusnak 2014-03-28 21:48:48 +01:00
parent 38ed16934f
commit 7a1e2827c8

View File

@ -30,7 +30,10 @@ def bitcore_tx(url):
for vout in data['vout']: for vout in data['vout']:
o = t.outputs.add() o = t.outputs.add()
o.amount = int(vout['value'] * 100000000) o.amount = int(vout['value'] * 100000000)
asm = vout['scriptPubKey']['asm'].split(' ') # we suppose it's OP_DUP OP_HASH160 pubkey OP_EQUALVERIFY OP_CHECKSIG asm = vout['scriptPubKey']['asm'].split(' ')
# we suppose it's OP_DUP OP_HASH160 pubkey OP_EQUALVERIFY OP_CHECKSIG
if len(asm) != 5 or asm[0] != 'OP_DUP' or asm[1] != 'OP_HASH160' or asm[3] != 'OP_EQUALVERIFY' or asm[4] != 'OP_CHECKSIG':
raise Exception('Unknown scriptPubKey asm: %s' % asm)
o.script_pubkey = binascii.unhexlify('76a914' + asm[2] + '88ac') o.script_pubkey = binascii.unhexlify('76a914' + asm[2] + '88ac')
return t return t