We check the timestamp in __wt_txn_prepare.
/* Set the prepare timestamp. */
WT_RET(__wt_txn_set_timestamp(session, cfg, false));
if (!F_ISSET(txn, WT_TXN_HAS_TS_PREPARE))
WT_RET_MSG(session, EINVAL, "prepare timestamp is not set");
if (F_ISSET(txn, WT_TXN_HAS_TS_COMMIT))
WT_RET_MSG(
session, EINVAL, "commit timestamp must not be set before transaction is prepared");
However, we have done the same check already in _wt_txn_set_timestamp (_wt_txn_set_prepare_timestamp) for prepared timestamp.
if (F_ISSET(txn, WT_TXN_HAS_TS_PREPARE))
WT_RET_MSG(session, EINVAL, "prepare timestamp is already set");
if (F_ISSET(txn, WT_TXN_HAS_TS_COMMIT))
WT_RET_MSG(session, EINVAL,
"commit timestamp should not have been set before the prepare timestamp");
We can change one of the check to an assert.