aboutsummaryrefslogtreecommitdiffstats
path: root/miner/miner.go
diff options
context:
space:
mode:
Diffstat (limited to 'miner/miner.go')
-rw-r--r--miner/miner.go20
1 files changed, 16 insertions, 4 deletions
diff --git a/miner/miner.go b/miner/miner.go
index cf84c11f3..aa6c059ba 100644
--- a/miner/miner.go
+++ b/miner/miner.go
@@ -6,17 +6,15 @@ import (
"github.com/ethereum/ethash"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
- "github.com/ethereum/go-ethereum/logger"
+ "github.com/ethereum/go-ethereum/core/state"
+ "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/pow"
)
-var minerlogger = logger.NewLogger("MINER")
-
type Miner struct {
worker *worker
MinAcceptedGasPrice *big.Int
- Extra string
mining bool
eth core.Backend
@@ -30,6 +28,7 @@ func New(eth core.Backend, pow pow.PoW, minerThreads int) *Miner {
for i := 0; i < minerThreads; i++ {
miner.worker.register(NewCpuMiner(i, pow))
}
+
return miner
}
@@ -44,6 +43,7 @@ func (self *Miner) Start(coinbase common.Address) {
self.pow.(*ethash.Ethash).UpdateDAG()
self.worker.start()
+
self.worker.commitNewWork()
}
@@ -61,3 +61,15 @@ func (self *Miner) Stop() {
func (self *Miner) HashRate() int64 {
return self.worker.HashRate()
}
+
+func (self *Miner) SetExtra(extra []byte) {
+ self.worker.extra = extra
+}
+
+func (self *Miner) PendingState() *state.StateDB {
+ return self.worker.pendingState()
+}
+
+func (self *Miner) PendingBlock() *types.Block {
+ return self.worker.pendingBlock()
+}