OSDN Git Service

fix_check_isPartialTrade (#525)
[bytom/vapor.git] / application / mov / match / engine.go
index d332d75..126810d 100644 (file)
@@ -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))