From 8a1c81618d74c289a15ff14c4f09b1ddf5192147 Mon Sep 17 00:00:00 2001 From: Daniel McNally Date: Thu, 27 Aug 2020 00:16:50 -0400 Subject: [PATCH] fix(orderbook): reject all dust peer orders 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. --- lib/orderbook/OrderBook.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/orderbook/OrderBook.ts b/lib/orderbook/OrderBook.ts index 3d5b7b76c..f8b7d155d 100644 --- a/lib/orderbook/OrderBook.ts +++ b/lib/orderbook/OrderBook.ts @@ -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; }