From 9feab9d470278e4eecffa059b476dbf3c9417d8d Mon Sep 17 00:00:00 2001 From: Aaron Buchwald Date: Fri, 20 Nov 2020 09:58:28 -0500 Subject: Cleanup client, mod file, and client example --- ethclient/ethclient.go | 47 ++++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 23 deletions(-) (limited to 'ethclient') diff --git a/ethclient/ethclient.go b/ethclient/ethclient.go index f7e56da..ed02182 100644 --- a/ethclient/ethclient.go +++ b/ethclient/ethclient.go @@ -24,10 +24,10 @@ import ( "fmt" "math/big" + "github.com/ava-labs/avalanchego/ids" "github.com/ava-labs/coreth" "github.com/ava-labs/coreth/core/types" "github.com/ava-labs/coreth/rpc" - "github.com/ava-labs/gecko/ids" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/rlp" @@ -324,28 +324,29 @@ type rpcProgress struct { // SyncProgress retrieves the current progress of the sync algorithm. If there's // no sync currently running, it returns nil. -func (ec *Client) SyncProgress(ctx context.Context) (*coreth.SyncProgress, error) { - var raw json.RawMessage - if err := ec.c.CallContext(ctx, &raw, "eth_syncing"); err != nil { - return nil, err - } - // Handle the possible response types - var syncing bool - if err := json.Unmarshal(raw, &syncing); err == nil { - return nil, nil // Not syncing (always false) - } - var progress *rpcProgress - if err := json.Unmarshal(raw, &progress); err != nil { - return nil, err - } - return &coreth.SyncProgress{ - StartingBlock: uint64(progress.StartingBlock), - CurrentBlock: uint64(progress.CurrentBlock), - HighestBlock: uint64(progress.HighestBlock), - PulledStates: uint64(progress.PulledStates), - KnownStates: uint64(progress.KnownStates), - }, nil -} +// eth_syncing is not implemented in Coreth +// func (ec *Client) SyncProgress(ctx context.Context) (*coreth.SyncProgress, error) { +// var raw json.RawMessage +// if err := ec.c.CallContext(ctx, &raw, "eth_syncing"); err != nil { +// return nil, err +// } +// // Handle the possible response types +// var syncing bool +// if err := json.Unmarshal(raw, &syncing); err == nil { +// return nil, nil // Not syncing (always false) +// } +// var progress *rpcProgress +// if err := json.Unmarshal(raw, &progress); err != nil { +// return nil, err +// } +// return &coreth.SyncProgress{ +// StartingBlock: uint64(progress.StartingBlock), +// CurrentBlock: uint64(progress.CurrentBlock), +// HighestBlock: uint64(progress.HighestBlock), +// PulledStates: uint64(progress.PulledStates), +// KnownStates: uint64(progress.KnownStates), +// }, nil +// } // SubscribeNewHead subscribes to notifications about the current blockchain head // on the given channel. -- cgit v1.2.3