Skip to content
  • Bastian Köcher's avatar
    xcmp-queue: Fix handling of encoded blobs (#889) · d988e383
    Bastian Köcher authored
    * xcmp-queue: Fix handling of encoded blobs
    
    With #701 we tried to fix some infinite loop related to encoded blobs, however that lead actually to
    not being able to process encoded blobs at all. The reason for this is that `decode_all` doesn't
    consume the given input. The point of this function is that it returns an error if the data couldn't
    be decoded or there is still data left. However, this means that the check
    `remaining_fragments.len() < last_remaining_fragments.len()` would always fail.
    
    We remove the while loop, because we decode the entire fragment anyway or it fails. Aka, we don't
    need to loop here. Next we remove the broken check and we directly reset the
    `remaining_fragments` (because `decode_all` doesn't consume anything).
    
    * Restore correct behavior
    
    We need to use a while loop, because there can be multiple `Vec<u8>`s. We also need to use `decode`,
    because `decode_all` would otherwise return an error if the input is not empty afterwards.
    
    * Remove unused import
    d988e383