1111import nacl .utils
1212import obelisk
1313import os .path
14- import pickle
1514import time
1615from binascii import unhexlify
1716from collections import OrderedDict
@@ -906,35 +905,34 @@ def release_funds(self, order_id):
906905 the moderator has resolved the dispute and provided his signature.
907906 """
908907 if os .path .exists (DATA_FOLDER + "purchases/in progress/" + order_id + ".json" ):
909- file_path = DATA_FOLDER + "purchases/trade receipts /" + order_id + ".json"
910- outpoints = pickle .loads (self .db .purchases .get_outpoint (order_id ))
908+ file_path = DATA_FOLDER + "purchases/in progress /" + order_id + ".json"
909+ outpoints = json .loads (self .db .purchases .get_outpoint (order_id ))
911910 elif os .path .exists (DATA_FOLDER + "store/contracts/in progress/" + order_id + ".json" ):
912911 file_path = DATA_FOLDER + "store/contracts/in progress/" + order_id + ".json"
913- outpoints = pickle .loads (self .db .sales .get_outpoint (order_id ))
912+ outpoints = json .loads (self .db .sales .get_outpoint (order_id ))
914913
915914 with open (file_path , 'r' ) as filename :
916915 contract = json .load (filename , object_pairs_hook = OrderedDict )
917916
918- vendor_address = contract ["vendor_order_confirmation" ]["invoice" ]["payout" ]["address" ]
919- buyer_address = contract ["buyer_order" ]["order" ]["refund_address" ]
920-
921917 outputs = []
922918
923919 outputs .append ({'value' : int (float (contract ["dispute_resolution" ]
924920 ["resolution" ]["moderator_fee" ]) * 100000000 ),
925921 'address' : contract ["dispute_resolution" ]["resolution" ]["moderator_address" ]})
926922
927923 if "buyer_payout" in contract ["dispute_resolution" ]["resolution" ]:
924+ buyer_address = contract ["buyer_order" ]["order" ]["refund_address" ]
928925 outputs .append ({'value' : int (float (contract ["dispute_resolution" ]
929926 ["resolution" ]["buyer_payout" ]) * 100000000 ),
930927 'address' : buyer_address })
931928
932929 if "vendor_payout" in contract ["dispute_resolution" ]["resolution" ]:
930+ vendor_address = contract ["vendor_order_confirmation" ]["invoice" ]["payout" ]["address" ]
933931 outputs .append ({'value' : int (float (contract ["dispute_resolution" ]
934932 ["resolution" ]["vendor_payout" ]) * 100000000 ),
935933 'address' : vendor_address })
936934
937- tx = BitcoinTransaction .make_unsigned (outpoints , outputs )
935+ tx = BitcoinTransaction .make_unsigned (outpoints , outputs , testnet = self . protocol . multiplexer . testnet )
938936 chaincode = contract ["buyer_order" ]["order" ]["payment" ]["chaincode" ]
939937 redeem_script = str (contract ["buyer_order" ]["order" ]["payment" ]["redeem_script" ])
940938 masterkey = bitcointools .bip32_extract_key (KeyChain (self .db ).bitcoin_master_privkey )
@@ -993,8 +991,6 @@ def get_result(result):
993991 pass
994992 return ret
995993 except Exception :
996- import traceback
997- traceback .print_exc ()
998994 return None
999995
1000996 if node_to_ask .ip is None :
@@ -1011,7 +1007,7 @@ def refund(self, order_id):
10111007 to the buyer with contain the signature.
10121008 """
10131009 file_path = DATA_FOLDER + "store/contracts/in progress/" + order_id + ".json"
1014- outpoints = pickle .loads (self .db .sales .get_outpoint (order_id ))
1010+ outpoints = json .loads (self .db .sales .get_outpoint (order_id ))
10151011
10161012 with open (file_path , 'r' ) as filename :
10171013 contract = json .load (filename , object_pairs_hook = OrderedDict )
0 commit comments