Skip to content

Commit

Permalink
Snapshot txMeta without cloning history
Browse files Browse the repository at this point in the history
  • Loading branch information
whymarrh committed Apr 20, 2020
1 parent 5045134 commit e50f410
Showing 1 changed file with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

0 comments on commit e50f410

Please sign in to comment.