diff options
author | obscuren <geffobscura@gmail.com> | 2015-04-16 07:28:37 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-04-17 19:54:18 +0800 |
commit | 73eb8e8c20b784e3a43f826e51a81326619d98ef (patch) | |
tree | 649216a70d8549cd632c2c3694c9872716e23842 /eth | |
parent | 3a51c3b584b16b408c3fbf87c4f9719fcfb1c52a (diff) | |
download | dexon-73eb8e8c20b784e3a43f826e51a81326619d98ef.tar dexon-73eb8e8c20b784e3a43f826e51a81326619d98ef.tar.gz dexon-73eb8e8c20b784e3a43f826e51a81326619d98ef.tar.bz2 dexon-73eb8e8c20b784e3a43f826e51a81326619d98ef.tar.lz dexon-73eb8e8c20b784e3a43f826e51a81326619d98ef.tar.xz dexon-73eb8e8c20b784e3a43f826e51a81326619d98ef.tar.zst dexon-73eb8e8c20b784e3a43f826e51a81326619d98ef.zip |
eth: basic implementation of the downloader
Diffstat (limited to 'eth')
-rw-r--r-- | eth/protocol.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/eth/protocol.go b/eth/protocol.go index a85d15a0c..66f3cbac8 100644 --- a/eth/protocol.go +++ b/eth/protocol.go @@ -396,6 +396,31 @@ func (self *ethProtocol) requestBlocks(hashes []common.Hash) error { return p2p.Send(self.rw, GetBlocksMsg, hashes) } +/* +func (self *ethProtocol) newRespBlockCh() BlockPack { + self.blockRespCh = make(chan blockResp) + return self.blockRespCh +} + +func (self *ethProtocol) RequestBlocks(hashes *set.Set) <-chan []*types.Block { + out := make(chan []*types.Block) + go func() { + done: + for { + select { + case blockResp := <-self.newRespBlockCh(): + if len(blockResp.blocks) { + } + case <-time.After(5 * time.Second): + } + } + + close(out) + }() + return out +} +*/ + func (self *ethProtocol) protoError(code int, format string, params ...interface{}) (err *errs.Error) { err = self.errors.New(code, format, params...) //err.Log(self.peer.Logger) |