import struct


def read_segwit_flag(buffer: bytearray) -> bool:
    """ Parse the segwit flag of the block header, read bytes are consumed.
    """
    peek, = struct.unpack('<c', buffer[:1])
    if peek == b'\00':
        i, = struct.unpack('<c', buffer[1:2])
        assert i == b'\01'
        del buffer[:2]
        return True
    return False