Skip to content

Commit

Permalink
Fix InvPayload.CreateGroup() (neo-project#1314)
Browse files Browse the repository at this point in the history
  • Loading branch information
erikzhang authored and Tommo-L committed Jun 22, 2020
1 parent a945e57 commit 87981a8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/neo/Network/P2P/Payloads/InvPayload.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,15 @@ public static InvPayload Create(InventoryType type, params UInt256[] hashes)
public static IEnumerable<InvPayload> CreateGroup(InventoryType type, UInt256[] hashes)
{
for (int i = 0; i < hashes.Length; i += MaxHashesCount)
{
int endIndex = i + MaxHashesCount;
if (endIndex > hashes.Length) endIndex = hashes.Length;
yield return new InvPayload
{
Type = type,
Hashes = hashes[i..(i + MaxHashesCount)]
Hashes = hashes[i..endIndex]
};
}
}

void ISerializable.Deserialize(BinaryReader reader)
Expand Down

0 comments on commit 87981a8

Please sign in to comment.