core/vm: move Log to core/types
This significantly reduces the dependency closure of ethclient, which no longer depends on core/vm as of this change. All uses of vm.Logs are replaced by []*types.Log. NewLog is gone too, the constructor simply returned a literal.
This commit is contained in:
@ -327,7 +327,7 @@ func (self *worker) wait() {
|
||||
}
|
||||
|
||||
// broadcast before waiting for validation
|
||||
go func(block *types.Block, logs vm.Logs, receipts []*types.Receipt) {
|
||||
go func(block *types.Block, logs []*types.Log, receipts []*types.Receipt) {
|
||||
self.mux.Post(core.NewMinedBlockEvent{Block: block})
|
||||
self.mux.Post(core.ChainEvent{Block: block, Hash: block.Hash(), Logs: logs})
|
||||
|
||||
@ -537,7 +537,7 @@ func (self *worker) commitUncle(work *Work, uncle *types.Header) error {
|
||||
func (env *Work) commitTransactions(mux *event.TypeMux, txs *types.TransactionsByPriceAndNonce, gasPrice *big.Int, bc *core.BlockChain) {
|
||||
gp := new(core.GasPool).AddGas(env.header.GasLimit)
|
||||
|
||||
var coalescedLogs vm.Logs
|
||||
var coalescedLogs []*types.Log
|
||||
|
||||
for {
|
||||
// Retrieve the next transaction and abort if all done
|
||||
@ -597,12 +597,12 @@ func (env *Work) commitTransactions(mux *event.TypeMux, txs *types.TransactionsB
|
||||
// make a copy, the state caches the logs and these logs get "upgraded" from pending to mined
|
||||
// logs by filling in the block hash when the block was mined by the local miner. This can
|
||||
// cause a race condition if a log was "upgraded" before the PendingLogsEvent is processed.
|
||||
cpy := make(vm.Logs, len(coalescedLogs))
|
||||
cpy := make([]*types.Log, len(coalescedLogs))
|
||||
for i, l := range coalescedLogs {
|
||||
cpy[i] = new(vm.Log)
|
||||
cpy[i] = new(types.Log)
|
||||
*cpy[i] = *l
|
||||
}
|
||||
go func(logs vm.Logs, tcount int) {
|
||||
go func(logs []*types.Log, tcount int) {
|
||||
if len(logs) > 0 {
|
||||
mux.Post(core.PendingLogsEvent{Logs: logs})
|
||||
}
|
||||
@ -613,7 +613,7 @@ func (env *Work) commitTransactions(mux *event.TypeMux, txs *types.TransactionsB
|
||||
}
|
||||
}
|
||||
|
||||
func (env *Work) commitTransaction(tx *types.Transaction, bc *core.BlockChain, gp *core.GasPool) (error, vm.Logs) {
|
||||
func (env *Work) commitTransaction(tx *types.Transaction, bc *core.BlockChain, gp *core.GasPool) (error, []*types.Log) {
|
||||
snap := env.state.Snapshot()
|
||||
|
||||
receipt, _, err := core.ApplyTransaction(env.config, bc, gp, env.state, env.header, tx, env.header.GasUsed, vm.Config{})
|
||||
|
Reference in New Issue
Block a user