From 5934eeede3a958dcb2a1b178ad7c9e4c14405655 Mon Sep 17 00:00:00 2001 From: Lucas Meier Date: Wed, 28 Feb 2024 14:57:52 -0800 Subject: [PATCH] Add duplicate position open check for transactions --- .../dex/src/component/action_handler/position/open.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/crates/core/component/dex/src/component/action_handler/position/open.rs b/crates/core/component/dex/src/component/action_handler/position/open.rs index cbbbe21cf6..4f77d88a1e 100644 --- a/crates/core/component/dex/src/component/action_handler/position/open.rs +++ b/crates/core/component/dex/src/component/action_handler/position/open.rs @@ -32,14 +32,13 @@ impl ActionHandler for PositionOpen { Ok(()) } - async fn check_stateful(&self, state: Arc) -> Result<()> { - // Validate that the position ID doesn't collide - state.check_position_id_unused(&self.position.id()).await?; - + async fn check_stateful(&self, _state: Arc) -> Result<()> { Ok(()) } async fn execute(&self, mut state: S) -> Result<()> { + // Validate that the position ID doesn't collide + state.check_position_id_unused(&self.position.id()).await?; state.put_position(self.position.clone()).await?; state.record_proto(event::position_open(self)); Ok(())