mirror of
https://gitlab.com/pulsechaincom/go-pulse.git
synced 2024-12-25 12:57:17 +00:00
don't mine without transactions
This commit is contained in:
parent
ce149d2733
commit
48fd23dc10
@ -3,6 +3,7 @@ package ethminer
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"sort"
|
"sort"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/ethereum/eth-go/ethchain"
|
"github.com/ethereum/eth-go/ethchain"
|
||||||
"github.com/ethereum/eth-go/ethlog"
|
"github.com/ethereum/eth-go/ethlog"
|
||||||
@ -135,6 +136,12 @@ func (miner *Miner) listener() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
// This hack is only temporarily
|
||||||
|
if len(miner.txs) == 0 {
|
||||||
|
time.Sleep(2 * time.Second)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
miner.mineNewBlock()
|
miner.mineNewBlock()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -159,6 +166,7 @@ func (miner *Miner) Stop() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (self *Miner) mineNewBlock() {
|
func (self *Miner) mineNewBlock() {
|
||||||
|
|
||||||
stateManager := self.ethereum.StateManager()
|
stateManager := self.ethereum.StateManager()
|
||||||
|
|
||||||
self.block = self.ethereum.BlockChain().NewBlock(self.coinbase)
|
self.block = self.ethereum.BlockChain().NewBlock(self.coinbase)
|
||||||
|
Loading…
Reference in New Issue
Block a user