diff options
author | lhendre <lhendre2@gmail.com> | 2019-01-30 15:40:36 +0800 |
---|---|---|
committer | Martin Holst Swende <martin@swende.se> | 2019-01-30 15:40:36 +0800 |
commit | d88441025fe58de094a89947cb17b54c36f5487b (patch) | |
tree | 32465e420687f377caad9acac883a85774edba60 /eth/downloader | |
parent | f4094d09cd3bf4c1420f358d77b803d5d84d0994 (diff) | |
download | go-tangerine-d88441025fe58de094a89947cb17b54c36f5487b.tar go-tangerine-d88441025fe58de094a89947cb17b54c36f5487b.tar.gz go-tangerine-d88441025fe58de094a89947cb17b54c36f5487b.tar.bz2 go-tangerine-d88441025fe58de094a89947cb17b54c36f5487b.tar.lz go-tangerine-d88441025fe58de094a89947cb17b54c36f5487b.tar.xz go-tangerine-d88441025fe58de094a89947cb17b54c36f5487b.tar.zst go-tangerine-d88441025fe58de094a89947cb17b54c36f5487b.zip |
cmd,eth: 16400 Add an option to stop geth once in sync. WIP for light mode (#17321)
* cmd, eth: Added in the flag to step geth once sync based on input
* cmd, eth: 16400 Add an option to stop geth once in sync.
* cmd: 16400 Add an option to stop geth once in sync. WIP
* cmd/geth/main, les/fletcher: added in light mode support
* cmd/geth/main, les/fletcher: Cleaned Comments and code for light mode
* cmd: 16400 Fixed formatting issue and cleaned code
* cmd, eth, les: 16400 Fixed formatting issues
* cmd, eth, les: Performed gofmt to update formatting
* cmd, eth, les: Fixed bugs resulting formatting
* cmd/geth, eth/, les: switched to downloader event
* eth: Fixed styling and gen_config
* eth/: Fix nil error in config file
* cmd/geth: Updated countdown log
* les/fetcher.go: Removed depcreated channel
* eth/downloader.go: Removed deprecated select
* cmd/geth, cmd/utils: Fixed minor issues
* eth: Reverted config files to proper format
* eth: Fixed typo in config file
* cmd/geth, eth/down: Updated code to use header time stamp
* eth/downloader: Changed the time threshold to 10 minutes
* cmd/geth, eth/downloader: Updated downloading event to pass latest header
* cmd/geth: Updated main to use right timer object
* cmd/geth: Removed unused failed event
* cmd/geth: added in correct time field with type assertion
* cmd/geth, cmd/utils: Updated flag to use boolean
* cmd/geth, cmd/utils, eth/downloader: Cleaned up code based on recommendations
* cmd/geth: Removed unneeded import
* cmd/geth, eth/downloader: fixed event field and suggested changes
* cmd/geth, cmd/utils: Updated flag and linting issue
Diffstat (limited to 'eth/downloader')
-rw-r--r-- | eth/downloader/downloader.go | 5 | ||||
-rw-r--r-- | eth/downloader/events.go | 6 |
2 files changed, 7 insertions, 4 deletions
diff --git a/eth/downloader/downloader.go b/eth/downloader/downloader.go index 4db689f73..58d19254c 100644 --- a/eth/downloader/downloader.go +++ b/eth/downloader/downloader.go @@ -415,7 +415,8 @@ func (d *Downloader) syncWithPeer(p *peerConnection, hash common.Hash, td *big.I if err != nil { d.mux.Post(FailedEvent{err}) } else { - d.mux.Post(DoneEvent{}) + latest := d.lightchain.CurrentHeader() + d.mux.Post(DoneEvent{latest}) } }() if p.version < 62 { @@ -1369,7 +1370,6 @@ func (d *Downloader) processHeaders(origin uint64, pivot uint64, td *big.Int) er } // Otherwise split the chunk of headers into batches and process them gotHeaders = true - for len(headers) > 0 { // Terminate if something failed in between processing chunks select { @@ -1432,7 +1432,6 @@ func (d *Downloader) processHeaders(origin uint64, pivot uint64, td *big.Int) er headers = headers[limit:] origin += uint64(limit) } - // Update the highest block number we know if a higher one is found. d.syncStatsLock.Lock() if d.syncStatsChainHeight < origin { diff --git a/eth/downloader/events.go b/eth/downloader/events.go index 64905b8f2..25255a3a7 100644 --- a/eth/downloader/events.go +++ b/eth/downloader/events.go @@ -16,6 +16,10 @@ package downloader -type DoneEvent struct{} +import "github.com/ethereum/go-ethereum/core/types" + +type DoneEvent struct { + Latest *types.Header +} type StartEvent struct{} type FailedEvent struct{ Err error } |