Skip to content

Commit f0c67a8

Browse files
authored
Merge pull request #2228 from CortexFoundation/dev
remove precacheTransaction
2 parents 7fee353 + 6bc9faa commit f0c67a8

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

core/state_prefetcher.go

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,10 @@ func (p *statePrefetcher) Prefetch(block *types.Block, statedb *state.StateDB, c
7272
return // Also invalid block, bail out
7373
}
7474
statedb.SetTxContext(tx.Hash(), i)
75-
if err := precacheTransaction(msg, p.config, gaspool, quotaPool, statedb, header, cvm); err != nil {
75+
76+
// We attempt to apply a transaction. The goal is not to execute
77+
// the transaction successfully, rather to warm up touched data slots.
78+
if _, err := ApplyMessage(cvm, msg, gaspool, quotaPool); err != nil {
7679
return // Ugh, something went horribly wrong, bail out
7780
}
7881
// If we're pre-byzantium, pre-load trie nodes for the intermediate root
@@ -85,13 +88,3 @@ func (p *statePrefetcher) Prefetch(block *types.Block, statedb *state.StateDB, c
8588
statedb.IntermediateRoot(true)
8689
}
8790
}
88-
89-
// precacheTransaction attempts to apply a transaction to the given state database
90-
// and uses the input parameters for its environment. The goal is not to execute
91-
// the transaction successfully, rather to warm up touched data slots.
92-
func precacheTransaction(msg *Message, config *params.ChainConfig, gaspool *GasPool, quotaPool *QuotaPool, statedb *state.StateDB, header *types.Header, cvm *vm.CVM) error {
93-
cvm.Reset(NewCVMTxContext(msg), statedb)
94-
95-
_, err := ApplyMessage(cvm, msg, gaspool, quotaPool)
96-
return err
97-
}

0 commit comments

Comments
 (0)