tx/parser: only require gas limit to be zero if func name is specified
@@ -88,10 +88,6 @@ func ParseTransferTransaction(payload []byte) (Transfer, error) {
}
tx.GasLimit = binary.LittleEndian.Uint64(b)
-
- if tx.GasLimit == 0 {
- return tx, errors.New("transfer: gas limit for invoking smart contract function must be greater than zero")
- }
}
if r.Len() > 0 {
@@ -140,6 +136,10 @@ func ParseTransferTransaction(payload []byte) (Transfer, error) {
}
}
+ if tx.GasLimit == 0 && len(tx.FuncName) > 0 {
+ return tx, errors.New("transfer: gas limit for invoking smart contract function must be greater than zero")
+ }
+
return tx, nil
}
