diff --git a/scripts/tumbler.py b/scripts/tumbler.py index aad6472..f40c52f 100644 --- a/scripts/tumbler.py +++ b/scripts/tumbler.py @@ -103,7 +103,7 @@ def main(): def taker_finished(res, fromtx=False, waittime=0.0, txdetails=None): """on_finished_callback for tumbler """ - def unconf_update(): + def unconf_update(addtolog=False): #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, @@ -121,19 +121,8 @@ def main(): "wb") as f: f.write(schedule_to_text(taker.schedule)) - if fromtx == "unconfirmed": - #unconfirmed event means transaction has been propagated, - #we update state to prevent accidentally re-creating it in - #any crash/restart condition - unconf_update() - return - - if fromtx: - if res: + if addtolog: tumble_log.info("Completed successfully this entry:") - #this has no effect except in the rare case that confirmation - #is immediate - unconf_update() #the log output depends on if it's to INTERNAL hrdestn = None if taker.schedule[taker.schedule_index][3] in ["INTERNAL", "addrask"]: @@ -144,6 +133,19 @@ def main(): taker.schedule[taker.schedule_index], hramt, hrdestn)) tumble_log.info("Txid was: " + taker.txid) + if fromtx == "unconfirmed": + #unconfirmed event means transaction has been propagated, + #we update state to prevent accidentally re-creating it in + #any crash/restart condition + unconf_update(True) + return + + if fromtx: + if res: + #this has no effect except in the rare case that confirmation + #is immediate; also it does not repeat the log entry. + unconf_update() + if taker.schedule[taker.schedule_index+1][3] == 'addrask': jm_single().debug_silence[0] = True print('\n'.join(['=' * 60] * 3))