forked from cerc-io/plugeth
Implemented IsUpToDate to mark the node as ready to start mining
This commit is contained in:
parent
0512113bdd
commit
3ac74b1e78
12
ethereum.go
12
ethereum.go
@ -138,6 +138,18 @@ func (s *Ethereum) IsMining() bool {
|
||||
func (s *Ethereum) PeerCount() int {
|
||||
return s.peers.Len()
|
||||
}
|
||||
func (s *Ethereum) IsUpToDate() bool {
|
||||
upToDate := true
|
||||
eachPeer(s.peers, func(peer *Peer, e *list.Element) {
|
||||
if atomic.LoadInt32(&peer.connected) == 1 {
|
||||
if peer.catchingUp == true {
|
||||
upToDate = false
|
||||
}
|
||||
}
|
||||
})
|
||||
return upToDate
|
||||
}
|
||||
|
||||
func (s *Ethereum) IsListening() bool {
|
||||
return s.listening
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user