# How to make the line number in algorithm shown in bold

I have tried following which works (making the number in second line bold)

\begin{algorithm}[h]
\begin{algorithmic}[1]
\State TSO.assignStartTs()
{\bf\State} TSO.assignCommitTs()
\end{algorithmic}
\end{algorithm}


The problem is if I want to make the same for first linenumber, as below, it does not work, and complaints with Missing endcsname. This looks quite like undefined behaviour to me, and in general, is there anyway to make line number bold?

\begin{algorithm}[h]
\begin{algorithmic}[1]
{\bf\State} TSO.assignStartTs()
{\bf\State} TSO.assignCommitTs()
\end{algorithmic}
\end{algorithm}

-

The fact that it works in the second line is just by chance. It's better to use a specific command that boldens the next number:

\documentclass{article}
\usepackage{algorithm,algpseudocode}

\newif\ifboldnumber
\newcommand{\boldnext}{\global\boldnumbertrue}

% Default definition is \footnotesize#1:
\algrenewcommand\alglinenumber[1]{%
\footnotesize\ifboldnumber\bfseries\fi\global\boldnumberfalse#1:}

\begin{document}
\begin{algorithm}[h]
\begin{algorithmic}[1]
\boldnext
\State TSO.assignStartTs()
\State TSO.assignCommitTs()
\end{algorithmic}
\end{algorithm}
\end{document}


-