Do txid duplicates check inside BuildMerkleRoot

Move the txid duplicates check into BuildMerkleTree (where it can be done without building a full txid set), and rename the method to CalculateMerkleTree.
Good catch, yes. Seems like it only worked for the bottom level (j=0), and
the only case tested by comparison tool was in that level...