From 48fd23dc107c06aea63e75a7a07612a5f10b1dd0 Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 23 Sep 2014 10:20:55 +0200 Subject: [PATCH] don't mine without transactions --- ethminer/miner.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ethminer/miner.go b/ethminer/miner.go index 083d9ecde..b74f90e0c 100644 --- a/ethminer/miner.go +++ b/ethminer/miner.go @@ -3,6 +3,7 @@ package ethminer import ( "bytes" "sort" + "time" "github.com/ethereum/eth-go/ethchain" "github.com/ethereum/eth-go/ethlog" @@ -135,6 +136,12 @@ func (miner *Miner) listener() { } } default: + // This hack is only temporarily + if len(miner.txs) == 0 { + time.Sleep(2 * time.Second) + continue + } + miner.mineNewBlock() } } @@ -159,6 +166,7 @@ func (miner *Miner) Stop() { } func (self *Miner) mineNewBlock() { + stateManager := self.ethereum.StateManager() self.block = self.ethereum.BlockChain().NewBlock(self.coinbase)