When hashing two branches in the taproot tree, the one containing the script that is going to be executed should always go first (we cannot just concatenate the two branches in order). Then, the current implementation for the example [ [A, B], C ] works for A and B. The problem is that for a huge tree with an arbitrary amount of leaves, the implementation only works for the two most leftmost leaves. The tests were correct since they checked spending from the first leaves. They'd failed when spending from C.
When hashing two branches in the taproot tree, the one containing the script that is going to be executed should always go first (we cannot just concatenate the two branches in order). Then, the current implementation for the example [ [A, B], C ] works for A and B. The problem is that for a huge tree with an arbitrary amount of leaves, the implementation only works for the two most leftmost leaves. The tests were correct since they checked spending from the first leaves. They'd failed when spending from C.