From 0f887feb4dc329735de285667c5c5316b5373ca8 Mon Sep 17 00:00:00 2001 From: Sergi Delgado Segura Date: Fri, 17 Jan 2020 17:47:45 +0100 Subject: [PATCH] Deletes appointment from Watcher's db if a tracker cannot be added There was a bug in the Responder where, if a tracker could not be added (e.g. malformed tx) the data was dropped but never removed from the Watcher's db. This is due to flagging appointments as triggered instead of deleting them from the Watcher's db straight away (in order to deal with reorgs in the future). If that approach is not followed, and appointments are removed from the Watcher's db once they are passed to the Responder, this should be removed since it would be redundant. --- pisa/responder.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pisa/responder.py b/pisa/responder.py index 39f3777..d4866e1 100644 --- a/pisa/responder.py +++ b/pisa/responder.py @@ -213,7 +213,11 @@ class Responder: logger.warning( "Tracker cannot be created", reason=receipt.reason, uuid=uuid, on_sync=self.on_sync(block_hash) ) - pass + + # FIXME: This is only necessary because of the triggered appointment approach. Remove if it changes. + self.db_manager.delete_watcher_appointment(uuid) + self.db_manager.delete_triggered_appointment_flag(uuid) + Cleaner.update_delete_locator_map(locator, uuid, self.db_manager) return receipt