Browse Source

Merge #572: Don't use honest_makers in case: mempool conflict

4af9c42 Don't use honest_makers in case: mempool conflict (Adam Gibson)
master
Adam Gibson 6 years ago
parent
commit
66bef00dc1
No known key found for this signature in database
GPG Key ID: 141001A1AF77F20B
  1. 17
      jmclient/jmclient/taker_utils.py

17
jmclient/jmclient/taker_utils.py

@ -252,14 +252,22 @@ def tumbler_taker_finished_update(taker, schedulefile, tumble_log, options,
else: else:
# a transaction failed, either because insufficient makers # a transaction failed, either because insufficient makers
# (acording to minimum_makers) responded in Phase 1, or not all # (acording to minimum_makers) responded in Phase 1, or not all
#makers responded in Phase 2. We'll first try to repeat without the # makers responded in Phase 2, or the tx was a mempool conflict.
#troublemakers. # If the tx was a mempool conflict, we should restart with random
# maker choice as usual. If someone didn't respond, we'll try to
# repeat without the troublemakers.
log.info("Schedule entry: " + str( log.info("Schedule entry: " + str(
taker.schedule[taker.schedule_index]) + \ taker.schedule[taker.schedule_index]) + \
" failed after timeout, trying again") " failed after timeout, trying again")
taker.add_ignored_makers(taker.nonrespondants) taker.add_ignored_makers(taker.nonrespondants)
#Is the failure in Phase 2? #Is the failure in Phase 2?
if not taker.latest_tx is None: if not taker.latest_tx is None:
if len(taker.nonrespondants) == 0:
# transaction was created validly but conflicted in the
# mempool; just try again without honest settings;
# i.e. fallback to same as Phase 1 failure.
log.info("Invalid transaction; possible mempool conflict.")
else:
#Now we have to set the specific group we want to use, and hopefully #Now we have to set the specific group we want to use, and hopefully
#they will respond again as they showed honesty last time. #they will respond again as they showed honesty last time.
#Note that we must wipe the list first; other honest makers needn't #Note that we must wipe the list first; other honest makers needn't
@ -270,8 +278,9 @@ def tumbler_taker_finished_update(taker, schedulefile, tumble_log, options,
taker.maker_utxo_data.keys()).symmetric_difference( taker.maker_utxo_data.keys()).symmetric_difference(
set(taker.nonrespondants)))) set(taker.nonrespondants))))
#If insufficient makers were honest, we can only tweak the schedule. #If insufficient makers were honest, we can only tweak the schedule.
#If enough were, we prefer the restart with them only: #If enough were, we prefer to restart with them only:
log.info("Inside a Phase 2 failure; number of honest respondants was: " + str(len(taker.honest_makers))) log.info("Inside a Phase 2 failure; number of honest "
"respondants was: " + str(len(taker.honest_makers)))
log.info("They were: " + str(taker.honest_makers)) log.info("They were: " + str(taker.honest_makers))
if len(taker.honest_makers) >= jm_single().config.getint( if len(taker.honest_makers) >= jm_single().config.getint(
"POLICY", "minimum_makers"): "POLICY", "minimum_makers"):

Loading…
Cancel
Save