From 9e63798d0362a27b3ef45345d93f4a01c3349516 Mon Sep 17 00:00:00 2001 From: obscuren Date: Wed, 29 Apr 2015 19:55:30 +0200 Subject: core/types, eth: meassure and display propagation times --- eth/handler.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'eth') diff --git a/eth/handler.go b/eth/handler.go index 2dd4c74db..f7610e9e3 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 = time.Now() + 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. @@ -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 -- cgit