@@ -803,26 +803,28 @@ def close_dispute(self, order_id, resolution, buyer_percentage,
803803 Called when a moderator closes a dispute. It will create a payout transactions refunding both
804804 parties and send it to them in a dispute_close message.
805805 """
806- if float (vendor_percentage ) < 0 or float (moderator_percentage ) < 0 or float (buyer_percentage ) < 0 :
807- raise Exception ("Payouts percentages must be positive" )
808- if float (vendor_percentage ) + float (buyer_percentage ) > 1 :
809- raise Exception ("Payout exceeds 100% of value" )
810- if not self .protocol .multiplexer .blockchain .connected :
811- raise Exception ("Libbitcoin server not online" )
812- if not self .protocol .multiplexer .testnet and \
813- not (moderator_address [:1 ] == "1" or moderator_address [:1 ] == "3" ):
814- raise Exception ("Bitcoin address is not a mainnet address" )
815- elif self .protocol .multiplexer .testnet and not \
816- (moderator_address [:1 ] == "n" or moderator_address [:1 ] == "m" or moderator_address [:1 ] == "2" ):
817- raise Exception ("Bitcoin address is not a testnet address" )
818- try :
819- bitcointools .b58check_to_hex (moderator_address )
820- except AssertionError :
821- raise Exception ("Invalid Bitcoin address" )
822806
823807 with open (os .path .join (DATA_FOLDER , "cases" , order_id + ".json" ), "r" ) as filename :
824808 contract = json .load (filename , object_pairs_hook = OrderedDict )
825809
810+ if "dispute_resolution" not in contract :
811+ if float (vendor_percentage ) < 0 or float (moderator_percentage ) < 0 or float (buyer_percentage ) < 0 :
812+ raise Exception ("Payouts percentages must be positive" )
813+ if float (vendor_percentage ) + float (buyer_percentage ) > 1 :
814+ raise Exception ("Payout exceeds 100% of value" )
815+ if not self .protocol .multiplexer .blockchain .connected :
816+ raise Exception ("Libbitcoin server not online" )
817+ if not self .protocol .multiplexer .testnet and \
818+ not (moderator_address [:1 ] == "1" or moderator_address [:1 ] == "3" ):
819+ raise Exception ("Bitcoin address is not a mainnet address" )
820+ elif self .protocol .multiplexer .testnet and not \
821+ (moderator_address [:1 ] == "n" or moderator_address [:1 ] == "m" or moderator_address [:1 ] == "2" ):
822+ raise Exception ("Bitcoin address is not a testnet address" )
823+ try :
824+ bitcointools .b58check_to_hex (moderator_address )
825+ except AssertionError :
826+ raise Exception ("Invalid Bitcoin address" )
827+
826828 buyer_address = contract ["buyer_order" ]["order" ]["refund_address" ]
827829
828830 buyer_guid = contract ["buyer_order" ]["order" ]["id" ]["guid" ]
0 commit comments