diff options
author | Csaba Solya <csaba.solya@gmail.com> | 2018-05-30 23:38:27 +0800 |
---|---|---|
committer | Csaba Solya <csaba.solya@gmail.com> | 2018-05-30 23:38:27 +0800 |
commit | cf73581c0e1a90371fb23eb05318ce39027325b5 (patch) | |
tree | 88ebf759c5261ba74a40a2b748a03eb610a408a1 /app/scripts/controllers/transactions | |
parent | 6affd8f9492e04cdc81007e4f5390e4faa56499d (diff) | |
download | tangerine-wallet-browser-cf73581c0e1a90371fb23eb05318ce39027325b5.tar.gz tangerine-wallet-browser-cf73581c0e1a90371fb23eb05318ce39027325b5.tar.zst tangerine-wallet-browser-cf73581c0e1a90371fb23eb05318ce39027325b5.zip |
adding tests for recipient blacklist checker
Diffstat (limited to 'app/scripts/controllers/transactions')
-rw-r--r-- | app/scripts/controllers/transactions/index.js | 4 | ||||
-rw-r--r-- | app/scripts/controllers/transactions/lib/recipient-blacklist-checker.js | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/app/scripts/controllers/transactions/index.js b/app/scripts/controllers/transactions/index.js index 3d6f5beb5..16f7291d6 100644 --- a/app/scripts/controllers/transactions/index.js +++ b/app/scripts/controllers/transactions/index.js @@ -10,7 +10,7 @@ const NonceTracker = require('./nonce-tracker') const txUtils = require('./lib/util') const cleanErrorStack = require('../../lib/cleanErrorStack') const log = require('loglevel') -const recipientBlackListChecker = require('./lib/recipient-blacklist-checker') +const recipientBlacklistChecker = require('./lib/recipient-blacklist-checker') /** Transaction Controller is an aggregate of sub-controllers and trackers @@ -161,7 +161,7 @@ class TransactionController extends EventEmitter { try { // check whether recipient account is public - await recipientBlackListChecker.checkAccount(txMeta.metamaskNetworkId, normalizedTxParams.to) + await recipientBlacklistChecker.checkAccount(txMeta.metamaskNetworkId, normalizedTxParams.to) // add default tx params txMeta = await this.addTxGasDefaults(txMeta) } catch (error) { diff --git a/app/scripts/controllers/transactions/lib/recipient-blacklist-checker.js b/app/scripts/controllers/transactions/lib/recipient-blacklist-checker.js index c52e58863..414302d12 100644 --- a/app/scripts/controllers/transactions/lib/recipient-blacklist-checker.js +++ b/app/scripts/controllers/transactions/lib/recipient-blacklist-checker.js @@ -12,8 +12,8 @@ module.exports = { */ async function checkAccount (networkId, account) { - // mainnet's network id === 1 - if (networkId !== 1) { + const mainnetId = 1 + if (networkId !== mainnetId) { return } @@ -33,4 +33,4 @@ async function checkAccount (networkId, account) { throw new Error('Recipient is a public account') } } -}
\ No newline at end of file +} |