Browse Source

Bugfix in daemon to prevent duplicate JMTX messages

Introduces an additional jm_state to avoid resending JMTX in case
the response to checkUtxosAccepted takes too long.
Fix bug in -Qt where blockr wallet sync is called with fast option.
Make unconfirmed message more informative (more TODO here).
Fix bug in blockr_data (from upstream).
master
Adam Gibson 9 years ago
parent
commit
733ac8f4dd
No known key found for this signature in database
GPG Key ID: B3AE09F1E9A3197A
  1. 6
      jmclient/jmclient/blockchaininterface.py
  2. 2
      jmclient/jmclient/taker.py
  3. 5
      jmdaemon/jmdaemon/daemon_protocol.py
  4. 5
      scripts/joinmarket-qt.py

6
jmclient/jmclient/blockchaininterface.py

@ -240,8 +240,8 @@ class BlockrInterface(BlockchainInterface): #pragma: no cover
def sync_unspent(self, wallet):
# finds utxos in the wallet
st = time.time()
# dont refresh unspent dict more often than 10 minutes
rate_limit_time = 10 * 60
# dont refresh unspent dict more often than 1 minutes
rate_limit_time = 1 * 60
if st - self.last_sync_unspent < rate_limit_time:
log.debug(
'blockr sync_unspent() happened too recently (%dsec), skipping'
@ -436,7 +436,7 @@ class BlockrInterface(BlockchainInterface): #pragma: no cover
data = []
for ids in txids:
blockr_url = 'https://' + self.blockr_domain + '.blockr.io/api/v1/tx/info/'
data = btc.make_request_blockr(blockr_url + ','.join(ids))['data']
blockr_data = btc.make_request_blockr(blockr_url + ','.join(ids))['data']
if not isinstance(blockr_data, list):
blockr_data = [blockr_data]
data += blockr_data

2
jmclient/jmclient/taker.py

@ -573,7 +573,7 @@ class Taker(object):
return self.push()
def unconfirm_callback(self, txd, txid):
jlog.debug("Unconfirmed callback in sendpayment, ignoring")
jlog.debug("Transaction seen on network, waiting for confirmation")
def confirm_callback(self, txd, txid, confirmations):
jlog.debug("Confirmed callback in taker, confs: " + str(confirmations))

5
jmdaemon/jmdaemon/daemon_protocol.py

@ -223,6 +223,7 @@ class JMDaemonServerProtocol(amp.AMP, OrderbookWatch):
#this can be called a second time on timeout, in which case we
#do nothing
return
self.jm_state = 3
d = self.callRemote(JMFillResponse,
success=accepted,
ioauth_data = json.dumps(self.ioauth_data))
@ -249,11 +250,11 @@ class JMDaemonServerProtocol(amp.AMP, OrderbookWatch):
#TODO create re-set function to start again
else:
#only update state if client accepted
self.jm_state = 3
self.jm_state = 4
@JMMakeTx.responder
def on_JM_MAKE_TX(self, nick_list, txhex):
if not self.jm_state == 3:
if not self.jm_state == 4:
log.msg("Make tx was called in wrong state, rejecting")
return {'accepted': False}
nick_list = json.loads(nick_list)

5
scripts/joinmarket-qt.py

@ -493,7 +493,10 @@ class SpendTab(QWidget):
log.debug('starting coinjoin ..')
w.statusBar().showMessage("Syncing wallet ...")
jm_single().bc_interface.sync_wallet(w.wallet, fast=True)
if jm_single().config.get("BLOCKCHAIN", "blockchain_source") != "blockr":
jm_single().bc_interface.sync_wallet(w.wallet, fast=True)
else:
jm_single().bc_interface.sync_wallet(w.wallet)
if not multiple:
destaddr = str(self.widgets[0][1].text())
#convert from bitcoins (enforced by QDoubleValidator) to satoshis

Loading…
Cancel
Save