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.