diff options
author | Péter Szilágyi <peterke@gmail.com> | 2018-05-21 16:32:42 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2018-05-21 16:32:42 +0800 |
commit | d9cee2c172144c1d7efe68c454afac8132fe0911 (patch) | |
tree | 4902bd8b243733d172d23d0393b3181ce5c75a8f /eth/handler.go | |
parent | ab6bdbd9b0ea54897559f0f6df5c2a384a92f596 (diff) | |
download | dexon-d9cee2c172144c1d7efe68c454afac8132fe0911.tar.gz dexon-d9cee2c172144c1d7efe68c454afac8132fe0911.tar.zst dexon-d9cee2c172144c1d7efe68c454afac8132fe0911.zip |
eth: propagate blocks and transactions async
Diffstat (limited to 'eth/handler.go')
-rw-r--r-- | eth/handler.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/eth/handler.go b/eth/handler.go index 8993afe15..918d71088 100644 --- a/eth/handler.go +++ b/eth/handler.go @@ -698,7 +698,7 @@ func (pm *ProtocolManager) BroadcastBlock(block *types.Block, propagate bool) { // Send the block to a subset of our peers transfer := peers[:int(math.Sqrt(float64(len(peers))))] for _, peer := range transfer { - peer.SendNewBlock(block, td) + peer.AsyncSendNewBlock(block, td) } log.Trace("Propagated block", "hash", hash, "recipients", len(transfer), "duration", common.PrettyDuration(time.Since(block.ReceivedAt))) return @@ -706,7 +706,7 @@ func (pm *ProtocolManager) BroadcastBlock(block *types.Block, propagate bool) { // Otherwise if the block is indeed in out own chain, announce it if pm.blockchain.HasBlock(hash, block.NumberU64()) { for _, peer := range peers { - peer.SendNewBlockHashes([]common.Hash{hash}, []uint64{block.NumberU64()}) + peer.AsyncSendNewBlockHash(block) } log.Trace("Announced block", "hash", hash, "recipients", len(peers), "duration", common.PrettyDuration(time.Since(block.ReceivedAt))) } @@ -727,7 +727,7 @@ func (pm *ProtocolManager) BroadcastTxs(txs types.Transactions) { } // FIXME include this again: peers = peers[:int(math.Sqrt(float64(len(peers))))] for peer, txs := range txset { - peer.SendTransactions(txs) + peer.AsyncSendTransactions(txs) } } |