@@ -476,6 +476,8 @@ def add_order_confirmation(self,
476476 self .db .transactions .add_transaction (tx .to_raw_tx ())
477477 self .log .info ("broadcasting payout tx %s to network" % tx .get_hash ())
478478 self .db .sales .update_payment_tx (order_id , tx .get_hash ())
479+ self .blockchain .unsubscribe_address (
480+ self .contract ["buyer_order" ]["order" ]["payment" ]["address" ], self .on_tx_received )
479481
480482 confirmation = json .dumps (conf_json ["vendor_order_confirmation" ]["invoice" ], indent = 4 )
481483 conf_json ["vendor_order_confirmation" ]["signature" ] = \
@@ -644,6 +646,8 @@ def add_receipt(self,
644646 tx .multisign (signatures , redeem_script )
645647 tx .broadcast (self .blockchain )
646648 self .db .transactions .add_transaction (tx .to_raw_tx ())
649+ self .blockchain .unsubscribe_address (
650+ self .contract ["buyer_order" ]["order" ]["payment" ]["address" ], self .on_tx_received )
647651
648652 self .log .info ("broadcasting payout tx %s to network" % tx .get_hash ())
649653 receipt_json ["buyer_receipt" ]["receipt" ]["payout" ]["txid" ] = tx .get_hash ()
@@ -751,6 +755,8 @@ def accept_receipt(self, notification_listener, blockchain, receipt_json=None):
751755 tx .multisign (signatures , redeem_script )
752756 tx .broadcast (self .blockchain )
753757 self .db .transactions .add_transaction (tx .to_raw_tx ())
758+ self .blockchain .unsubscribe_address (
759+ self .contract ["buyer_order" ]["order" ]["payment" ]["address" ], self .on_tx_received )
754760 self .log .info ("broadcasting payout tx %s to network" % tx .get_hash ())
755761
756762 self .db .sales .update_payment_tx (order_id , tx .get_hash ())
@@ -889,8 +895,6 @@ def on_tx_received(self, address_version, address_hash, height, block_hash, tx):
889895 self .log .critical ("Error processing bitcoin transaction: %s" % e .message )
890896
891897 def payment_received (self ):
892- self .blockchain .unsubscribe_address (
893- self .contract ["buyer_order" ]["order" ]["payment" ]["address" ], self .on_tx_received )
894898 order_id = digest (json .dumps (self .contract , indent = 4 )).encode ("hex" )
895899 title = self .contract ["vendor_offer" ]["listing" ]["item" ]["title" ]
896900 if "image_hashes" in self .contract ["vendor_offer" ]["listing" ]["item" ]:
@@ -1105,6 +1109,8 @@ def process_refund(self, refund_json, blockchain, notification_listener):
11051109 tx .multisign (signatures , redeem_script )
11061110 tx .broadcast (blockchain )
11071111 self .db .transactions .add_transaction (tx .to_raw_tx ())
1112+ self .blockchain .unsubscribe_address (
1113+ self .contract ["buyer_order" ]["order" ]["payment" ]["address" ], self .on_tx_received )
11081114 self .log .info ("broadcasting refund tx %s to network" % tx .get_hash ())
11091115
11101116 self .db .purchases .update_status (order_id , 7 )
0 commit comments