From 4c1616a746a648c816042f596eb199174a9858f1 Mon Sep 17 00:00:00 2001 From: Determinant Date: Fri, 9 Aug 2019 21:15:05 -0400 Subject: add necessary code base --- miner/miner.go | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 miner/miner.go (limited to 'miner/miner.go') 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 . + +// 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() +} -- cgit v1.2.3-70-g09d2