diff options
Disallow loading as metamaskNetworkId (#5924)
* transactions - throw an error if a transaction is generated while the network is loading
* add tests for failing when netId is loading
Diffstat (limited to 'app/scripts/controllers/transactions')
-rw-r--r-- | app/scripts/controllers/transactions/tx-state-manager.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/app/scripts/controllers/transactions/tx-state-manager.js b/app/scripts/controllers/transactions/tx-state-manager.js index 72d869fa8..420191d9c 100644 --- a/app/scripts/controllers/transactions/tx-state-manager.js +++ b/app/scripts/controllers/transactions/tx-state-manager.js @@ -45,11 +45,13 @@ class TransactionStateManager extends EventEmitter { @returns {txMeta} the default txMeta object */ generateTxMeta (opts) { + const netId = this.getNetwork() + if (netId === 'loading') throw new Error('MetaMask is having trouble connecting to the network') return extend({ id: createId(), time: (new Date()).getTime(), status: 'unapproved', - metamaskNetworkId: this.getNetwork(), + metamaskNetworkId: netId, loadingDefaults: true, }, opts) } |