As C# node does it. Technically it's only needed for consensus and could be implemented in the appropriate package, but for better compatibility with C# node we're better returning it sorted right here.
getblock