network: do async broadcast when processing P2P TX

It can lead to some goroutine explosion, but supposedly it's better than
stalling other processing and eventually all of these goroutines should finish
their sends. Note that this doesn't change the behavior for RPC-relayed
transactions that are still waiting for the broadcast to finish ensuring
proper transaction distribution before returning the result to the client.
This commit is contained in:
Roman Khimov 2020-01-29 11:57:58 +03:00
parent 0fcbc697ca
commit e5d0125a3f

View file

@ -548,7 +548,7 @@ func (s *Server) handleTxCmd(tx *transaction.Transaction) error {
// in the pool. // in the pool.
if s.verifyAndPoolTX(tx) == RelaySucceed { if s.verifyAndPoolTX(tx) == RelaySucceed {
s.consensus.OnTransaction(tx) s.consensus.OnTransaction(tx)
s.broadcastTX(tx) go s.broadcastTX(tx)
} }
return nil return nil
} }