aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/controllers
diff options
context:
space:
mode:
authorWhymarrh Whitby <whymarrh.whitby@gmail.com>2018-10-11 02:41:17 +0800
committerWhymarrh Whitby <whymarrh.whitby@gmail.com>2018-10-11 02:46:20 +0800
commitaf43b7d6c97e10018e564ce8ee37bc9ad380234c (patch)
tree4183d10001a1c452d05dfd647e1fa07f66799f1b /app/scripts/controllers
parent3d0ba46f21045a08fb0196e6a6b9cdb713031e0d (diff)
downloadtangerine-wallet-browser-af43b7d6c97e10018e564ce8ee37bc9ad380234c.tar
tangerine-wallet-browser-af43b7d6c97e10018e564ce8ee37bc9ad380234c.tar.gz
tangerine-wallet-browser-af43b7d6c97e10018e564ce8ee37bc9ad380234c.tar.bz2
tangerine-wallet-browser-af43b7d6c97e10018e564ce8ee37bc9ad380234c.tar.lz
tangerine-wallet-browser-af43b7d6c97e10018e564ce8ee37bc9ad380234c.tar.xz
tangerine-wallet-browser-af43b7d6c97e10018e564ce8ee37bc9ad380234c.tar.zst
tangerine-wallet-browser-af43b7d6c97e10018e564ce8ee37bc9ad380234c.zip
Ensure that new transactions added are using the selected address
Diffstat (limited to 'app/scripts/controllers')
-rw-r--r--app/scripts/controllers/transactions/index.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/scripts/controllers/transactions/index.js b/app/scripts/controllers/transactions/index.js
index ebd49f882..a57c85f50 100644
--- a/app/scripts/controllers/transactions/index.js
+++ b/app/scripts/controllers/transactions/index.js
@@ -166,6 +166,10 @@ class TransactionController extends EventEmitter {
async addUnapprovedTransaction (txParams) {
// validate
const normalizedTxParams = txUtils.normalizeTxParams(txParams)
+ // Assert the from address is the selected address
+ if (normalizedTxParams.from !== this.getSelectedAddress()) {
+ throw new Error(`Transaction from address isn't valid for this account`)
+ }
txUtils.validateTxParams(normalizedTxParams)
// construct txMeta
let txMeta = this.txStateManager.generateTxMeta({