1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Snapshot txMeta without cloning history (#8363)

This commit is contained in:
Whymarrh Whitby 2020-04-20 12:26:01 -02:30 committed by GitHub
parent 7c3ffeb841
commit a83d26486c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -62,13 +62,12 @@ function replayHistory (_shortHistory) {
}
/**
@param {Object} txMeta
@returns {Object} - a clone object of the txMeta with out history
*/
* Snapshot {@code txMeta}
* @param {Object} txMeta - the tx metadata object
* @returns {Object} a deep clone without history
*/
function snapshotFromTxMeta (txMeta) {
// create txMeta snapshot for history
const snapshot = cloneDeep(txMeta)
// dont include previous history in this snapshot
delete snapshot.history
return snapshot
const shallow = { ...txMeta }
delete shallow.history
return cloneDeep(shallow)
}