Skip to content

Commit 906a716

Browse files
committed
shut down more cleanly when no commitment available
1 parent 55ff9f1 commit 906a716

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

joinmarket/taker.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ def __init__(self,
8080
# create DH keypair on the fly for this Tx object
8181
self.kp = init_keypair()
8282
self.crypto_boxes = {}
83-
self.get_commitment(input_utxos, self.cj_amount)
83+
if not self.get_commitment(input_utxos, self.cj_amount):
84+
return
8485
self.msgchan.fill_orders(self.active_orders, self.cj_amount,
8586
self.kp.hex_pk(), self.commitment)
8687

@@ -106,15 +107,16 @@ def get_commitment(self, utxos, amount):
106107
if jm_single().config.get(
107108
"BLOCKCHAIN", "blockchain_source") == 'regtest':
108109
raise btc.PoDLEError("For testing raising podle exception")
110+
109111
#The timeout/recovery code is designed to handle non-responsive
110112
#counterparties, but this condition means that the current bot
111113
#is not able to create transactions following its *own* rules,
112114
#so shutting down is appropriate no matter what style
113115
#of bot this is.
114-
#These two settings shut down the timeout thread and avoid recovery.
115-
self.all_responded = True
116-
self.end_timeout_thread = True
117-
self.msgchan.shutdown()
116+
import thread
117+
thread.interrupt_main()
118+
return False
119+
return True
118120

119121
def start_encryption(self, nick, maker_pk):
120122
if nick not in self.active_orders.keys():

0 commit comments

Comments
 (0)