aboutsummaryrefslogtreecommitdiffstats
path: root/eth/peer.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-04-22 23:56:06 +0800
committerobscuren <geffobscura@gmail.com>2015-04-23 17:50:12 +0800
commitd3be1a271961f13f5bd056d195b790c668552fe1 (patch)
treea586f4e4d0a4e1110a67cba24588bf2c64d9edf3 /eth/peer.go
parent888ece0cb2c9d07ae821398aeffb0000ef28fb23 (diff)
downloaddexon-d3be1a271961f13f5bd056d195b790c668552fe1.tar.gz
dexon-d3be1a271961f13f5bd056d195b790c668552fe1.tar.zst
dexon-d3be1a271961f13f5bd056d195b790c668552fe1.zip
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.
Diffstat (limited to 'eth/peer.go')
-rw-r--r--eth/peer.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/eth/peer.go b/eth/peer.go
index 972880845..ec0c4b1f3 100644
--- a/eth/peer.go
+++ b/eth/peer.go
@@ -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})