Skip to content

Commit

Permalink
fix: ignore dust underflows in order fills rpc (#5352)
Browse files Browse the repository at this point in the history
fix: ignore dust underflow
  • Loading branch information
dandanlen committed Oct 30, 2024
1 parent 4deee62 commit c8ac235
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion state-chain/custom-rpc/src/order_fills.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,17 @@ fn order_fills_for_pool<'a>(
if let Some((previous_collected, _)) = option_previous_order_state {
(
collected.fees - previous_collected.fees,
collected.sold_amount - previous_collected.sold_amount,
collected
.sold_amount
.checked_sub(previous_collected.sold_amount)
.unwrap_or_else(|| {
log::info!(
"Ignored dust sold_amount underflow. Current: {}, Previous: {}",
collected.sold_amount,
previous_collected.sold_amount
);
0.into()
}),
collected.bought_amount - previous_collected.bought_amount,
)
} else {
Expand Down

0 comments on commit c8ac235

Please sign in to comment.