File tree Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -209,12 +209,19 @@ mkChain tracer queryTimeHandle wallet ctx LocalChainState{getLatest} submitTx =
209
209
rejectLowDeposits :: PParams LedgerEra -> UTxO. UTxO -> Either (PostTxError Tx ) ()
210
210
rejectLowDeposits pparams utxo = do
211
211
let insAndOuts = UTxO. toList utxo
212
- let providedValues = UTxO. totalLovelace . uncurry UTxO. singleton <$> insAndOuts
213
- let minimumValue = List. maximum $ (\ (_, o) -> calculateMinimumUTxO shelleyBasedEra pparams $ fromCtxUTxOTxOut o) <$> insAndOuts
214
- case List. find (< minimumValue) providedValues of
215
- Nothing -> Right ()
216
- Just providedValue ->
217
- Left (DepositTooLow {providedValue, minimumValue} :: PostTxError Tx )
212
+ let providedValues = (\ (i, o) -> (i, UTxO. totalLovelace $ UTxO. singleton i o)) <$> insAndOuts
213
+ let minimumValues = (\ (i, o) -> (i, calculateMinimumUTxO shelleyBasedEra pparams $ fromCtxUTxOTxOut o)) <$> insAndOuts
214
+ let results =
215
+ ( \ (i, minVal) ->
216
+ case List. find (\ (ix, providedVal) -> i == ix && providedVal < minVal) providedValues of
217
+ Nothing -> Right ()
218
+ Just (_, tooLowValue) ->
219
+ Left (DepositTooLow {providedValue = tooLowValue, minimumValue = minVal} :: PostTxError Tx )
220
+ )
221
+ <$> minimumValues
222
+ case lefts results of
223
+ [] -> pure ()
224
+ (e : _) -> Left e
218
225
219
226
-- | Balance and sign the given partial transaction.
220
227
finalizeTx ::
Original file line number Diff line number Diff line change @@ -472,7 +472,7 @@ apiServerSpec = do
472
472
case result of
473
473
Left DepositTooLow {providedValue, minimumValue} ->
474
474
property $
475
- minimumValue > providedValue
475
+ minimumValue >= providedValue
476
476
& counterexample (" Minimum value: " <> show minimumValue <> " Provided value: " <> show providedValue)
477
477
_ -> property True
478
478
You can’t perform that action at this time.
0 commit comments