network: reuse inventory hash list for request hashes

Microoptimization, we can do this because we only use them in handleInvCmd().
This commit is contained in:
Roman Khimov 2022-10-18 22:57:55 +03:00
parent 0f625f04f0
commit e003b67418

View file

@ -751,7 +751,7 @@ func (s *Server) handlePong(p Peer, pong *payload.Ping) error {
// handleInvCmd processes the received inventory.
func (s *Server) handleInvCmd(p Peer, inv *payload.Inventory) error {
reqHashes := make([]util.Uint256, 0)
var reqHashes = inv.Hashes[:0]
var typExists = map[payload.InventoryType]func(util.Uint256) bool{
payload.TXType: s.mempool.ContainsKey,
payload.BlockType: s.chain.HasBlock,