From 4035c20098f0f1f59b70a55b0c7ef2e49d2a49ef Mon Sep 17 00:00:00 2001 From: Grégoire Détrez Date: Fri, 5 Aug 2022 13:54:42 +0200 Subject: Don't count an already-signed tree-head as an error --- sigsum-witness.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'sigsum-witness.py') diff --git a/sigsum-witness.py b/sigsum-witness.py index 04b4ba5..1a565b8 100755 --- a/sigsum-witness.py +++ b/sigsum-witness.py @@ -67,6 +67,7 @@ ERR_SIGKEYFILE_MISSING = 11 ERR_SIGKEY_FORMAT = 12 ERR_NYI = 13 ERR_COSIG_POST = 14 +ERR_TREEHEAD_SEEN = 15 class Parser: def __init__(self): @@ -226,7 +227,7 @@ class TreeHead: if self.timestamp == prev.timestamp and \ self.root_hash == prev.root_hash and \ self.tree_size == prev.tree_size: - return (ERR_OK, + return (ERR_TREEHEAD_SEEN, "INFO: Fetched head of tree of size {} already seen".format(prev.tree_size)) if self.root_hash == prev.root_hash and \ @@ -527,6 +528,10 @@ class Witness(threading.Thread): return err err = new_tree_head.history_valid(self.cur_tree_head) if err: + # We don't want to count an already signed treehead as an error + if err[0]== ERR_TREEHEAD_SEEN: + LOGGER.warning(err[1]) + return return err if not self.cur_tree_head.signature_valid(self.log_verification_key): return ( -- cgit v1.2.3