aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/lib/inpage-provider.js
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2017-05-26 03:37:04 +0800
committerDan Finlay <dan@danfinlay.com>2017-05-26 03:37:04 +0800
commitad40e4d2608e0b1e329a6f9af851fbe2cc54e747 (patch)
tree31410d47019a6bf08c7a4905f9a0ce4948285e80 /app/scripts/lib/inpage-provider.js
parent764806d211e026226bf8003cbdd6ff3ec570d5db (diff)
downloadtangerine-wallet-browser-ad40e4d2608e0b1e329a6f9af851fbe2cc54e747.tar
tangerine-wallet-browser-ad40e4d2608e0b1e329a6f9af851fbe2cc54e747.tar.gz
tangerine-wallet-browser-ad40e4d2608e0b1e329a6f9af851fbe2cc54e747.tar.bz2
tangerine-wallet-browser-ad40e4d2608e0b1e329a6f9af851fbe2cc54e747.tar.lz
tangerine-wallet-browser-ad40e4d2608e0b1e329a6f9af851fbe2cc54e747.tar.xz
tangerine-wallet-browser-ad40e4d2608e0b1e329a6f9af851fbe2cc54e747.tar.zst
tangerine-wallet-browser-ad40e4d2608e0b1e329a6f9af851fbe2cc54e747.zip
Remove stream subprovider
Since the polling leak seems to be coming from elsewhere, and new bugs came from this, I'm rolling back this change so that we can push the other improvements sooner and fix the bug at its true root.
Diffstat (limited to 'app/scripts/lib/inpage-provider.js')
-rw-r--r--app/scripts/lib/inpage-provider.js22
1 files changed, 5 insertions, 17 deletions
diff --git a/app/scripts/lib/inpage-provider.js b/app/scripts/lib/inpage-provider.js
index 39196e240..8b8623974 100644
--- a/app/scripts/lib/inpage-provider.js
+++ b/app/scripts/lib/inpage-provider.js
@@ -1,7 +1,5 @@
const pipe = require('pump')
-const ProviderEngine = require('web3-provider-engine')
-const FilterSubprovider = require('web3-provider-engine/subproviders/filters')
-const StreamSubprovider = require('web3-provider-engine/subproviders/stream')
+const StreamProvider = require('web3-stream-provider')
const LocalStorageStore = require('obs-store')
const ObjectMultiplex = require('./obj-multiplex')
const createRandomId = require('./random-id')
@@ -29,24 +27,14 @@ function MetamaskInpageProvider (connectionStream) {
)
// connect to async provider
- const engine = new ProviderEngine()
-
- const filterSubprovider = new FilterSubprovider()
- engine.addProvider(filterSubprovider)
-
- const streamSubprovider = new StreamSubprovider()
- engine.addProvider(streamSubprovider)
-
+ const asyncProvider = self.asyncProvider = new StreamProvider()
pipe(
- streamSubprovider,
+ asyncProvider,
multiStream.createStream('provider'),
- streamSubprovider,
+ asyncProvider,
(err) => logStreamDisconnectWarning('MetaMask RpcProvider', err)
)
-
// start and stop polling to unblock first block lock
- engine.start()
- engine.once('latest', () => engine.stop())
self.idMap = {}
// handle sendAsync requests via asyncProvider
@@ -59,7 +47,7 @@ function MetamaskInpageProvider (connectionStream) {
return message
})
// forward to asyncProvider
- engine.sendAsync(request, function (err, res) {
+ asyncProvider.sendAsync(request, function (err, res) {
if (err) return cb(err)
// transform messages to original ids
eachJsonMessage(res, (message) => {