aboutsummaryrefslogtreecommitdiffstats
path: root/packages/0x.js/src
diff options
context:
space:
mode:
Diffstat (limited to 'packages/0x.js/src')
-rw-r--r--packages/0x.js/src/order_watcher/expiration_watcher.ts3
-rw-r--r--packages/0x.js/src/order_watcher/order_state_watcher.ts8
2 files changed, 6 insertions, 5 deletions
diff --git a/packages/0x.js/src/order_watcher/expiration_watcher.ts b/packages/0x.js/src/order_watcher/expiration_watcher.ts
index 00b62162d..8b306bf3b 100644
--- a/packages/0x.js/src/order_watcher/expiration_watcher.ts
+++ b/packages/0x.js/src/order_watcher/expiration_watcher.ts
@@ -48,6 +48,9 @@ export class ExpirationWatcher {
this._orderHashByExpirationRBTree.insert(orderHash);
}
public removeOrder(orderHash: string): void {
+ if (_.isUndefined(this._expiration[orderHash])) {
+ return; // noop since order already removed
+ }
this._orderHashByExpirationRBTree.remove(orderHash);
delete this._expiration[orderHash];
}
diff --git a/packages/0x.js/src/order_watcher/order_state_watcher.ts b/packages/0x.js/src/order_watcher/order_state_watcher.ts
index 94b463921..a9df8ac9d 100644
--- a/packages/0x.js/src/order_watcher/order_state_watcher.ts
+++ b/packages/0x.js/src/order_watcher/order_state_watcher.ts
@@ -123,7 +123,7 @@ export class OrderStateWatcher {
* Removes an order from the orderStateWatcher
* @param orderHash The orderHash of the order you wish to stop watching.
*/
- public removeOrder(orderHash: string, removeFromExpirationWatcher: boolean = true): void {
+ public removeOrder(orderHash: string): void {
assert.doesConformToSchema('orderHash', orderHash, schemas.orderHashSchema);
const signedOrder = this._orderByOrderHash[orderHash];
if (_.isUndefined(signedOrder)) {
@@ -139,9 +139,7 @@ export class OrderStateWatcher {
this._removeFromDependentOrderHashes(signedOrder.maker, signedOrder.makerTokenAddress, orderHash);
}
- if (removeFromExpirationWatcher) {
- this._expirationWatcher.removeOrder(orderHash);
- }
+ this._expirationWatcher.removeOrder(orderHash);
}
/**
* Starts an orderStateWatcher subscription. The callback will be called every time a watched order's
@@ -214,7 +212,7 @@ export class OrderStateWatcher {
error: ExchangeContractErrs.OrderFillExpired,
};
if (!_.isUndefined(this._orderByOrderHash[orderHash])) {
- this.removeOrder(orderHash, false);
+ this.removeOrder(orderHash);
if (!_.isUndefined(this._callbackIfExists)) {
this._callbackIfExists(null, orderState);
}