diff --git a/crates/solvers/src/domain/solution.rs b/crates/solvers/src/domain/solution.rs index 931755e9e7..216b54cf1a 100644 --- a/crates/solvers/src/domain/solution.rs +++ b/crates/solvers/src/domain/solution.rs @@ -112,6 +112,10 @@ impl Solution { self } + + pub fn is_empty(&self) -> bool { + self.prices.0.is_empty() && self.trades.is_empty() && self.interactions.is_empty() + } } /// A solution for a settling a single order. diff --git a/crates/solvers/src/domain/solver/legacy.rs b/crates/solvers/src/domain/solver/legacy.rs index 1ae641ef1b..cfc55edf8d 100644 --- a/crates/solvers/src/domain/solver/legacy.rs +++ b/crates/solvers/src/domain/solver/legacy.rs @@ -29,7 +29,13 @@ impl Legacy { pub async fn solve(&self, auction: auction::Auction) -> Vec { match self.0.solve(&auction).await { - Ok(solution) => vec![solution.with_id(solution::Id(0))], + Ok(solution) => { + if solution.is_empty() { + vec![] + } else { + vec![solution] + } + } Err(err) => { tracing::warn!(?err, "failed to solve auction"); if err.is_timeout() {