aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/controllers/transactions/index.js
diff options
context:
space:
mode:
authorWhymarrh Whitby <whymarrh.whitby@gmail.com>2018-10-11 03:11:17 +0800
committerGitHub <noreply@github.com>2018-10-11 03:11:17 +0800
commit89ef54992622c1cda90477e41ddac9affc8bec73 (patch)
tree4183d10001a1c452d05dfd647e1fa07f66799f1b /app/scripts/controllers/transactions/index.js
parent3d0ba46f21045a08fb0196e6a6b9cdb713031e0d (diff)
parentaf43b7d6c97e10018e564ce8ee37bc9ad380234c (diff)
downloadtangerine-wallet-browser-89ef54992622c1cda90477e41ddac9affc8bec73.tar.gz
tangerine-wallet-browser-89ef54992622c1cda90477e41ddac9affc8bec73.tar.zst
tangerine-wallet-browser-89ef54992622c1cda90477e41ddac9affc8bec73.zip
Merge pull request #5491 from whymarrh/assert-new-tx-using-selected-address
Ensure that new transactions added are using the selected address
Diffstat (limited to 'app/scripts/controllers/transactions/index.js')
-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({