Browse Source

Update utxo state inbetween runs using wallet functions

Also fix minor bug in blockr interface: a repeated sync in the same
run must reset the index to zeros.
master
Adam Gibson 10 years ago
parent
commit
dd8e441d95
No known key found for this signature in database
GPG Key ID: B3AE09F1E9A3197A
  1. 2
      jmclient/jmclient/blockchaininterface.py
  2. 3
      jmclient/jmclient/taker.py
  3. 6
      scripts/sendpayment.py
  4. 7
      scripts/tumbler.py

2
jmclient/jmclient/blockchaininterface.py

@ -539,6 +539,8 @@ class BlockrInterface(BlockchainInterface): #pragma: no cover
# sets Wallet internal indexes to be at the next unused address
for mix_depth in range(wallet.max_mix_depth):
for forchange in [0, 1]:
#must reset at the start so as to search forward from the beginning
wallet.index[mix_depth][forchange] = 0
unused_addr_count = 0
last_used_addr = ''
while (unused_addr_count < wallet.gaplimit or

3
jmclient/jmclient/taker.py

@ -621,4 +621,5 @@ class Taker(object):
jlog.debug("Confirmed callback in taker, confs: " + str(confirmations))
fromtx=False if self.schedule_index + 1 == len(self.schedule) else True
waittime = self.schedule[self.schedule_index][4]
self.on_finished_callback(True, fromtx=fromtx, waittime=waittime)
self.on_finished_callback(True, fromtx=fromtx, waittime=waittime,
txdetails=(txd, txid))

6
scripts/sendpayment.py

@ -192,10 +192,12 @@ def main():
return False
return True
def taker_finished(res, fromtx=False, waittime=0.0):
def taker_finished(res, fromtx=False, waittime=0.0, txdetails=None):
if fromtx:
if res:
sync_wallet(wallet, fast=options.fastsync)
txd, txid = txdetails
taker.wallet.remove_old_utxos(txd)
taker.wallet.add_new_utxos(txd, txid)
reactor.callLater(waittime*60,
clientfactory.getClient().clientStart)
else:

7
scripts/tumbler.py

@ -100,7 +100,7 @@ def main():
def filter_orders_callback(orders_fees, cjamount):
return True
def taker_finished(res, fromtx=False, waittime=0.0):
def taker_finished(res, fromtx=False, waittime=0.0, txdetails=None):
"""on_finished_callback for tumbler
"""
def unconf_update():
@ -146,8 +146,9 @@ def main():
waiting_message = "Waiting for: " + str(waittime) + " minutes."
tumble_log.info(waiting_message)
log.info(waiting_message)
sync_wallet(wallet, fast=options['fastsync'])
txd, txid = txdetails
taker.wallet.remove_old_utxos(txd)
taker.wallet.add_new_utxos(txd, txid)
reactor.callLater(waittime*60,
clientfactory.getClient().clientStart)
else:

Loading…
Cancel
Save