Browse Source

choose address based on INTERNAL flag in schedule

master
Adam Gibson 10 years ago
parent
commit
9b04af4a65
No known key found for this signature in database
GPG Key ID: B3AE09F1E9A3197A
  1. 1
      jmclient/schedule.py
  2. 7
      jmclient/taker.py
  3. 4
      scripts/sample-schedule-for-testnet

1
jmclient/schedule.py

@ -25,6 +25,7 @@ def get_schedule(filename):
destaddr = destaddr.strip()
except ValueError as e:
return (False, "Failed to parse schedule line: " + sl)
if destaddr != "INTERNAL":
success, errmsg = validate_address(destaddr)
if not success:
return (False, "Invalid address: " + destaddr + "," + errmsg)

7
jmclient/taker.py

@ -109,6 +109,13 @@ class Taker(object):
self.cjamount = si[1]
self.n_counterparties = si[2]
self.my_cj_addr = si[3]
#if destination is flagged "INTERNAL", choose a destination
#from the next mixdepth modulo the maxmixdepth
if self.my_cj_addr == "INTERNAL":
next_mixdepth = (self.mixdepth + 1) % self.wallet.max_mix_depth
jlog.info("Choosing a destination from mixdepth: " + str(next_mixdepth))
self.my_cj_addr = self.wallet.get_internal_addr(next_mixdepth)
jlog.info("Chose destination address: " + self.my_cj_addr)
self.outputs = []
self.cjfee_total = 0
self.maker_txfee_contributions = 0

4
scripts/sample-schedule-for-testnet

@ -1,3 +1,3 @@
#sample for testing
1, 50000000, 3, n18jvNgdCWkb5YWEMVARjBfcizg4kHcYRZ
0, 80000000, 2, n18jvNgdCWkb5YWEMVARjBfcizg4kHcYRZ
1, 110000000, 3, INTERNAL
0, 20000000, 2, mnsquzxrHXpFsZeL42qwbKdCP2y1esN3qw
Loading…
Cancel
Save