From 8d3ccf333d062629f5804bfa2cda95ce2b40b09e Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 23 Apr 2019 18:05:33 -0500 Subject: [PATCH 1/2] Fix race-condition bug --- packages/order-watcher/src/order_watcher/order_watcher.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/order-watcher/src/order_watcher/order_watcher.ts b/packages/order-watcher/src/order_watcher/order_watcher.ts index 7550f5c3ab..78c619859f 100644 --- a/packages/order-watcher/src/order_watcher/order_watcher.ts +++ b/packages/order-watcher/src/order_watcher/order_watcher.ts @@ -493,6 +493,9 @@ export class OrderWatcher { private async _emitRevalidateOrdersAsync(orderHashes: string[], transactionHash?: string): Promise { for (const orderHash of orderHashes) { const signedOrder = this._orderByOrderHash[orderHash]; + if (signedOrder === undefined) { + continue; + } // Most of these calls will never reach the network because the data is fetched from stores // and only updated when cache is invalidated const orderState = await this._orderStateUtils.getOpenOrderStateAsync(signedOrder, transactionHash); From cc3378b4cd9fc61164efa859115e7591fd5e6b26 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 23 Apr 2019 18:07:12 -0500 Subject: [PATCH 2/2] Add CHANGELOG entry --- packages/order-watcher/CHANGELOG.json | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/order-watcher/CHANGELOG.json b/packages/order-watcher/CHANGELOG.json index da94a99cb9..89d6b905fe 100644 --- a/packages/order-watcher/CHANGELOG.json +++ b/packages/order-watcher/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "version": "4.0.7", + "changes": [ + { + "note": "Fix race-condition bug due to async callback modifying shared state", + "pr": 1789 + } + ] + }, { "version": "4.0.6", "changes": [