diff options
author | Péter Szilágyi <peterke@gmail.com> | 2015-05-26 19:00:21 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2015-05-26 19:00:21 +0800 |
commit | eafdc1f8e371fd698da33491a01799393249729a (patch) | |
tree | e834b1921a15767edf889d3bd2b9f9713c1101ed /eth/downloader/downloader.go | |
parent | cc318ff8db20528cb567227c42c5d37dc892cc49 (diff) | |
download | dexon-eafdc1f8e371fd698da33491a01799393249729a.tar dexon-eafdc1f8e371fd698da33491a01799393249729a.tar.gz dexon-eafdc1f8e371fd698da33491a01799393249729a.tar.bz2 dexon-eafdc1f8e371fd698da33491a01799393249729a.tar.lz dexon-eafdc1f8e371fd698da33491a01799393249729a.tar.xz dexon-eafdc1f8e371fd698da33491a01799393249729a.tar.zst dexon-eafdc1f8e371fd698da33491a01799393249729a.zip |
eth, eth/downloader: surface downloaded block origin, drop on error
Diffstat (limited to 'eth/downloader/downloader.go')
-rw-r--r-- | eth/downloader/downloader.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/eth/downloader/downloader.go b/eth/downloader/downloader.go index fd588d2f3..0634baaed 100644 --- a/eth/downloader/downloader.go +++ b/eth/downloader/downloader.go @@ -93,6 +93,12 @@ type Downloader struct { cancelLock sync.RWMutex // Lock to protect the cancel channel in delivers } +// Block is an origin-tagged blockchain block. +type Block struct { + RawBlock *types.Block + OriginPeer string +} + func New(mux *event.TypeMux, hasBlock hashCheckFn, getBlock getBlockFn) *Downloader { downloader := &Downloader{ mux: mux, @@ -177,7 +183,7 @@ func (d *Downloader) Synchronise(id string, hash common.Hash) error { } // TakeBlocks takes blocks from the queue and yields them to the caller. -func (d *Downloader) TakeBlocks() types.Blocks { +func (d *Downloader) TakeBlocks() []*Block { return d.queue.TakeBlocks() } |