Add event eth.tx.received

This commit is contained in:
Taylor Gerring 2015-03-02 08:17:09 -06:00
parent 0976c3024f
commit e31ec57f88
1 changed files with 7 additions and 0 deletions

View File

@ -8,6 +8,7 @@ import (
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/p2p" "github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/rlp" "github.com/ethereum/go-ethereum/rlp"
) )
@ -137,6 +138,12 @@ func (self *ethProtocol) handle() error {
if err := msg.Decode(&txs); err != nil { if err := msg.Decode(&txs); err != nil {
return self.protoError(ErrDecode, "msg %v: %v", msg, err) 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) self.txPool.AddTransactions(txs)
case GetBlockHashesMsg: case GetBlockHashesMsg: