<commit_before>// Copyright (c) 2015 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include "consensus/cfund.h"
#include "main.h"

void CFund::SetScriptForCommunityFundContribution(CScript &script)
{
    script.resize(4);
    script[0] = OP_RETURN;
    script[1] = 0x20;
    script[2] = 0x20;
    script[3] = 0x20;
}

void CFund::VoteProposal(string strProp)
{
    vector<string>::iterator it = vAddedProposalVotes.begin();
    for(; it != vAddedProposalVotes.end(); it++)
        if (strProp == *it)
            break;

    CFund::CProposal proposal;
    bool found = pblocktree->ReadProposalIndex(uint256S("0x"+strProp), proposal);

    if(!found || proposal.IsNull())
        return;

    WriteConfigFile("addproposalvote", strProp);
    if (it == vAddedProposalVotes.end())
        vAddedProposalVotes.push_back(strProp);
}

void CFund::VoteProposal(uint256 proposalHash)
{
    VoteProposal(proposalHash.ToString());
}

void CFund::RemoveVoteProposal(string strProp)
{
    vector<string>::iterator it = vAddedProposalVotes.begin();
    for(; it != vAddedProposalVotes.end(); it++)
        if (strProp == *it)
            break;

    RemoveConfigFile("addproposalvote", strProp);
    if (it != vAddedProposalVotes.end())
        vAddedProposalVotes.erase(it);
}

void CFund::RemoveVoteProposal(uint256 proposalHash)
{
    RemoveVoteProposal(proposalHash.ToString());
}

void CFund::VotePaymentRequest(string strProp)
{
    vector<string>::iterator it = vAddedPaymentRequestVotes.begin();
    for(; it != vAddedPaymentRequestVotes.end(); it++)
        if (strProp == *it)
            break;

    CFund::CPaymentRequest prequest;
    bool found = pblocktree->ReadPaymentRequestIndex(uint256S("0x"+strProp), prequest);

    if(!found || prequest.IsNull())
        return;

    WriteConfigFile("addpaymentrequestvote", strProp);
    if (it == vAddedPaymentRequestVotes.end())
        vAddedPaymentRequestVotes.push_back(strProp);
}

void CFund::VotePaymentRequest(uint256 proposalHash)
{
    VotePaymentRequest(proposalHash.ToString());
}

void CFund::RemoveVotePaymentRequest(string strProp)
{
    vector<string>::iterator it = vAddedPaymentRequestVotes.begin();
    for(; it != vAddedPaymentRequestVotes.end(); it++)
        if (strProp == *it)
            break;

    RemoveConfigFile("addpaymentrequestvote", strProp);
    if (it != vAddedPaymentRequestVotes.end())
        vAddedPaymentRequestVotes.erase(it);
}

void CFund::RemoveVotePaymentRequest(uint256 proposalHash)
{<commit_msg>cfund: check order<commit_after>// Copyright (c) 2015 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include "consensus/cfund.h"
#include "main.h"

void CFund::SetScriptForCommunityFundContribution(CScript &script)
{
    script.resize(4);
    script[0] = OP_RETURN;
    script[1] = 0x20;
    script[2] = 0x20;
    script[3] = 0x20;
}

void CFund::VoteProposal(string strProp)
{

    CFund::CProposal proposal;
    bool found = pblocktree->ReadProposalIndex(uint256S("0x"+strProp), proposal);

    if(!found || proposal.IsNull())
        return;

    vector<string>::iterator it = vAddedProposalVotes.begin();
    for(; it != vAddedProposalVotes.end(); it++)
        if (strProp == *it)
            break;

    WriteConfigFile("addproposalvote", strProp);
    if (it == vAddedProposalVotes.end())
        vAddedProposalVotes.push_back(strProp);
}

void CFund::VoteProposal(uint256 proposalHash)
{
    VoteProposal(proposalHash.ToString());
}

void CFund::RemoveVoteProposal(string strProp)
{
    vector<string>::iterator it = vAddedProposalVotes.begin();
    for(; it != vAddedProposalVotes.end(); it++)
        if (strProp == *it)
            break;

    RemoveConfigFile("addproposalvote", strProp);
    if (it != vAddedProposalVotes.end())
        vAddedProposalVotes.erase(it);
}

void CFund::RemoveVoteProposal(uint256 proposalHash)
{
    RemoveVoteProposal(proposalHash.ToString());
}

void CFund::VotePaymentRequest(string strProp)
{

    CFund::CPaymentRequest prequest;
    bool found = pblocktree->ReadPaymentRequestIndex(uint256S("0x"+strProp), prequest);

    if(!found || prequest.IsNull())
        return;

    vector<string>::iterator it = vAddedPaymentRequestVotes.begin();
    for(; it != vAddedPaymentRequestVotes.end(); it++)
        if (strProp == *it)
            break;

    WriteConfigFile("addpaymentrequestvote", strProp);
    if (it == vAddedPaymentRequestVotes.end())
        vAddedPaymentRequestVotes.push_back(strProp);
}

void CFund::VotePaymentRequest(uint256 proposalHash)
{
    VotePaymentRequest(proposalHash.ToString());
}

void CFund::RemoveVotePaymentRequest(string strProp)
{
    vector<string>::iterator it = vAddedPaymentRequestVotes.begin();
    for(; it != vAddedPaymentRequestVotes.end(); it++)
        if (strProp == *it)
            break;

    RemoveConfigFile("addpaymentrequestvote", strProp);
    if (it != vAddedPaymentRequestVotes.end())
        vAddedPaymentRequestVotes.erase(it);
}

void CFund::RemoveVotePaymentRequest(uint256 proposalHash)
{
{'fraction_non_alphanumeric': 0.13138267355134825, 'fraction_numerical': 0.014534327787339835, 'mean_word_length': 4.203980099502488, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4376058', 'n_tokens_mistral': 1725, 'n_tokens_neox': 1662, 'n_words': 302}