From 0e0a84fdc004e373077e26eeb10470f7ddfa1465 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone <exarkun@twistedmatrix.com> Date: Fri, 8 May 2020 15:34:15 -0400 Subject: [PATCH] Remove redundant error-handling check This condition can never succeed. If the voucher is being seen for the first time at this point then it should start redemption and the check will not pass. If the voucher has been seen before and was in an error state to begin with then the check higher up, outside of the loop, prevents execution from ever entering the loop. If the voucher has been seen before and just now entered an error state then the `if not succeeded` check below, on the previous iteration, would stop the loop and prevent this condition from ever being checked. --- src/_zkapauthorizer/controller.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/_zkapauthorizer/controller.py b/src/_zkapauthorizer/controller.py index f40ffef..77436a8 100644 --- a/src/_zkapauthorizer/controller.py +++ b/src/_zkapauthorizer/controller.py @@ -832,10 +832,6 @@ class PaymentController(object): # Reload state before each iteration. We expect it to change each time. voucher_obj = self.store.get(voucher) - if not voucher_obj.state.should_start_redemption(): - # An earlier iteration may have encountered a fatal error. - break - succeeded = yield self._perform_redeem(voucher_obj, counter, tokens) if not succeeded: self._log.info( -- GitLab