diff options
author | zelig <viktor.tron@gmail.com> | 2014-12-15 02:10:48 +0800 |
---|---|---|
committer | zelig <viktor.tron@gmail.com> | 2014-12-15 04:27:06 +0800 |
commit | 118862f1ba058fa90414ab9ec6deb1ab5aac6590 (patch) | |
tree | 2bd594cc51fe7f2fa500b75b1e9cd18f14b64621 /miner | |
parent | 148de1c8757413f171dbf2fd3e8e5a5976eb7dc9 (diff) | |
download | dexon-118862f1ba058fa90414ab9ec6deb1ab5aac6590.tar.gz dexon-118862f1ba058fa90414ab9ec6deb1ab5aac6590.tar.zst dexon-118862f1ba058fa90414ab9ec6deb1ab5aac6590.zip |
adapt miner to new backend. use events to broadcast new mined blocks
Diffstat (limited to 'miner')
-rw-r--r-- | miner/miner.go | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/miner/miner.go b/miner/miner.go index dc69dddc0..6ba3b1eba 100644 --- a/miner/miner.go +++ b/miner/miner.go @@ -27,7 +27,7 @@ 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" @@ -36,7 +36,6 @@ import ( "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 { @@ -217,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) @@ -246,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++ |