Browse Source

fix maker crash when verifying transaction with p2sh output in non-sw mode

master
undeath 8 years ago
parent
commit
d2196ad681
  1. 8
      jmclient/jmclient/maker.py

8
jmclient/jmclient/maker.py

@ -128,7 +128,9 @@ class Maker(object):
utxos = offerinfo["utxos"] utxos = offerinfo["utxos"]
cjaddr = offerinfo["cjaddr"] cjaddr = offerinfo["cjaddr"]
cjaddr_script = btc.address_to_script(cjaddr)
changeaddr = offerinfo["changeaddr"] changeaddr = offerinfo["changeaddr"]
changeaddr_script = btc.address_to_script(changeaddr)
amount = offerinfo["amount"] amount = offerinfo["amount"]
cjfee = offerinfo["offer"]["cjfee"] cjfee = offerinfo["offer"]["cjfee"]
txfee = offerinfo["offer"]["txfee"] txfee = offerinfo["offer"]["txfee"]
@ -146,13 +148,11 @@ class Maker(object):
times_seen_cj_addr = 0 times_seen_cj_addr = 0
times_seen_change_addr = 0 times_seen_change_addr = 0
for outs in txd['outs']: for outs in txd['outs']:
#FIXME: the type of address should be detected from the script (p2pkh/p2sh) if outs['script'] == cjaddr_script:
addr = self.wallet.script_to_address(outs['script'])
if addr == cjaddr:
times_seen_cj_addr += 1 times_seen_cj_addr += 1
if outs['value'] != amount: if outs['value'] != amount:
return (False, 'Wrong cj_amount. I expect ' + str(amount)) return (False, 'Wrong cj_amount. I expect ' + str(amount))
if addr == changeaddr: if outs['script'] == changeaddr_script:
times_seen_change_addr += 1 times_seen_change_addr += 1
if outs['value'] != expected_change_value: if outs['value'] != expected_change_value:
return (False, 'wrong change, i expect ' + str( return (False, 'wrong change, i expect ' + str(

Loading…
Cancel
Save