Commit fc47f0f2 authored by zelig's avatar zelig

add eth.chain.received.new_block log to eth protocol

parent 76af536d
......@@ -152,7 +152,6 @@ func (self *ethProtocol) handle() error {
return self.protoError(ErrDecode, "->msg %v: %v", msg, err)
}
//request.Amount = uint64(math.Min(float64(maxHashes), float64(request.Amount)))
if request.Amount > maxHashes {
request.Amount = maxHashes
}
......@@ -224,6 +223,15 @@ 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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment