From 991b39a2b528702446d3a5f6d1abb604e4873240 Mon Sep 17 00:00:00 2001 From: Pierre Boutillier Date: Mon, 19 Nov 2018 14:48:10 +0100 Subject: [PATCH] Signer: Fix high watermarking Fix 89372a8e284d89859de221cc4396fbcbf0254b9e --- src/bin_signer/handler.ml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/bin_signer/handler.ml b/src/bin_signer/handler.ml index 2cafadfe6..4d08ad1fb 100644 --- a/src/bin_signer/handler.ml +++ b/src/bin_signer/handler.ml @@ -69,10 +69,12 @@ module High_watermark = struct | Some (previous_level, previous_hash, Some signature) -> if previous_level > level then failwith "%s level %ld below high watermark %ld" name level previous_level - else if previous_level = level && previous_hash <> hash then - failwith "%s level %ld already signed with different data" name level - else - return (Some signature) + else if previous_level = level then + if previous_hash <> hash then + failwith "%s level %ld already signed with different data" name level + else + return (Some signature) + else return_none end >>=? function | Some signature -> return signature | None ->