aboutsummaryrefslogtreecommitdiffstats
path: root/miner/worker.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2017-01-05 21:03:50 +0800
committerFelix Lange <fjl@twurst.com>2017-01-06 21:15:22 +0800
commit7731061903bb992f7630ab389863951efb360258 (patch)
treeea706da87ce002a631cba30b171cb44dbdd7c2c6 /miner/worker.go
parentb9683d3748dcb73ab5a5474334eaf157267d9c4a (diff)
downloaddexon-7731061903bb992f7630ab389863951efb360258.tar.gz
dexon-7731061903bb992f7630ab389863951efb360258.tar.zst
dexon-7731061903bb992f7630ab389863951efb360258.zip
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.
Diffstat (limited to 'miner/worker.go')
-rw-r--r--miner/worker.go12
1 files changed, 6 insertions, 6 deletions
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{})