Implement eth_syncing (#86)

* wip getting Ethereum spec syncing status

* Update sync query
This commit is contained in:
Austin Abell 2019-09-26 11:33:25 -04:00 committed by GitHub
parent 6cfeb6e754
commit 192ce2cc1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -52,8 +52,23 @@ func (e *PublicEthAPI) ProtocolVersion() hexutil.Uint {
// Syncing returns whether or not the current node is syncing with other peers. Returns false if not, or a struct // Syncing returns whether or not the current node is syncing with other peers. Returns false if not, or a struct
// outlining the state of the sync if it is. // outlining the state of the sync if it is.
func (e *PublicEthAPI) Syncing() interface{} { func (e *PublicEthAPI) Syncing() (interface{}, error) {
return false status, err := e.cliCtx.Client.Status()
if err != nil {
return false, err
}
if !status.SyncInfo.CatchingUp {
return false, nil
}
return map[string]interface{}{
// "startingBlock": nil, // NA
"currentBlock": hexutil.Uint64(status.SyncInfo.LatestBlockHeight),
// "highestBlock": nil, // NA
// "pulledStates": nil, // NA
// "knownStates": nil, // NA
}, nil
} }
// Coinbase returns this node's coinbase address. Not used in Ethermint. // Coinbase returns this node's coinbase address. Not used in Ethermint.