fix timestamp compare

This commit is contained in:
swrup 2026-02-27 22:44:49 +01:00
parent 2e29cb0418
commit b1de214881
6 changed files with 15 additions and 22 deletions

View file

@ -122,7 +122,7 @@ module Auditors = struct
Logs.info (fun m -> m "enabled auditor");
()
| Some auditor ->
if Timestamp.geq auditor.last_change validity_start then
if Timestamp.compare validity_start auditor.last_change <= 0 then
Error "replay detected on enable-auditor"
else
let+ () = Pg.update_auditor db_conn auditor |> unwrap_err_caqti in
@ -157,7 +157,7 @@ module Auditors_disable = struct
match opt with
| None -> Error "auditor not found"
| Some auditor -> (
if Timestamp.geq auditor.last_change validity_end then
if Timestamp.compare validity_end auditor.last_change <= 0 then
Error "replay detected on disable-auditor"
else
match auditor.is_active with
@ -384,7 +384,7 @@ module Wire = struct
Logs.info (fun m -> m "added wire method");
()
| Some (wire, _is_active, last_change) ->
if Timestamp.geq last_change validity_start then
if Timestamp.compare validity_start last_change <= 0 then
Error "replay detected on enable-wire"
else
let+ () =
@ -423,7 +423,7 @@ module Wire_disable = struct
match opt with
| None -> Error "wire not found"
| Some (wire, _is_active, last_change) ->
if Timestamp.geq last_change validity_end then
if Timestamp.compare validity_end last_change <= 0 then
Error "replay detected on disable-wire"
else
let+ () =