From 2924fdfcf7ab67a66a4ed3fb95cb9140be0cc809 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Tue, 6 Sep 2016 12:39:14 +0300 Subject: ethereum, ethclient: add SyncProgress API endpoint --- interfaces.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'interfaces.go') 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) -- cgit v1.2.3