aboutsummaryrefslogtreecommitdiff
path: root/miner/miner.go
diff options
context:
space:
mode:
Diffstat (limited to 'miner/miner.go')
-rw-r--r--miner/miner.go51
1 files changed, 51 insertions, 0 deletions
diff --git a/miner/miner.go b/miner/miner.go
new file mode 100644
index 0000000..b342bb8
--- /dev/null
+++ b/miner/miner.go
@@ -0,0 +1,51 @@
+// Copyright 2014 The go-ethereum Authors
+// This file is part of the go-ethereum library.
+//
+// The go-ethereum library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// The go-ethereum library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
+
+// Package miner implements Ethereum block creation and mining.
+package miner
+
+import (
+
+ "github.com/ethereum/go-ethereum/core"
+ "github.com/ethereum/go-ethereum/core/types"
+ "github.com/ethereum/go-ethereum/event"
+ "github.com/ethereum/go-ethereum/consensus"
+ "github.com/ethereum/go-ethereum/params"
+ eminer "github.com/ethereum/go-ethereum/miner"
+)
+
+// Backend wraps all methods required for mining.
+type Backend interface {
+ BlockChain() *core.BlockChain
+ TxPool() *core.TxPool
+}
+
+// Config is the configuration parameters of mining.
+type Config = eminer.Config
+
+type Worker = worker
+
+func NewWorker(config *Config, chainConfig *params.ChainConfig, engine consensus.Engine, eth Backend, mux *event.TypeMux, isLocalBlock func(*types.Block) bool) *Worker {
+ return newWorker(config, chainConfig, engine, eth, mux, isLocalBlock)
+}
+
+func (self *Worker) Start() {
+ self.start()
+}
+
+func (self *Worker) Stop() {
+ self.stop()
+}