blob: b342bb83bbc0fe83d2ee6778fe02ff9864ded5f8 (
plain) (
tree)
|
|
// 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()
}
|