From b78bc7f0975ee26037de2d60a73a665498ff4e30 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Fri, 4 Sep 2020 16:04:40 +0300 Subject: [PATCH] network: fix tx requests, we can't ask more than 500 txes at once --- pkg/network/server.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/pkg/network/server.go b/pkg/network/server.go index 6630a44b4..661764329 100644 --- a/pkg/network/server.go +++ b/pkg/network/server.go @@ -795,10 +795,17 @@ func (s *Server) requestTx(hashes ...util.Uint256) { return } - msg := NewMessage(CMDGetData, payload.NewInventory(payload.TXType, hashes)) - // It's high priority because it directly affects consensus process, - // even though it's getdata. - s.broadcastHPMessage(msg) + for i := 0; i < len(hashes)/payload.MaxHashesCount; i++ { + start := i * payload.MaxHashesCount + stop := (i + 1) * payload.MaxHashesCount + if stop < len(hashes) { + stop = len(hashes) + } + msg := NewMessage(CMDGetData, payload.NewInventory(payload.TXType, hashes[start:stop])) + // It's high priority because it directly affects consensus process, + // even though it's getdata. + s.broadcastHPMessage(msg) + } } // iteratePeersWithSendMsg sends given message to all peers using two functions