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:
@ -229,8 +229,10 @@ func (self *TxPool) queueTx(tx *types.Transaction) {
|
||||
func (pool *TxPool) addTx(tx *types.Transaction) {
|
||||
if _, ok := pool.txs[tx.Hash()]; !ok {
|
||||
pool.txs[tx.Hash()] = tx
|
||||
// Notify the subscribers
|
||||
pool.eventMux.Post(TxPreEvent{tx})
|
||||
// Notify the subscribers. This event is posted in a goroutine
|
||||
// because it's possible that somewhere during the post "Remove transaction"
|
||||
// gets called which will then wait for the global tx pool lock and deadlock.
|
||||
go pool.eventMux.Post(TxPreEvent{tx})
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user