aboutsummaryrefslogtreecommitdiffstats
path: root/eth
diff options
context:
space:
mode:
authorzelig <viktor.tron@gmail.com>2015-03-03 16:43:05 +0800
committerzelig <viktor.tron@gmail.com>2015-03-03 16:43:05 +0800
commitfc47f0f27b4b672c84e8de230a5a3c5e5519f3aa (patch)
tree67de8c9367630a211a0fb567d055adfbf2cba1fc /eth
parent76af536d0d16e3f0742a46d448b3e0dcb46458f6 (diff)
downloadgo-tangerine-fc47f0f27b4b672c84e8de230a5a3c5e5519f3aa.tar.gz
go-tangerine-fc47f0f27b4b672c84e8de230a5a3c5e5519f3aa.tar.zst
go-tangerine-fc47f0f27b4b672c84e8de230a5a3c5e5519f3aa.zip
add eth.chain.received.new_block log to eth protocol
Diffstat (limited to 'eth')
-rw-r--r--eth/protocol.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/eth/protocol.go b/eth/protocol.go
index a5cc8ee1a..5a7af0e33 100644
--- a/eth/protocol.go
+++ b/eth/protocol.go
@@ -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)