aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTaylor Gerring <taylor.gerring@gmail.com>2015-03-06 00:58:36 +0800
committerTaylor Gerring <taylor.gerring@gmail.com>2015-03-06 00:58:36 +0800
commit5948adfa10e9ba1069974839140b594ba902cce2 (patch)
tree0722f3bfe4f60c61c9e56493a928b2f514df5573
parentfbb307cca075b9a253316434f016a4820783a02d (diff)
downloaddexon-5948adfa10e9ba1069974839140b594ba902cce2.tar
dexon-5948adfa10e9ba1069974839140b594ba902cce2.tar.gz
dexon-5948adfa10e9ba1069974839140b594ba902cce2.tar.bz2
dexon-5948adfa10e9ba1069974839140b594ba902cce2.tar.lz
dexon-5948adfa10e9ba1069974839140b594ba902cce2.tar.xz
dexon-5948adfa10e9ba1069974839140b594ba902cce2.tar.zst
dexon-5948adfa10e9ba1069974839140b594ba902cce2.zip
Added eth.chain.received.new_block
-rw-r--r--eth/protocol.go8
-rw-r--r--logger/types.go10
2 files changed, 13 insertions, 5 deletions
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)
diff --git a/logger/types.go b/logger/types.go
index b04ff4fd0..d98f0874a 100644
--- a/logger/types.go
+++ b/logger/types.go
@@ -66,11 +66,11 @@ func (l *EthMinerNewBlock) EventName() string {
}
type EthChainReceivedNewBlock struct {
- BlockHash string `json:"block_hash"`
- BlockNumber int `json:"block_number"`
- ChainHeadHash string `json:"chain_head_hash"`
- BlockPrevHash string `json:"block_prev_hash"`
- RemoteId int `json:"remote_id"`
+ BlockHash string `json:"block_hash"`
+ BlockNumber *big.Int `json:"block_number"`
+ ChainHeadHash string `json:"chain_head_hash"`
+ BlockPrevHash string `json:"block_prev_hash"`
+ RemoteId string `json:"remote_id"`
LogEvent
}