aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrégoire Détrez <gregoire@mullvad.net>2022-08-05 13:54:42 +0200
committerGrégoire Détrez <gregoire@mullvad.net>2022-08-19 14:46:42 +0200
commit4035c20098f0f1f59b70a55b0c7ef2e49d2a49ef (patch)
tree7689f9cee62543c00582546ebe443532c995c5b6
parenteb1668efd83d1e44e07f0f8d0e6075f05e31206d (diff)
Don't count an already-signed tree-head as an error
-rwxr-xr-xsigsum-witness.py7
1 files changed, 6 insertions, 1 deletions
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 (