diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index 762341382..e133f58b2 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -892,75 +892,6 @@ UniValue gettxoutsetinfo(const UniValue& params, bool fHelp) return ret; } -UniValue listproposals(const UniValue& params, bool fHelp) -{ - if (fHelp) - throw runtime_error( - "listproposals \"filter\"\n" - "\nList the proposals and all the relating data including payment requests and status.\n" - "\nNote passing no argument returns all proposals regardless of state.\n" - "\nArguments:\n" - "\n1. \"filter\" (string, optional) \"accepted\" | \"rejected\" | \"expired\" | \"pending\"\n" - "\nExamples:\n" - + HelpExampleCli("listproposal", "accepted") - + HelpExampleRpc("listproposal", "") - ); - - LOCK(cs_main); - - UniValue ret(UniValue::VARR); - - bool showAll = true; - bool showAccepted = false; - bool showRejected = false; - bool showExpired = false; - bool showPending = false; - if(params.size() == 1) { - if(params[0].get_str() == "accepted") { - showAccepted = true; - showAll = false; - } - if(params[0].get_str() == "rejected") { - showRejected = true; - showAll = false; - } - if(params[0].get_str() == "expired") { - showAll = false; - showExpired = true; - } - if(params[0].get_str() == "pending") { - showAll = false; - showPending = true; - } - } - - CProposalMap mapProposals; - - if(pcoinsTip->GetAllProposals(mapProposals)) - { - for (CProposalMap::iterator it = mapProposals.begin(); it != mapProposals.end(); it++) - { - CFund::CProposal proposal; - if (!pcoinsTip->GetProposal(it->first, proposal)) - continue; - - if((showAll && (!proposal.IsExpired(pindexBestHeader->GetBlockTime()) - || proposal.fState == CFund::PENDING_VOTING_PREQ - || proposal.fState == CFund::PENDING_FUNDS)) - || (showPending && (proposal.fState == CFund::NIL || proposal.fState == CFund::PENDING_VOTING_PREQ - || proposal.fState == CFund::PENDING_FUNDS)) - || (showAccepted && (proposal.fState == CFund::ACCEPTED || proposal.IsAccepted())) - || (showRejected && (proposal.fState == CFund::REJECTED || proposal.IsRejected())) - || (showExpired && proposal.IsExpired(pindexBestHeader->GetBlockTime()))) { - UniValue o(UniValue::VOBJ); - proposal.ToJson(o, *pcoinsTip); - ret.push_back(o); - } - } - } - return ret; -} - UniValue cfundstats(const UniValue& params, bool fHelp) {