public boolean recordGrantedVote(int remoteNodeId) {
        VoterState voterState = voteStates.get(remoteNodeId);
        if (voterState == null) {
            throw new IllegalArgumentException("Attempt to grant vote to non-voter " + remoteNodeId);
        } else if (voterState.state().equals(State.REJECTED)) {
            throw new IllegalArgumentException("Attempt to grant vote from node " + remoteNodeId +
                " which previously rejected our request");
        }

        boolean recorded = voterState.state().equals(State.UNRECORDED);
        voterState.setState(State.GRANTED);

        return recorded;
    }
Record a granted vote from one of the voters.

@param remoteNodeId The id of the voter
@return true if the voter had not been previously recorded
@throws IllegalArgumentException if the remote node is not a voter or if the vote had already been
        rejected by this node
raft/src/main/java/org/apache/kafka/raft/CandidateState.java