Skip to content

Commit

Permalink
fix(orderbook): reject all dust peer orders
Browse files Browse the repository at this point in the history
This fixes an oversight where we would only reject peer orders where
the price times quantity was below the dust limit, but not necessarily
where the quantity itself was below the dust limit.
  • Loading branch information
sangaman committed Aug 27, 2020
1 parent 704aa1b commit 8a1c816
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/orderbook/OrderBook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,8 @@ class OrderBook extends EventEmitter {
}

// TODO: penalize peers for sending ordes too small to swap?
if (order.quantity * order.price < TradingPair.QUANTITY_DUST_LIMIT) {
if (order.quantity * order.price < TradingPair.QUANTITY_DUST_LIMIT ||
order.quantity < TradingPair.QUANTITY_DUST_LIMIT) {
this.logger.warn('incoming peer order is too small to swap');
return false;
}
Expand Down

0 comments on commit 8a1c816

Please sign in to comment.