diff options
author | Péter Szilágyi <peterke@gmail.com> | 2016-09-06 17:39:14 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2016-09-06 18:41:43 +0800 |
commit | 2924fdfcf7ab67a66a4ed3fb95cb9140be0cc809 (patch) | |
tree | 8ff6bb9a21870f6b26d2887ad82949a923d0d4df /interfaces.go | |
parent | eac390f28955d66f9152102058e0d85d972bc033 (diff) | |
download | go-tangerine-2924fdfcf7ab67a66a4ed3fb95cb9140be0cc809.tar.gz go-tangerine-2924fdfcf7ab67a66a4ed3fb95cb9140be0cc809.tar.zst go-tangerine-2924fdfcf7ab67a66a4ed3fb95cb9140be0cc809.zip |
ethereum, ethclient: add SyncProgress API endpoint
Diffstat (limited to 'interfaces.go')
-rw-r--r-- | interfaces.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/interfaces.go b/interfaces.go index 921d02616..aab0e2029 100644 --- a/interfaces.go +++ b/interfaces.go @@ -67,6 +67,22 @@ type ChainStateReader interface { NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error) } +// SyncProgress gives progress indications when the node is synchronising with +// the Ethereum network. +type SyncProgress struct { + StartingBlock uint64 // Block number where sync began + CurrentBlock uint64 // Current block number where sync is at + HighestBlock uint64 // Highest alleged block number in the chain + PulledStates uint64 // Number of state trie entries already downloaded + KnownStates uint64 // Total number os state trie entries known about +} + +// ChainSyncReader wraps access to the node's current sync status. If there's no +// sync currently running, it returns nil. +type ChainSyncReader interface { + SyncProgress(ctx context.Context) (*SyncProgress, error) +} + // A ChainHeadEventer returns notifications whenever the canonical head block is updated. type ChainHeadEventer interface { SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (Subscription, error) |