aboutsummaryrefslogtreecommitdiff
path: root/ethclient/ethclient.go
diff options
context:
space:
mode:
authorAaron Buchwald <[email protected]>2020-11-20 09:58:28 -0500
committerAaron Buchwald <[email protected]>2020-11-20 09:58:28 -0500
commit9feab9d470278e4eecffa059b476dbf3c9417d8d (patch)
tree2dccd3942cdea2f00ae67c95ba2d26d0479f12d3 /ethclient/ethclient.go
parent9f45b425305bef793a1978070de695f3b8d9f82c (diff)
Cleanup client, mod file, and client example
Diffstat (limited to 'ethclient/ethclient.go')
-rw-r--r--ethclient/ethclient.go47
1 files changed, 24 insertions, 23 deletions
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.