From 6ce51ce2b8c51cf04d6f5bfc83a8662d5ba7596f Mon Sep 17 00:00:00 2001 From: Poseidon Date: Mon, 30 Mar 2020 18:13:11 +0800 Subject: [PATCH] fix_check_isPartialTrade (#525) --- application/mov/match/engine.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/application/mov/match/engine.go b/application/mov/match/engine.go index d332d75b..126810d1 100644 --- a/application/mov/match/engine.go +++ b/application/mov/match/engine.go @@ -157,8 +157,9 @@ func addMatchTxOutput(txData *types.TxData, orders []*common.Order, receivedAmou receivedAmount := receivedAmounts[i].Amount shouldPayAmount := calcShouldPayAmount(receivedAmount, contractArgs.RatioNumerator, contractArgs.RatioDenominator) + requestAmount := CalcRequestAmount(order.Utxo.Amount, order.RatioNumerator, order.RatioDenominator) exchangeAmount := order.Utxo.Amount - shouldPayAmount - isPartialTrade := CalcRequestAmount(exchangeAmount, contractArgs.RatioNumerator, contractArgs.RatioDenominator) >= 1 + isPartialTrade := requestAmount > receivedAmount && CalcRequestAmount(exchangeAmount, contractArgs.RatioNumerator, contractArgs.RatioDenominator) >= 1 setMatchTxArguments(txData.Inputs[i], isPartialTrade, len(txData.Outputs), receivedAmount) txData.Outputs = append(txData.Outputs, types.NewIntraChainOutput(*order.ToAssetID, allocatedAssets.Receives[i].Amount, contractArgs.SellerProgram)) -- 2.11.0