Merge pull request #598 from jbhurat/miner-setcoinbase

Prevent deadlock when miner.setEtherbase is called for Istanbul consensus
This commit is contained in:
Samer Falah 2018-12-13 15:19:45 -05:00 committed by GitHub
commit 004dd53a68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -356,12 +356,13 @@ func (s *Ethereum) Etherbase() (eb common.Address, err error) {
// set in js console via admin interface or wrapper from cli flags
func (s *Ethereum) SetEtherbase(etherbase common.Address) {
s.lock.Lock()
defer s.lock.Unlock()
if _, ok := s.engine.(consensus.Istanbul); ok {
log.Error("Cannot set etherbase in Istanbul consensus")
return
}
s.etherbase = etherbase
s.lock.Unlock()
s.miner.SetEtherbase(etherbase)
}