From 5948adfa10e9ba1069974839140b594ba902cce2 Mon Sep 17 00:00:00 2001 From: Taylor Gerring Date: Thu, 5 Mar 2015 10:58:36 -0600 Subject: Added eth.chain.received.new_block --- eth/protocol.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'eth/protocol.go') diff --git a/eth/protocol.go b/eth/protocol.go index a5cc8ee1a..ec5a5b6ba 100644 --- a/eth/protocol.go +++ b/eth/protocol.go @@ -224,6 +224,14 @@ func (self *ethProtocol) handle() error { return self.protoError(ErrDecode, "msg %v: %v", msg, err) } hash := request.Block.Hash() + _, chainHead, _ := self.chainManager.Status() + jsonlogger.LogJson(&logger.EthChainReceivedNewBlock{ + BlockHash: ethutil.Bytes2Hex(hash), + BlockNumber: request.Block.Number(), // this surely must be zero + ChainHeadHash: ethutil.Bytes2Hex(chainHead), + BlockPrevHash: ethutil.Bytes2Hex(request.Block.ParentHash()), + RemoteId: self.peer.ID().String(), + }) // to simplify backend interface adding a new block // uses AddPeer followed by AddHashes, AddBlock only if peer is the best peer // (or selected as new best peer) -- cgit v1.2.3