diff options
author | obscuren <geffobscura@gmail.com> | 2015-04-22 23:56:06 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-04-23 17:50:12 +0800 |
commit | d3be1a271961f13f5bd056d195b790c668552fe1 (patch) | |
tree | a586f4e4d0a4e1110a67cba24588bf2c64d9edf3 /core | |
parent | 888ece0cb2c9d07ae821398aeffb0000ef28fb23 (diff) | |
download | dexon-d3be1a271961f13f5bd056d195b790c668552fe1.tar dexon-d3be1a271961f13f5bd056d195b790c668552fe1.tar.gz dexon-d3be1a271961f13f5bd056d195b790c668552fe1.tar.bz2 dexon-d3be1a271961f13f5bd056d195b790c668552fe1.tar.lz dexon-d3be1a271961f13f5bd056d195b790c668552fe1.tar.xz 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 'core')
-rw-r--r-- | core/transaction_pool.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/core/transaction_pool.go b/core/transaction_pool.go index bc6e70c7a..9c175e568 100644 --- a/core/transaction_pool.go +++ b/core/transaction_pool.go @@ -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}) } } |