plugin - repurpose invalid_appointments and adds misbehaving_proof

invalid_appointments in TowerInfo was used to stored invalid appointment responses from the tower when it was misbehaving (i.e. wrong or missing signature). However, a single item was stored since the tower is abandoned after misbehaving. data reported as invalid by the tower was not backed up.

invalid_appointments now stores the appointment rejected by the tower and reported as invalid.
misbehaving_proof stores the proof of misbehaviour by the tower (single item)
This commit is contained in:
Sergi Delgado Segura
2020-05-05 17:03:31 +02:00
parent b650ba3c26
commit f5c634ed14
4 changed files with 39 additions and 31 deletions

View File

@@ -63,7 +63,11 @@ class Retrier:
except SignatureError as e:
tower_update["status"] = "misbehaving"
tower_update["invalid_appointment"] = (appointment_dict, e.kwargs.get("signature"))
tower_update["misbehaving_proof"] = {
"appointment": appointment_dict,
"signature": e.kwargs.get("signature"),
"recovered_id": e.kwargs.get("recovered_id"),
}
except TowerConnectionError:
tower_update["status"] = "temporarily unreachable"
@@ -71,6 +75,9 @@ class Retrier:
except TowerResponseError as e:
tower_update["status"] = e.kwargs.get("status")
if e.kwargs.get("invalid_appointment"):
tower_update["invalid_appointment"] = (appointment_dict, signature)
if tower_update["status"] in ["reachable", "misbehaving"]:
tower_update["pending_appointment"] = ([appointment_dict, signature], "remove")