Merge pull request #1829 from MetaMask/betterErrorsOnTx

cleanup logState log and tx history
feature/default_network_editable
Dan Finlay 7 years ago committed by GitHub
commit 0deb617d8f
  1. 12
      app/scripts/controllers/transactions.js
  2. 1
      ui/app/reducers.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')

@ -43,7 +43,6 @@ function rootReducer (state, action) {
window.logState = function () {
var stateString = JSON.stringify(window.METAMASK_CACHED_LOG_STATE, removeSeedWords, 2)
console.log(stateString)
return stateString
}

Loading…
Cancel
Save