From 7731061903bb992f7630ab389863951efb360258 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Thu, 5 Jan 2017 14:03:50 +0100 Subject: 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. --- miner/worker.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'miner') diff --git a/miner/worker.go b/miner/worker.go index 3ae51d120..adb224c47 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -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{}) -- cgit v1.2.3