diff options
author | obscuren <geffobscura@gmail.com> | 2015-03-04 03:30:05 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-03-04 03:30:05 +0800 |
commit | f0b2ea64fc331fe6ef9f15097ac2d129dd9b7207 (patch) | |
tree | b54c28e87d0a64cab079c08108672b8d7e39d5f2 /eth/protocol.go | |
parent | 27078919669ad99bfb51b468f7c475120e6e148a (diff) | |
parent | 6c2856df2335dec946a5ebc14a4438b261e0c881 (diff) | |
download | go-tangerine-f0b2ea64fc331fe6ef9f15097ac2d129dd9b7207.tar go-tangerine-f0b2ea64fc331fe6ef9f15097ac2d129dd9b7207.tar.gz go-tangerine-f0b2ea64fc331fe6ef9f15097ac2d129dd9b7207.tar.bz2 go-tangerine-f0b2ea64fc331fe6ef9f15097ac2d129dd9b7207.tar.lz go-tangerine-f0b2ea64fc331fe6ef9f15097ac2d129dd9b7207.tar.xz go-tangerine-f0b2ea64fc331fe6ef9f15097ac2d129dd9b7207.tar.zst go-tangerine-f0b2ea64fc331fe6ef9f15097ac2d129dd9b7207.zip |
Merge branch 'jsonlogs' of https://github.com/ethersphere/go-ethereum into ethersphere-jsonlogs
Conflicts:
eth/block_pool.go
eth/block_pool_test.go
eth/protocol_test.go
miner/worker.go
Diffstat (limited to 'eth/protocol.go')
-rw-r--r-- | eth/protocol.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/eth/protocol.go b/eth/protocol.go index 67ed8f9e5..d394ba739 100644 --- a/eth/protocol.go +++ b/eth/protocol.go @@ -9,6 +9,7 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/errs" "github.com/ethereum/go-ethereum/ethutil" + "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/p2p" "github.com/ethereum/go-ethereum/rlp" ) @@ -165,6 +166,12 @@ func (self *ethProtocol) handle() error { if err := msg.Decode(&txs); err != nil { return self.protoError(ErrDecode, "msg %v: %v", msg, err) } + for _, tx := range txs { + jsonlogger.LogJson(&logger.EthTxReceived{ + TxHash: ethutil.Bytes2Hex(tx.Hash()), + RemoteId: self.peer.ID().String(), + }) + } self.txPool.AddTransactions(txs) case GetBlockHashesMsg: @@ -243,6 +250,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 AddBlock only if peer is the best peer // (or selected as new best peer) |