eth: moved mined, tx events to protocol-hnd and improved tx propagation
Transactions are now propagated to peers from which we have not yet received the transaction. This will significantly reduce the chatter on the network. Moved new mined block handler to the protocol handler and moved transaction handling to protocol handler.
This commit is contained in:
@ -86,6 +86,12 @@ func (p *peer) sendNewBlock(block *types.Block) error {
|
||||
return p2p.Send(p.rw, NewBlockMsg, []interface{}{block, block.Td})
|
||||
}
|
||||
|
||||
func (p *peer) sendTransaction(tx *types.Transaction) error {
|
||||
p.txHashes.Add(tx.Hash())
|
||||
|
||||
return p2p.Send(p.rw, TxMsg, []*types.Transaction{tx})
|
||||
}
|
||||
|
||||
func (p *peer) requestHashes(from common.Hash) error {
|
||||
glog.V(logger.Debug).Infof("[%s] fetching hashes (%d) %x...\n", p.id, maxHashes, from[:4])
|
||||
return p2p.Send(p.rw, GetBlockHashesMsg, getBlockHashesMsgData{from, maxHashes})
|
||||
|
Reference in New Issue
Block a user