aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/controllers/transactions.js
diff options
context:
space:
mode:
authorDan Finlay <flyswatter@users.noreply.github.com>2017-07-27 02:07:01 +0800
committerGitHub <noreply@github.com>2017-07-27 02:07:01 +0800
commit0deb617d8f879b9a05c4581f16f5790cafa9789a (patch)
tree472d5958de33d248adf4a859fc138c636123043c /app/scripts/controllers/transactions.js
parentbbeecbbb2892b2bc5a7e675b03a5fc5736d34287 (diff)
parent7e2e4948a6ce5856338406de49cbad6a9931d72b (diff)
downloadtangerine-wallet-browser-0deb617d8f879b9a05c4581f16f5790cafa9789a.tar
tangerine-wallet-browser-0deb617d8f879b9a05c4581f16f5790cafa9789a.tar.gz
tangerine-wallet-browser-0deb617d8f879b9a05c4581f16f5790cafa9789a.tar.bz2
tangerine-wallet-browser-0deb617d8f879b9a05c4581f16f5790cafa9789a.tar.lz
tangerine-wallet-browser-0deb617d8f879b9a05c4581f16f5790cafa9789a.tar.xz
tangerine-wallet-browser-0deb617d8f879b9a05c4581f16f5790cafa9789a.tar.zst
tangerine-wallet-browser-0deb617d8f879b9a05c4581f16f5790cafa9789a.zip
Merge pull request #1829 from MetaMask/betterErrorsOnTx
cleanup logState log and tx history
Diffstat (limited to 'app/scripts/controllers/transactions.js')
-rw-r--r--app/scripts/controllers/transactions.js12
1 files changed, 9 insertions, 3 deletions
diff --git a/app/scripts/controllers/transactions.js b/app/scripts/controllers/transactions.js
index d6b2b555e..8f53ffa8c 100644
--- a/app/scripts/controllers/transactions.js
+++ b/app/scripts/controllers/transactions.js
@@ -119,14 +119,20 @@ module.exports = class TransactionController extends EventEmitter {
//
updateTx (txMeta) {
+ // create txMeta snapshot for history
const txMetaForHistory = clone(txMeta)
+ // dont include previous history in this snapshot
+ delete txMetaForHistory.history
+ // add stack to help understand why tx was updated
txMetaForHistory.stack = getStack()
- var txId = txMeta.id
- var txList = this.getFullTxList()
- var index = txList.findIndex(txData => txData.id === txId)
+ // add snapshot to tx history
if (!txMeta.history) txMeta.history = []
txMeta.history.push(txMetaForHistory)
+ // update the tx
+ var txId = txMeta.id
+ var txList = this.getFullTxList()
+ var index = txList.findIndex(txData => txData.id === txId)
txList[index] = txMeta
this._saveTxList(txList)
this.emit('update')