aboutsummaryrefslogtreecommitdiff
path: root/miner/miner.go
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2019-08-09 21:15:05 -0400
committerDeterminant <[email protected]>2019-08-09 21:15:05 -0400
commit4c1616a746a648c816042f596eb199174a9858f1 (patch)
tree8db0871957d3a3357ab1ec7bf762ad7481bbd380 /miner/miner.go
parent6310b748db9fbcea0872db930385760b29f9659c (diff)
add necessary code base
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()
+}