teos - Changes the behavior for updates of already triggered appointments

If an update for an already triggered appointment is received, it will be drop no matter if the locator is in the cache or not. This tries to prevent inconsistencies between the Watcher and the Responder, specially in the case of a reorg when data may have to flow backwards.
This commit is contained in:
Sergi Delgado Segura
2020-05-21 19:37:33 +02:00
parent 3228eeac6b
commit 708f2e1f3b
3 changed files with 8 additions and 9 deletions

View File

@@ -355,10 +355,10 @@ def test_add_appointment_in_cache(api, client):
r = add_appointment(client, {"appointment": appointment.to_dict(), "signature": appointment_signature}, user_id)
assert r.status_code == HTTP_BAD_REQUEST and r.json.get("error_code") == errors.APPOINTMENT_ALREADY_TRIGGERED
# The appointment should simply accepted if the data is not in the cache, since it cannot be triggered again
# The appointment would be rejected even if the data is not in the cache provided we've it has been triggered
del api.watcher.locator_cache.cache[appointment.locator]
r = add_appointment(client, {"appointment": appointment.to_dict(), "signature": appointment_signature}, user_id)
assert r.status_code == HTTP_OK and r.json.get("available_slots") == 0
assert r.status_code == HTTP_BAD_REQUEST and r.json.get("error_code") == errors.APPOINTMENT_ALREADY_TRIGGERED
def test_add_appointment_in_cache_cannot_decrypt(api, client):