tx controller - tx state history various small fixes

feature/default_network_editable
kumavis 7 years ago
parent fec0f2ca5e
commit 1af797b1b3
  1. 1
      app/scripts/controllers/transactions.js
  2. 2
      app/scripts/lib/tx-state-history-helper.js
  3. 2
      app/scripts/migrations/018.js
  4. 2
      test/unit/tx-state-history-helper.js
  5. 13634
      xyz.json

@ -1,6 +1,5 @@
const EventEmitter = require('events')
const extend = require('xtend')
const clone = require('clone')
const ObservableStore = require('obs-store')
const ethUtil = require('ethereumjs-util')
const EthQuery = require('ethjs-query')

@ -15,7 +15,7 @@ function migrateFromSnapshotsToDiffs(longHistory) {
// convert non-initial history entries into diffs
.map((entry, index) => {
if (index === 0) return entry
return generateHistoryEntry(longHistory[index-1], entry)
return generateHistoryEntry(longHistory[index - 1], entry)
})
)
}

@ -32,7 +32,7 @@ function transformState (state) {
const transactions = newState.TransactionController.transactions
newState.TransactionController.transactions = transactions.map((txMeta) => {
// no history: initialize
if (!txMeta.history || tx.history.length === 0) {
if (!txMeta.history || txMeta.history.length === 0) {
const snapshot = txStateHistoryHelper.snapshotFromTxMeta(txMeta)
txMeta.history = [snapshot]
return txMeta

@ -3,7 +3,7 @@ const txStateHistoryHelper = require('../../app/scripts/lib/tx-state-history-hel
const testVault = require('../data/v17-long-history.json')
describe('history-differ', function () {
describe('tx-state-history-helper', function () {
it('migrates history to diffs and can recover original values', function () {
testVault.data.TransactionController.transactions.forEach((tx, index) => {
const newHistory = txStateHistoryHelper.migrateFromSnapshotsToDiffs(tx.history)

13634
xyz.json

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save