network: fix getdata handling

It was broken by 0ba6b2a7, the peer only responded with one message instead of
full requested set.
This commit is contained in:
Roman Khimov 2020-01-27 11:55:03 +03:00
parent ead0b8ff94
commit 39800aecb3

View file

@ -435,13 +435,16 @@ func (s *Server) handleGetDataCmd(p Peer, inv *payload.Inventory) error {
} }
if msg != nil { if msg != nil {
pkt, err := msg.Bytes() pkt, err := msg.Bytes()
if err == nil {
if inv.Type == payload.ConsensusType {
err = p.EnqueueHPPacket(pkt)
} else {
err = p.EnqueuePacket(pkt)
}
}
if err != nil { if err != nil {
return err return err
} }
if inv.Type == payload.ConsensusType {
return p.EnqueueHPPacket(pkt)
}
return p.EnqueuePacket(pkt)
} }
} }
return nil return nil