diff options
author | Maran <maran.hidskes@gmail.com> | 2014-05-14 19:57:04 +0800 |
---|---|---|
committer | Maran <maran.hidskes@gmail.com> | 2014-05-14 19:57:04 +0800 |
commit | 3ac74b1e7840720e8ae426c751328ed7595188a8 (patch) | |
tree | 8c64b6a9522cd98487ad1ad5c8d3d31c43c159ad /ethereum.go | |
parent | 0512113bdd5cc55ae35abd442b668ab5ed7a116b (diff) | |
download | go-tangerine-3ac74b1e7840720e8ae426c751328ed7595188a8.tar.gz go-tangerine-3ac74b1e7840720e8ae426c751328ed7595188a8.tar.zst go-tangerine-3ac74b1e7840720e8ae426c751328ed7595188a8.zip |
Implemented IsUpToDate to mark the node as ready to start mining
Diffstat (limited to 'ethereum.go')
-rw-r--r-- | ethereum.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/ethereum.go b/ethereum.go index 94e338c56..83a74f302 100644 --- a/ethereum.go +++ b/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 } |