Skip to content

Commit 4d895f2

Browse files
committed
Fix incorrect balancing check
1 parent fcac32d commit 4d895f2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

submit-api/src/SubmitAPI/Internal/Balancing.hs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,10 +270,11 @@ makeTransactionBodyAutoBalance eraInMode systemstart history pparams
270270
:: TxOut CtxTx era
271271
-> ProtocolParameters
272272
-> Either TxBodyErrorAutoBalance ()
273-
checkMinUTxOValue txout@(TxOut _ v _ _) pparams' = do
273+
checkMinUTxOValue txout@(TxOut addr v _ _) pparams' = do
274274
minUTxO <- first TxBodyErrorMinUTxOMissingPParams
275275
$ calculateMinimumUTxO era txout pparams'
276-
if txOutValueToLovelace v >= selectLovelace minUTxO
276+
let chargeBoxWillBeMerged = addr == changeaddr
277+
if txOutValueToLovelace v >= selectLovelace minUTxO || chargeBoxWillBeMerged
277278
then Right ()
278279
else Left TxBodyErrorMissingParamMinUTxO --todo fix: TxOutInAnyEra. Current err is incorrect
279280

0 commit comments

Comments
 (0)