From 65f5d51a27cc67cc9ca5bf65673c7741b168c2c4 Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Wed, 8 Feb 2017 21:18:58 +0200 Subject: [PATCH] update cache index in tumbler after txs --- scripts/tumbler.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/tumbler.py b/scripts/tumbler.py index fd540a5..2fc41e9 100644 --- a/scripts/tumbler.py +++ b/scripts/tumbler.py @@ -23,6 +23,8 @@ from cli_options import get_tumbler_parser log = get_log() def main(): + #Prepare log file giving simplified information + #on progress of tumble. tumble_log = logging.getLogger('tumbler') tumble_log.setLevel(logging.DEBUG) logFormatter = logging.Formatter( @@ -78,6 +80,12 @@ def main(): #callback between transactions def taker_finished(res, fromtx=False, waittime=0.0): if fromtx: + #on taker side, cache index update is only required after tx + #push, to avoid potential of address reuse in case of a crash, + #because addresses are not public until broadcast (whereas for makers, + #they are public *during* negotiation). So updating the cache here + #is sufficient + taker.wallet.update_cache_index() if res: tumble_log.info("Completed successfully this entry:") #the log output depends on if it's a sweep, and if it's to INTERNAL @@ -112,7 +120,9 @@ def main(): reactor.callLater(0, clientfactory.getClient().clientStart) else: if not res: - log.info("Did not complete successfully, shutting down") + failure_msg = "Did not complete successfully, shutting down" + tumble_log.info(failure_msg) + log.info(failure_msg) else: log.info("All transactions completed correctly") tumble_log.info("Completed successfully the last entry:")