-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into address-book-key-by-chain-id
- Loading branch information
Showing
2 changed files
with
57 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
diff --git a/node_modules/web3-provider-engine/index.js b/node_modules/web3-provider-engine/index.js | ||
index 3a1b7d5..15560d7 100644 | ||
--- a/node_modules/web3-provider-engine/index.js | ||
+++ b/node_modules/web3-provider-engine/index.js | ||
@@ -48,8 +48,29 @@ Web3ProviderEngine.prototype.start = function(cb = noop){ | ||
|
||
// on new block, request block body and emit as events | ||
self._blockTracker.on('latest', (blockNumber) => { | ||
+ // PATCH NOTE: These changes are needed temporarily to maintain | ||
+ // compatibility between web3-provider-engine and | ||
+ // @metamask/network-controller v6, v7, and v8. This can be dropped when | ||
+ // we update to @metamask/network-controller v9 (core v53). | ||
+ // | ||
+ // Specifically, this is meant to prevent an error that happens upon | ||
+ // switching networks. The network controller uses a proxied provider and | ||
+ // block tracker as of v6, which migrates all event listeners to the new | ||
+ // provider when the network is switched. In this case, we don't want | ||
+ // this event listener migrated, but there is no straightforward way to | ||
+ // prevent that. Instead we have made it a no-op after switching. | ||
+ if (self._running === false) { | ||
+ return; | ||
+ } | ||
// get block body | ||
self._getBlockByNumberWithRetry(blockNumber, (err, block) => { | ||
+ // PATCH NOTE: See the patch note above for more context. | ||
+ // This additional condition prevents console warnings in the case where | ||
+ // an `eth_getBlockByNumber` request was in-flight when the network was | ||
+ // switched. | ||
+ if (self._running === false) { | ||
+ return; | ||
+ } | ||
if (err) { | ||
this.emit('error', err) | ||
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters