aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorFrankie <frankie.diamond@gmail.com>2017-10-03 04:41:56 +0800
committerGitHub <noreply@github.com>2017-10-03 04:41:56 +0800
commitbf390bd63d7642d5a4975c572eb928252122a79b (patch)
tree245a50b36ef9dab402b5b87da09f39899dcf98c6 /app
parentda4b790034f599f63e3507e4394d456bd3add47c (diff)
parentd29b5f10ef5137ab56ecc9615e5e894082db9803 (diff)
downloadtangerine-wallet-browser-bf390bd63d7642d5a4975c572eb928252122a79b.tar.gz
tangerine-wallet-browser-bf390bd63d7642d5a4975c572eb928252122a79b.tar.zst
tangerine-wallet-browser-bf390bd63d7642d5a4975c572eb928252122a79b.zip
Merge pull request #2259 from MetaMask/tx-history-fix
tx state history - fix bug where initial snapshot was mutated on updateTx
Diffstat (limited to 'app')
-rw-r--r--app/scripts/lib/tx-state-history-helper.js3
-rw-r--r--app/scripts/lib/tx-state-manager.js2
2 files changed, 3 insertions, 2 deletions
diff --git a/app/scripts/lib/tx-state-history-helper.js b/app/scripts/lib/tx-state-history-helper.js
index 304069d57..5ebd78689 100644
--- a/app/scripts/lib/tx-state-history-helper.js
+++ b/app/scripts/lib/tx-state-history-helper.js
@@ -24,7 +24,8 @@ function generateHistoryEntry(previousState, newState) {
return jsonDiffer.compare(previousState, newState)
}
-function replayHistory(shortHistory) {
+function replayHistory(_shortHistory) {
+ const shortHistory = clone(_shortHistory)
return shortHistory.reduce((val, entry) => jsonDiffer.applyPatch(val, entry).newDocument)
}
diff --git a/app/scripts/lib/tx-state-manager.js b/app/scripts/lib/tx-state-manager.js
index abb9d7910..4493889bf 100644
--- a/app/scripts/lib/tx-state-manager.js
+++ b/app/scripts/lib/tx-state-manager.js
@@ -97,7 +97,7 @@ module.exports = class TransactionStateManger extends EventEmitter {
const previousState = txStateHistoryHelper.replayHistory(txMeta.history)
// generate history entry and add to history
const entry = txStateHistoryHelper.generateHistoryEntry(previousState, currentState)
- txMeta.history.push(entry)
+ txMeta.history.push(entry)
// commit txMeta to state
const txId = txMeta.id