code: private void truncateUncommittedEntries() {
      if (type() == CopycatServer.State.PASSIVE) {
        context.getLog().truncate(Math.min(context.getCommitIndex(), context.getLog().lastIndex()));
      }
    }
docs: Truncates uncommitted entries from the log.