adds subroutine to the commitment tree generation algorithm