OSDN Git Service

fix mov infinite loop
authorshenao78 <shenao.78@163.com>
Wed, 4 Dec 2019 08:45:45 +0000 (16:45 +0800)
committershenao78 <shenao.78@163.com>
Wed, 4 Dec 2019 08:45:45 +0000 (16:45 +0800)
application/mov/mov_core.go

index 9e9923d..843a183 100644 (file)
@@ -23,7 +23,6 @@ var (
        errAmountOfFeeGreaterThanMaximum = errors.New("amount of fee greater than max fee amount")
        errAssetIDMustUniqueInMatchedTx  = errors.New("asset id must unique in matched transaction")
        errRatioOfTradeLessThanZero      = errors.New("ratio arguments must greater than zero")
-       errNumeratorOfRatioIsOverflow    = errors.New("ratio numerator of contract args product input amount is overflow")
        errLengthOfInputIsIncorrect      = errors.New("length of matched tx input is not equals to actual matched tx input")
        errSpendOutputIDIsIncorrect      = errors.New("spend output id of matched tx is not equals to actual matched tx")
        errRequestAmountMath             = errors.New("request amount of order less than one or big than max of int64")
@@ -259,6 +258,10 @@ func validateMatchedTx(tx *types.Tx, verifyResult *bc.TxVerifyResult) error {
                        return err
                }
 
+               if *order.FromAssetID == *order.ToAssetID {
+                       return errInvalidTradePairs
+               }
+
                fromAssetIDMap[order.FromAssetID.String()] = true
                toAssetIDMap[order.ToAssetID.String()] = true
        }