Noop on cancel if order is already unfillable

This commit is contained in:
Amir Bandeali
2019-08-05 10:10:52 -07:00
parent 92a4556956
commit 6cb8c1df42

View File

@@ -256,6 +256,11 @@ contract MixinExchangeCore is
// Validate context
_assertValidCancel(order, orderInfo);
// Noop if order is already unfillable
if (orderInfo.orderStatus != OrderStatus.FILLABLE) {
return;
}
// Perform cancel
_updateCancelledState(order, orderInfo.orderHash);
}
@@ -466,15 +471,6 @@ contract MixinExchangeCore is
internal
view
{
// Ensure order is valid
// An order can only be cancelled if its status is FILLABLE.
if (orderInfo.orderStatus != uint8(OrderStatus.FILLABLE)) {
LibRichErrors._rrevert(LibExchangeRichErrors.OrderStatusError(
orderInfo.orderHash,
OrderStatus(orderInfo.orderStatus)
));
}
// Validate sender is allowed to cancel this order
if (order.senderAddress != address(0)) {
if (order.senderAddress != msg.sender) {