aboutsummaryrefslogtreecommitdiffstats
path: root/ethereum.go
diff options
context:
space:
mode:
authorMaran <maran.hidskes@gmail.com>2014-05-14 19:57:04 +0800
committerMaran <maran.hidskes@gmail.com>2014-05-14 19:57:04 +0800
commit3ac74b1e7840720e8ae426c751328ed7595188a8 (patch)
tree8c64b6a9522cd98487ad1ad5c8d3d31c43c159ad /ethereum.go
parent0512113bdd5cc55ae35abd442b668ab5ed7a116b (diff)
downloaddexon-3ac74b1e7840720e8ae426c751328ed7595188a8.tar
dexon-3ac74b1e7840720e8ae426c751328ed7595188a8.tar.gz
dexon-3ac74b1e7840720e8ae426c751328ed7595188a8.tar.bz2
dexon-3ac74b1e7840720e8ae426c751328ed7595188a8.tar.lz
dexon-3ac74b1e7840720e8ae426c751328ed7595188a8.tar.xz
dexon-3ac74b1e7840720e8ae426c751328ed7595188a8.tar.zst
dexon-3ac74b1e7840720e8ae426c751328ed7595188a8.zip
Implemented IsUpToDate to mark the node as ready to start mining
Diffstat (limited to 'ethereum.go')
-rw-r--r--ethereum.go12
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
}