From a842a8213d61edcb98c5b6abfed8518046b60aed Mon Sep 17 00:00:00 2001 From: Jonathan Knowles Date: Tue, 12 May 2020 04:58:43 +0000 Subject: [PATCH] Use `isDust` to simplify `noDust`. --- src/library/Cardano/CoinSelection/Algorithm/Migration.hs | 3 ++- src/library/Cardano/CoinSelection/Fee.hs | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/library/Cardano/CoinSelection/Algorithm/Migration.hs b/src/library/Cardano/CoinSelection/Algorithm/Migration.hs index 7a8970e59..55171dd73 100644 --- a/src/library/Cardano/CoinSelection/Algorithm/Migration.hs +++ b/src/library/Cardano/CoinSelection/Algorithm/Migration.hs @@ -42,6 +42,7 @@ import Cardano.CoinSelection.Fee , FeeBalancingPolicy (..) , FeeEstimator (..) , FeeOptions (..) + , isDust ) import Control.Monad.Trans.State ( State, evalState, get, put ) @@ -124,7 +125,7 @@ selectCoins options (BatchSize batchSize) utxo = threshold = unDustThreshold dustThreshold noDust :: Coin -> Maybe Coin noDust c - | c <= threshold = Nothing + | isDust dustThreshold c = Nothing | otherwise = Just c -- | Attempt to balance the coin selection by reducing or increasing the diff --git a/src/library/Cardano/CoinSelection/Fee.hs b/src/library/Cardano/CoinSelection/Fee.hs index 853e44b00..cf6961d9c 100644 --- a/src/library/Cardano/CoinSelection/Fee.hs +++ b/src/library/Cardano/CoinSelection/Fee.hs @@ -31,6 +31,7 @@ module Cardano.CoinSelection.Fee -- * Dust Processing , DustThreshold (..) + , isDust , coalesceDust -- # Internal Functions