aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/controllers
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2018-07-03 04:54:05 +0800
committerkumavis <aaron@kumavis.me>2018-07-03 04:54:05 +0800
commita89902c1701f2dcc41effc06d2315e515946b2ca (patch)
tree922408cf99bcca97c956d5860ac80c2c0c472ecc /app/scripts/controllers
parent055346843bc90a5168151ba2adc9deacedf8afd4 (diff)
parent4c86f25f5bc4fa18847ca1b77e005afc3f37eddc (diff)
downloadtangerine-wallet-browser-a89902c1701f2dcc41effc06d2315e515946b2ca.tar
tangerine-wallet-browser-a89902c1701f2dcc41effc06d2315e515946b2ca.tar.gz
tangerine-wallet-browser-a89902c1701f2dcc41effc06d2315e515946b2ca.tar.bz2
tangerine-wallet-browser-a89902c1701f2dcc41effc06d2315e515946b2ca.tar.lz
tangerine-wallet-browser-a89902c1701f2dcc41effc06d2315e515946b2ca.tar.xz
tangerine-wallet-browser-a89902c1701f2dcc41effc06d2315e515946b2ca.tar.zst
tangerine-wallet-browser-a89902c1701f2dcc41effc06d2315e515946b2ca.zip
Merge branch 'develop' of github.com:MetaMask/metamask-extension into network-remove-provider-engine
Diffstat (limited to 'app/scripts/controllers')
-rw-r--r--app/scripts/controllers/network/network.js11
-rw-r--r--app/scripts/controllers/transactions/index.js9
-rw-r--r--app/scripts/controllers/transactions/lib/recipient-blacklist-checker.js2
-rw-r--r--app/scripts/controllers/transactions/lib/recipient-blacklist-config.json14
-rw-r--r--app/scripts/controllers/transactions/lib/recipient-blacklist.js17
-rw-r--r--app/scripts/controllers/transactions/nonce-tracker.js4
6 files changed, 36 insertions, 21 deletions
diff --git a/app/scripts/controllers/network/network.js b/app/scripts/controllers/network/network.js
index 9e622981b..628e32fa4 100644
--- a/app/scripts/controllers/network/network.js
+++ b/app/scripts/controllers/network/network.js
@@ -98,14 +98,21 @@ module.exports = class NetworkController extends EventEmitter {
type: 'rpc',
rpcTarget,
}
- this.providerStore.updateState(providerConfig)
- this._switchNetwork(providerConfig)
+ this.providerConfig = providerConfig
}
async setProviderType (type) {
assert.notEqual(type, 'rpc', `NetworkController - cannot call "setProviderType" with type 'rpc'. use "setRpcTarget"`)
assert(INFURA_PROVIDER_TYPES.includes(type) || type === LOCALHOST, `NetworkController - Unknown rpc type "${type}"`)
const providerConfig = { type }
+ this.providerConfig = providerConfig
+ }
+
+ resetConnection () {
+ this.providerConfig = this.getProviderConfig()
+ }
+
+ set providerConfig (providerConfig) {
this.providerStore.updateState(providerConfig)
this._switchNetwork(providerConfig)
}
diff --git a/app/scripts/controllers/transactions/index.js b/app/scripts/controllers/transactions/index.js
index c270be294..6884bbc49 100644
--- a/app/scripts/controllers/transactions/index.js
+++ b/app/scripts/controllers/transactions/index.js
@@ -170,7 +170,7 @@ class TransactionController extends EventEmitter {
// add default tx params
txMeta = await this.addTxGasDefaults(txMeta)
} catch (error) {
- console.log(error)
+ log.warn(error)
this.txStateManager.setTxStatusFailed(txMeta.id, error)
throw error
}
@@ -269,7 +269,12 @@ class TransactionController extends EventEmitter {
// must set transaction to submitted/failed before releasing lock
nonceLock.releaseLock()
} catch (err) {
- this.txStateManager.setTxStatusFailed(txId, err)
+ // this is try-catch wrapped so that we can guarantee that the nonceLock is released
+ try {
+ this.txStateManager.setTxStatusFailed(txId, err)
+ } catch (err) {
+ log.error(err)
+ }
// must set transaction to submitted/failed before releasing lock
if (nonceLock) nonceLock.releaseLock()
// continue with error chain
diff --git a/app/scripts/controllers/transactions/lib/recipient-blacklist-checker.js b/app/scripts/controllers/transactions/lib/recipient-blacklist-checker.js
index 84c6df1f0..e4df2367e 100644
--- a/app/scripts/controllers/transactions/lib/recipient-blacklist-checker.js
+++ b/app/scripts/controllers/transactions/lib/recipient-blacklist-checker.js
@@ -1,4 +1,4 @@
-const Config = require('./recipient-blacklist-config.json')
+const Config = require('./recipient-blacklist.js')
/** @module*/
module.exports = {
diff --git a/app/scripts/controllers/transactions/lib/recipient-blacklist-config.json b/app/scripts/controllers/transactions/lib/recipient-blacklist-config.json
deleted file mode 100644
index b348eb72e..000000000
--- a/app/scripts/controllers/transactions/lib/recipient-blacklist-config.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "blacklist": [
- "0x627306090abab3a6e1400e9345bc60c78a8bef57",
- "0xf17f52151ebef6c7334fad080c5704d77216b732",
- "0xc5fdf4076b8f3a5357c5e395ab970b5b54098fef",
- "0x821aea9a577a9b44299b9c15c88cf3087f3b5544",
- "0x0d1d4e623d10f9fba5db95830f7d3839406c6af2",
- "0x2932b7a2355d6fecc4b5c0b6bd44cc31df247a2e",
- "0x2191ef87e392377ec08e7c08eb105ef5448eced5",
- "0x0f4f2ac550a1b4e2280d04c21cea7ebd822934b5",
- "0x6330a553fc93768f612722bb8c2ec78ac90b3bbc",
- "0x5aeda56215b167893e80b4fe645ba6d5bab767de"
- ]
-}
diff --git a/app/scripts/controllers/transactions/lib/recipient-blacklist.js b/app/scripts/controllers/transactions/lib/recipient-blacklist.js
new file mode 100644
index 000000000..08e1a2ccd
--- /dev/null
+++ b/app/scripts/controllers/transactions/lib/recipient-blacklist.js
@@ -0,0 +1,17 @@
+module.exports = {
+ 'blacklist': [
+ // IDEX phisher
+ '0x9bcb0A9d99d815Bb87ee3191b1399b1Bcc46dc77',
+ // Ganache default seed phrases
+ '0x627306090abab3a6e1400e9345bc60c78a8bef57',
+ '0xf17f52151ebef6c7334fad080c5704d77216b732',
+ '0xc5fdf4076b8f3a5357c5e395ab970b5b54098fef',
+ '0x821aea9a577a9b44299b9c15c88cf3087f3b5544',
+ '0x0d1d4e623d10f9fba5db95830f7d3839406c6af2',
+ '0x2932b7a2355d6fecc4b5c0b6bd44cc31df247a2e',
+ '0x2191ef87e392377ec08e7c08eb105ef5448eced5',
+ '0x0f4f2ac550a1b4e2280d04c21cea7ebd822934b5',
+ '0x6330a553fc93768f612722bb8c2ec78ac90b3bbc',
+ '0x5aeda56215b167893e80b4fe645ba6d5bab767de',
+ ],
+}
diff --git a/app/scripts/controllers/transactions/nonce-tracker.js b/app/scripts/controllers/transactions/nonce-tracker.js
index 14581c998..a27568843 100644
--- a/app/scripts/controllers/transactions/nonce-tracker.js
+++ b/app/scripts/controllers/transactions/nonce-tracker.js
@@ -83,8 +83,8 @@ class NonceTracker {
async _globalMutexFree () {
const globalMutex = this._lookupMutex('global')
- const release = await globalMutex.acquire()
- release()
+ const releaseLock = await globalMutex.acquire()
+ releaseLock()
}
async _takeMutex (lockId) {