The current implementation of PrefixInput seems to be inconsistent. It checks for the buffer being empty, but only after the prefix is taken, so trying to read with an zero-length buffer discards the prefix and it cannot be read any longer.
Though the behavior can be fixed for the empty buffer case, I think it is better just to remove the check completely and add a "note" comment, since this is an internal mechanism used to parse compacts only and the buffer is always allocated properly.
The current implementation of
PrefixInput
seems to be inconsistent. It checks for the buffer being empty, but only after the prefix is taken, so trying to read with an zero-length buffer discards the prefix and it cannot be read any longer.Though the behavior can be fixed for the empty buffer case, I think it is better just to remove the check completely and add a "note" comment, since this is an internal mechanism used to parse compacts only and the buffer is always allocated properly.