From 39800aecb34bb66b023ec2452e2798ef48c618ca Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Mon, 27 Jan 2020 11:55:03 +0300 Subject: [PATCH] network: fix `getdata` handling It was broken by 0ba6b2a7, the peer only responded with one message instead of full requested set. --- pkg/network/server.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pkg/network/server.go b/pkg/network/server.go index f08e0e54c..c1407742f 100644 --- a/pkg/network/server.go +++ b/pkg/network/server.go @@ -435,13 +435,16 @@ func (s *Server) handleGetDataCmd(p Peer, inv *payload.Inventory) error { } if msg != nil { pkt, err := msg.Bytes() + if err == nil { + if inv.Type == payload.ConsensusType { + err = p.EnqueueHPPacket(pkt) + } else { + err = p.EnqueuePacket(pkt) + } + } if err != nil { return err } - if inv.Type == payload.ConsensusType { - return p.EnqueueHPPacket(pkt) - } - return p.EnqueuePacket(pkt) } } return nil