diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-04-30 06:52:25 +0800 |
---|---|---|
committer | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-04-30 06:52:25 +0800 |
commit | 3fef60190384106af390dd23a65384b9cc6e4a28 (patch) | |
tree | 49f52b8bba6af0228bb20758dd1465f8dce6842d /eth/handler.go | |
parent | 764e81bf12bc45b00cec7db216e72d6396cf0c13 (diff) | |
parent | 30b921ef463247da63dece1cb81887f7e66668ff (diff) | |
download | go-tangerine-3fef60190384106af390dd23a65384b9cc6e4a28.tar go-tangerine-3fef60190384106af390dd23a65384b9cc6e4a28.tar.gz go-tangerine-3fef60190384106af390dd23a65384b9cc6e4a28.tar.bz2 go-tangerine-3fef60190384106af390dd23a65384b9cc6e4a28.tar.lz go-tangerine-3fef60190384106af390dd23a65384b9cc6e4a28.tar.xz go-tangerine-3fef60190384106af390dd23a65384b9cc6e4a28.tar.zst go-tangerine-3fef60190384106af390dd23a65384b9cc6e4a28.zip |
Merge pull request #830 from obscuren/downloader-missing-parent
eth/downloader: missing parent improvement
Diffstat (limited to 'eth/handler.go')
-rw-r--r-- | eth/handler.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/eth/handler.go b/eth/handler.go index 61149049e..fecd71632 100644 --- a/eth/handler.go +++ b/eth/handler.go @@ -346,6 +346,8 @@ func (self *ProtocolManager) handleMsg(p *peer) error { if err := request.Block.ValidateFields(); err != nil { return errResp(ErrDecode, "block validation %v: %v", msg, err) } + request.Block.ReceivedAt = msg.ReceivedAt + hash := request.Block.Hash() // Add the block hash as a known hash to the peer. This will later be used to determine // who should receive this. @@ -376,7 +378,7 @@ func (self *ProtocolManager) handleMsg(p *peer) error { // if the parent exists we process the block and propagate to our peers // if the parent does not exists we delegate to the downloader. if self.chainman.HasBlock(request.Block.ParentHash()) { - if err := self.chainman.InsertChain(types.Blocks{request.Block}); err != nil { + if _, err := self.chainman.InsertChain(types.Blocks{request.Block}); err != nil { // handle error return nil } @@ -419,7 +421,7 @@ func (pm *ProtocolManager) BroadcastBlock(hash common.Hash, block *types.Block) for _, peer := range peers { peer.sendNewBlock(block) } - glog.V(logger.Detail).Infoln("broadcast block to", len(peers), "peers") + glog.V(logger.Detail).Infoln("broadcast block to", len(peers), "peers. Total propagation time:", time.Since(block.ReceivedAt)) } // BroadcastTx will propagate the block to its connected peers. It will sort |