x/evm: Modify the Copy function in CommitStateDB (#720)

This commit is contained in:
Pierre 2021-01-16 00:01:03 +08:00 committed by GitHub
parent 1d22f49291
commit 35bb751bac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -784,6 +784,14 @@ func CopyCommitStateDB(from, to *CommitStateDB) {
to.preimages = make([]preimageEntry, len(from.preimages)) to.preimages = make([]preimageEntry, len(from.preimages))
to.hashToPreimageIndex = make(map[ethcmn.Hash]int, len(from.hashToPreimageIndex)) to.hashToPreimageIndex = make(map[ethcmn.Hash]int, len(from.hashToPreimageIndex))
to.journal = newJournal() to.journal = newJournal()
to.thash = from.thash
to.bhash = from.bhash
to.txIndex = from.txIndex
validRevisions := make([]revision, len(from.validRevisions))
copy(validRevisions, from.validRevisions)
to.validRevisions = validRevisions
to.nextRevisionID = from.nextRevisionID
to.accessList = from.accessList.Copy()
// copy the dirty states, logs, and preimages // copy the dirty states, logs, and preimages
for _, dirty := range from.journal.dirties { for _, dirty := range from.journal.dirties {