aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/api/eth.go
diff options
context:
space:
mode:
Diffstat (limited to 'rpc/api/eth.go')
-rw-r--r--rpc/api/eth.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/rpc/api/eth.go b/rpc/api/eth.go
index a93e41157..9680536c6 100644
--- a/rpc/api/eth.go
+++ b/rpc/api/eth.go
@@ -55,6 +55,7 @@ var (
"eth_protocolVersion": (*ethApi).ProtocolVersion,
"eth_coinbase": (*ethApi).Coinbase,
"eth_mining": (*ethApi).IsMining,
+ "eth_syncing": (*ethApi).IsSyncing,
"eth_gasPrice": (*ethApi).GasPrice,
"eth_getStorage": (*ethApi).GetStorage,
"eth_storageAt": (*ethApi).GetStorage,
@@ -166,6 +167,20 @@ func (self *ethApi) IsMining(req *shared.Request) (interface{}, error) {
return self.xeth.IsMining(), nil
}
+func (self *ethApi) IsSyncing(req *shared.Request) (interface{}, error) {
+ current := self.ethereum.ChainManager().CurrentBlock().NumberU64()
+ origin, height := self.ethereum.Downloader().Boundaries()
+
+ if current < height {
+ return map[string]interface{}{
+ "startingBlock": origin,
+ "currentBlock": current,
+ "highestBlock": height,
+ }, nil
+ }
+ return false, nil
+}
+
func (self *ethApi) GasPrice(req *shared.Request) (interface{}, error) {
return newHexNum(self.xeth.DefaultGasPrice().Bytes()), nil
}