diff --git a/src/neo/Network/P2P/Payloads/MerkleBlockPayload.cs b/src/neo/Network/P2P/Payloads/MerkleBlockPayload.cs index cf2dcba2d9..8a735587cd 100644 --- a/src/neo/Network/P2P/Payloads/MerkleBlockPayload.cs +++ b/src/neo/Network/P2P/Payloads/MerkleBlockPayload.cs @@ -37,9 +37,9 @@ public static MerkleBlockPayload Create(Block block, BitArray flags) public override void Deserialize(BinaryReader reader) { base.Deserialize(reader); - ContentCount = (int)reader.ReadVarInt(int.MaxValue); - Hashes = reader.ReadSerializableArray(); - Flags = reader.ReadVarBytes(); + ContentCount = (int)reader.ReadVarInt(Block.MaxTransactionsPerBlock + 1); + Hashes = reader.ReadSerializableArray(ContentCount); + Flags = reader.ReadVarBytes((ContentCount + 7) / 8); } public override void Serialize(BinaryWriter writer)