From e5d0125a3f3ebb129aa86feb440be7cad38ad192 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Wed, 29 Jan 2020 11:57:58 +0300 Subject: [PATCH] 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. --- pkg/network/server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/network/server.go b/pkg/network/server.go index f1f3e5a74..c62d7f34c 100644 --- a/pkg/network/server.go +++ b/pkg/network/server.go @@ -548,7 +548,7 @@ func (s *Server) handleTxCmd(tx *transaction.Transaction) error { // in the pool. if s.verifyAndPoolTX(tx) == RelaySucceed { s.consensus.OnTransaction(tx) - s.broadcastTX(tx) + go s.broadcastTX(tx) } return nil }