solves infinite loop problem; kinda first pass at commitment tree generation