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
This commit is contained in:
@ -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)
|
||||
|
Reference in New Issue
Block a user