aboutsummaryrefslogtreecommitdiffstats
path: root/miner/miner.go
diff options
context:
space:
mode:
Diffstat (limited to 'miner/miner.go')
-rw-r--r--miner/miner.go17
1 files changed, 9 insertions, 8 deletions
diff --git a/miner/miner.go b/miner/miner.go
index 4f677cbef..6ba3b1eba 100644
--- a/miner/miner.go
+++ b/miner/miner.go
@@ -27,14 +27,15 @@ import (
"math/big"
"sort"
- "github.com/ethereum/go-ethereum"
+ "github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/ethutil"
+ "github.com/ethereum/go-ethereum/pow"
+ "github.com/ethereum/go-ethereum/pow/ezp"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/logger"
- "github.com/ethereum/go-ethereum/wire"
)
type LocalTx struct {
@@ -59,7 +60,7 @@ type Miner struct {
localTxs map[int]*LocalTx
localTxId int
- pow core.PoW
+ pow pow.PoW
quitCh chan struct{}
powQuitCh chan struct{}
@@ -74,7 +75,7 @@ func New(coinbase []byte, eth *eth.Ethereum) *Miner {
return &Miner{
eth: eth,
powQuitCh: make(chan struct{}),
- pow: &core.EasyPow{},
+ pow: ezp.New(),
mining: false,
localTxs: make(map[int]*LocalTx),
MinAcceptedGasPrice: big.NewInt(10000000000000),
@@ -82,7 +83,7 @@ func New(coinbase []byte, eth *eth.Ethereum) *Miner {
}
}
-func (self *Miner) GetPow() core.PoW {
+func (self *Miner) GetPow() pow.PoW {
return self.pow
}
@@ -215,7 +216,7 @@ func (self *Miner) mine() {
if err != nil {
minerlogger.Infoln(err)
} else {
- self.eth.Broadcast(wire.MsgBlockTy, []interface{}{block.Value().Val})
+ self.eth.EventMux().Post(core.NewMinedBlockEvent{block})
minerlogger.Infof("🔨 Mined block %x\n", block.Hash())
minerlogger.Infoln(block)
@@ -230,7 +231,7 @@ func (self *Miner) finiliseTxs() types.Transactions {
actualSize := len(self.localTxs) // See copy below
txs := make(types.Transactions, actualSize+self.eth.TxPool().Size())
- state := self.eth.BlockManager().TransState()
+ state := self.eth.ChainManager().TransState()
// XXX This has to change. Coinbase is, for new, same as key.
key := self.eth.KeyManager()
for i, ltx := range self.localTxs {
@@ -244,7 +245,7 @@ func (self *Miner) finiliseTxs() types.Transactions {
}
// Faster than append
- for _, tx := range self.eth.TxPool().CurrentTransactions() {
+ for _, tx := range self.eth.TxPool().GetTransactions() {
if tx.GasPrice.Cmp(self.MinAcceptedGasPrice) >= 0 {
txs[actualSize] = tx
actualSize++