Fix redundant expired order removal bug
This commit is contained in:
@@ -123,7 +123,7 @@ export class OrderStateWatcher {
|
|||||||
* Removes an order from the orderStateWatcher
|
* Removes an order from the orderStateWatcher
|
||||||
* @param orderHash The orderHash of the order you wish to stop watching.
|
* @param orderHash The orderHash of the order you wish to stop watching.
|
||||||
*/
|
*/
|
||||||
public removeOrder(orderHash: string): void {
|
public removeOrder(orderHash: string, removeFromExpirationWatcher: boolean = true): void {
|
||||||
assert.doesConformToSchema('orderHash', orderHash, schemas.orderHashSchema);
|
assert.doesConformToSchema('orderHash', orderHash, schemas.orderHashSchema);
|
||||||
const signedOrder = this._orderByOrderHash[orderHash];
|
const signedOrder = this._orderByOrderHash[orderHash];
|
||||||
if (_.isUndefined(signedOrder)) {
|
if (_.isUndefined(signedOrder)) {
|
||||||
@@ -139,7 +139,9 @@ export class OrderStateWatcher {
|
|||||||
this._removeFromDependentOrderHashes(signedOrder.maker, signedOrder.makerTokenAddress, orderHash);
|
this._removeFromDependentOrderHashes(signedOrder.maker, signedOrder.makerTokenAddress, orderHash);
|
||||||
}
|
}
|
||||||
|
|
||||||
this._expirationWatcher.removeOrder(orderHash);
|
if (removeFromExpirationWatcher) {
|
||||||
|
this._expirationWatcher.removeOrder(orderHash);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Starts an orderStateWatcher subscription. The callback will be called every time a watched order's
|
* Starts an orderStateWatcher subscription. The callback will be called every time a watched order's
|
||||||
@@ -212,7 +214,7 @@ export class OrderStateWatcher {
|
|||||||
error: ExchangeContractErrs.OrderFillExpired,
|
error: ExchangeContractErrs.OrderFillExpired,
|
||||||
};
|
};
|
||||||
if (!_.isUndefined(this._orderByOrderHash[orderHash])) {
|
if (!_.isUndefined(this._orderByOrderHash[orderHash])) {
|
||||||
this.removeOrder(orderHash);
|
this.removeOrder(orderHash, false);
|
||||||
if (!_.isUndefined(this._callbackIfExists)) {
|
if (!_.isUndefined(this._callbackIfExists)) {
|
||||||
this._callbackIfExists(null, orderState);
|
this._callbackIfExists(null, orderState);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user