Skip to content

Commit

Permalink
fix: ignore dust underflow
Browse files Browse the repository at this point in the history
  • Loading branch information
dandanlen committed Oct 24, 2024
1 parent dc8bf3e commit 99f04b4
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 99f04b4

Please sign in to comment.