aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-11-10 03:23:53 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-11-10 03:23:53 +0800
commit709fa06af6efc762ccd7a4219b7b52076190831e (patch)
treebacaf340e7504247838f7caeac077afad8d9270b /src
parent1351e02065c9b6dca3be4827153fe2a0911fcca4 (diff)
downloaddexon-sol-tools-709fa06af6efc762ccd7a4219b7b52076190831e.tar
dexon-sol-tools-709fa06af6efc762ccd7a4219b7b52076190831e.tar.gz
dexon-sol-tools-709fa06af6efc762ccd7a4219b7b52076190831e.tar.bz2
dexon-sol-tools-709fa06af6efc762ccd7a4219b7b52076190831e.tar.lz
dexon-sol-tools-709fa06af6efc762ccd7a4219b7b52076190831e.tar.xz
dexon-sol-tools-709fa06af6efc762ccd7a4219b7b52076190831e.tar.zst
dexon-sol-tools-709fa06af6efc762ccd7a4219b7b52076190831e.zip
Pass orderHash instead of an order to removeOrder and adjust the tests
Diffstat (limited to 'src')
-rw-r--r--src/mempool/order_state_watcher.ts9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/mempool/order_state_watcher.ts b/src/mempool/order_state_watcher.ts
index dc24d5b4a..528b8ceff 100644
--- a/src/mempool/order_state_watcher.ts
+++ b/src/mempool/order_state_watcher.ts
@@ -56,9 +56,12 @@ export class OrderStateWatcher {
this._orders[orderHash] = signedOrder;
this.addToDependentOrderHashes(signedOrder, orderHash);
}
- public removeOrder(signedOrder: SignedOrder): void {
- assert.doesConformToSchema('signedOrder', signedOrder, schemas.signedOrderSchema);
- const orderHash = ZeroEx.getOrderHashHex(signedOrder);
+ public removeOrder(orderHash: string): void {
+ assert.doesConformToSchema('orderHash', orderHash, schemas.orderHashSchema);
+ const signedOrder = this._orders[orderHash];
+ if (_.isUndefined(signedOrder)) {
+ return;
+ }
delete this._orders[orderHash];
this._dependentOrderHashes[signedOrder.maker][signedOrder.makerTokenAddress].delete(orderHash);
// We currently do not remove the maker/makerToken keys from the mapping when all orderHashes removed