Skip to content
This repository has been archived by the owner on May 13, 2022. It is now read-only.

Commit

Permalink
fixed bug from changing blockchaininterface, also added sleep because…
Browse files Browse the repository at this point in the history
… of issue #516
  • Loading branch information
chris-belcher committed May 5, 2016
1 parent f96ef71 commit ad0f95b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
10 changes: 6 additions & 4 deletions joinmarket/blockchaininterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import time
import urllib
import urllib2
import traceback
from decimal import Decimal

import bitcoin as btc
Expand Down Expand Up @@ -335,12 +336,13 @@ def run(self):
def pushtx(self, txhex):
try:
json_str = btc.blockr_pushtx(txhex, self.network)
data = json.loads(json_str)
if data['status'] != 'success':
log.debug(data)
return False
except Exception:
log.debug('failed blockr.io pushtx')
return False
data = json.loads(json_str)
if data['status'] != 'success':
log.debug(data)
log.debug(traceback.format_exc())
return False
return True

Expand Down
6 changes: 3 additions & 3 deletions joinmarket/maker.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,10 +266,10 @@ def on_seen_tx(self, nick, txhex):
def on_push_tx(self, nick, txhex):
log.debug('received txhex from ' + nick + ' to push\n' + txhex)
pushed = jm_single().bc_interface.pushtx(txhex)
if pushed[0]:
log.debug('pushed tx ' + str(pushed[1]))
if pushed:
log.debug('pushed tx ' + btc.txhash(txhex))
else:
log.debug('failed to push tx, reason: '+str(pushed[1]))
log.debug('failed to push tx sent by taker')
self.msgchan.send_error(nick, 'Unable to push tx')

def on_welcome(self):
Expand Down
1 change: 1 addition & 0 deletions sendpayment.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ def finishcallback(self, coinjointx):
else:
#Error should be in log, will not retry.
log.debug('failed to push tx, ending.')
time.sleep(10) # see github issue #516
self.taker.msgchan.shutdown()
return
self.ignored_makers += coinjointx.nonrespondants
Expand Down

0 comments on commit ad0f95b

Please sign in to comment.