Skip to content

Commit

Permalink
Fix InvPayload.CreateGroup() (#1314)
Browse files Browse the repository at this point in the history
  • Loading branch information
erikzhang authored Dec 2, 2019
1 parent 4a07a63 commit dd0362f
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 dd0362f

Please sign in to comment.