diff --git a/docs/tumblerguide.md b/docs/tumblerguide.md index adac0b6e3..356fbbf7c 100644 --- a/docs/tumblerguide.md +++ b/docs/tumblerguide.md @@ -162,7 +162,7 @@ Here is a test example schedule with those parameters: ### Restarting -Even before discussing practical code-level actions, we can see: this approach allows us to have coins in *any* mixdepth when we start; so we no longer have the concept of "restarting" if you manually ended the run halfway, or if a transaction repeatedly failed and you had to give up. You can judge for yourself; if you started a tumbler run of 8 mixdepths and it stopped after 3, you can do another run with 5 mixdepths later, if you like. W.r.t the destination addresses, you were never able to control the ratio that arrives at different destinations anyway (it's technically possible but not recommended, you'd need to create schedules manually and think carefully about it), so this really doesn't change that aspect. +Even before discussing practical code-level actions, we can see: this approach allows us to have coins in *any* mixdepth when we start; so we no longer have a special option `--restart` if you manually ended the run halfway, or if a transaction repeatedly failed and you had to give up. You can judge for yourself; if you started a tumbler run of 8 mixdepths and it stopped after 3, you can do another run with 5 mixdepths later, if you like. W.r.t the destination addresses, you were never able to control the ratio that arrives at different destinations anyway (it's technically possible but not recommended, you'd need to create schedules manually and think carefully about it), so this really doesn't change that aspect. Delaying the whole process by stopping and restarting it is quite sensible anyway; as explained above, we *want* this process to be slow, not fast. diff --git a/jmclient/jmclient/cli_options.py b/jmclient/jmclient/cli_options.py index 1ec51125f..25611a128 100644 --- a/jmclient/jmclient/cli_options.py +++ b/jmclient/jmclient/cli_options.py @@ -275,13 +275,6 @@ def get_tumbler_parser(): ' be configured to ask for more address mid-run, giving the user' ' a chance to click `Generate New Deposit Address` on whatever service' ' they are using.') - parser.add_option('--restart', - action='store_true', - dest='restart', - default=False, - help=('Restarts the schedule currently found in the schedule file in the ' - 'logs directory, with name TUMBLE.schedule or what is set in the ' - 'schedulefile option.')) parser.add_option('--schedulefile', type='string', dest='schedulefile', diff --git a/scripts/tumbler.py b/scripts/tumbler.py index 6340cb37c..895c23773 100755 --- a/scripts/tumbler.py +++ b/scripts/tumbler.py @@ -5,17 +5,17 @@ import os import pprint from twisted.python.log import startLogging -from jmclient import Taker, load_program_config, get_schedule,\ +from jmclient import Taker, load_program_config, \ JMClientProtocolFactory, start_reactor, jm_single, get_wallet_path,\ - open_test_wallet_maybe, get_tumble_schedule,\ - schedule_to_text, estimate_tx_fee, restart_waiter, WalletService,\ + open_test_wallet_maybe, get_tumble_schedule, \ + schedule_to_text, estimate_tx_fee, WalletService, \ get_tumble_log, tumbler_taker_finished_update, check_regtest, \ tumbler_filter_orders_callback, validate_address, get_tumbler_parser, \ get_max_cj_fee_values, get_total_tumble_amount, ScheduleGenerationErrorNoFunds from jmclient.wallet_utils import DEFAULT_MIXDEPTH -from jmbase.support import get_log, jmprint, EXIT_SUCCESS, \ +from jmbase.support import get_log, jmprint, \ EXIT_FAILURE, EXIT_ARGERROR log = get_log() @@ -75,58 +75,17 @@ def main(): jmprint("Invalid destination address: " + daddr, "error") sys.exit(EXIT_ARGERROR) jmprint("Destination addresses: " + str(destaddrs), "important") - #If the --restart flag is set we read the schedule - #from the file, and filter out entries that are - #already complete - if options['restart']: - res, schedule = get_schedule(os.path.join(logsdir, - options['schedulefile'])) - if not res: - jmprint("Failed to load schedule, name: " + str( - options['schedulefile']), "error") - jmprint("Error was: " + str(schedule), "error") - sys.exit(EXIT_FAILURE) - #This removes all entries that are marked as done - schedule = [s for s in schedule if s[-1] != 1] - # remaining destination addresses must be stored in Taker.tdestaddrs - # in case of tweaks; note we can't change, so any passed on command - # line must be ignored: - if len(destaddrs) > 0: - jmprint("For restarts, destinations are taken from schedule file," - " so passed destinations on the command line were ignored.", - "important") - if input("OK? (y/n)") != "y": - sys.exit(EXIT_SUCCESS) - destaddrs = [s[3] for s in schedule if s[3] not in ["INTERNAL", "addrask"]] - jmprint("Remaining destination addresses in restart: " + ",".join(destaddrs), - "important") - if isinstance(schedule[0][-1], str) and len(schedule[0][-1]) == 64: - #ensure last transaction is confirmed before restart - tumble_log.info("WAITING TO RESTART...") - txid = schedule[0][-1] - restart_waiter(txid) - #remove the already-done entry (this connects to the other TODO, - #probably better *not* to truncate the done-already txs from file, - #but simplest for now. - schedule = schedule[1:] - elif schedule[0][-1] != 0: - print("Error: first schedule entry is invalid.") - sys.exit(EXIT_FAILURE) - with open(os.path.join(logsdir, options['schedulefile']), "wb") as f: - f.write(schedule_to_text(schedule)) - tumble_log.info("TUMBLE RESTARTING") - else: - #Create a new schedule from scratch - try: - schedule = get_tumble_schedule(options, destaddrs, - wallet.get_balance_by_mixdepth(), wallet_service.mixdepth) - except ScheduleGenerationErrorNoFunds: - jmprint("No funds in wallet to tumble.", "error") - sys.exit(EXIT_FAILURE) - tumble_log.info("TUMBLE STARTING") - with open(os.path.join(logsdir, options['schedulefile']), "wb") as f: - f.write(schedule_to_text(schedule)) - print("Schedule written to logs/" + options['schedulefile']) + #Create a new schedule from scratch + try: + schedule = get_tumble_schedule(options, destaddrs, + wallet.get_balance_by_mixdepth(), wallet_service.mixdepth) + except ScheduleGenerationErrorNoFunds: + jmprint("No funds in wallet to tumble.", "error") + sys.exit(EXIT_FAILURE) + tumble_log.info("TUMBLE STARTING") + with open(os.path.join(logsdir, options['schedulefile']), "wb") as f: + f.write(schedule_to_text(schedule)) + print("Schedule written to logs/" + options['schedulefile']) tumble_log.info("With this schedule: ") tumble_log.info(pprint.pformat(schedule))