public PosHint grant(final PeerId peerId, final PosHint hint) {
        UnfoundPeerId peer = findPeer(peerId, this.peers, hint.pos0);
        if (peer != null) {
            if (!peer.found) {
                peer.found = true;
                this.quorum--;
            }
            hint.pos0 = peer.index;
        } else {
            hint.pos0 = -1;
        }
        if (this.oldPeers.isEmpty()) {
            hint.pos1 = -1;
            return hint;
        }
        peer = findPeer(peerId, this.oldPeers, hint.pos1);
        if (peer != null) {
            if (!peer.found) {
                peer.found = true;
                this.oldQuorum--;
            }
            hint.pos1 = peer.index;
        } else {
            hint.pos1 = -1;
        }

        return hint;
    }
@Test
    public void testGrant() {
        PeerId peer1 = new PeerId("localhost", 8081);
        this.ballot.grant(peer1);
        assertFalse(this.ballot.isGranted());

        PeerId unfoundPeer = new PeerId("localhost", 8084);
        this.ballot.grant(unfoundPeer);
        assertFalse(this.ballot.isGranted());

        PeerId peer2 = new PeerId("localhost", 8082);
        this.ballot.grant(peer2);
        assertTrue(this.ballot.isGranted());
    }