public long calculateHeight ( ImprintNode node ) throws HashException { LinkedList < ImprintNode > tmpHeads = new LinkedList <> ( ) ; for ( ImprintNode in : heads ) { tmpHeads . add ( new ImprintNode ( in ) ) ; } addToHeads ( tmpHeads , new ImprintNode ( node ) ) ; ImprintNode root = getRootNode ( tmpHeads ) ; logger . debug ( "Adding node with hash {} and height {}, the hash tree height would be {}" , node . getValue ( ) , node . getLevel ( ) , root . getLevel ( ) ) ; return root . getLevel ( ) ; }
Calculates the height of the hash tree in case a new node would be added .