code: func (bi *blockImporter) readBlock() ([]byte, error) {
  	// The block file format is:
  	//  <network> <block length> <serialized block>
  	var net uint32
  	err := binary.Read(bi.r, binary.LittleEndian, &net)
  	if err != nil {
  		if err != io.EOF {
  			return nil, err
  		}
  
  		// No block and no error means there are no more blocks to read.
  		return nil, nil
  	}
  	if net != uint32(activeNetParams.Net) {
  		return nil, fmt.Errorf("network mismatch -- got %x, want %x",
  			net, uint32(activeNetParams.Net))
  	}
  
  	// Read the block length and ensure it is sane.
  	var blockLen uint32
  	if err := binary.Read(bi.r, binary.LittleEndian, &blockLen); err != nil {
  		return nil, err
  	}
  	if blockLen > wire.MaxBlockPayload {
  		return nil, fmt.Errorf("block payload of %d bytes is larger "+
  			"than the max allowed %d bytes", blockLen,
  			wire.MaxBlockPayload)
  	}
  
  	serializedBlock := make([]byte, blockLen)
  	if _, err := io.ReadFull(bi.r, serializedBlock); err != nil {
  		return nil, err
  	}
  
  	return serializedBlock, nil
  }
docs: // readBlock reads the next block from the input file.