From 2826e1c5aaa638f26cb015aeb3ffc20073033bf6 Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Sun, 26 Nov 2023 08:20:19 -0500 Subject: [PATCH] Correct subtraction which could underflow I have no idea how this didn't prior trip. --- processor/src/main.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/processor/src/main.rs b/processor/src/main.rs index 0df5fdd40..59acb871e 100644 --- a/processor/src/main.rs +++ b/processor/src/main.rs @@ -570,9 +570,11 @@ async fn run(mut raw_db: D, network: N, mut // KeyGen specifically may take a notable amount of processing time // While that shouldn't be an issue in practice, as after processing an attempt it'll handle // the other messages in the queue, it may be beneficial to parallelize these - // They could likely be parallelized by type (KeyGen, Sign, Substrate) without issue + // They could potentially be parallelized by type (KeyGen, Sign, Substrate) without issue msg = coordinator.recv() => { - assert_eq!(msg.id, (last_coordinator_msg.unwrap_or(msg.id - 1) + 1)); + if let Some(last_coordinator_msg) = last_coordinator_msg { + assert_eq!(msg.id, last_coordinator_msg + 1); + } last_coordinator_msg = Some(msg.id);