From 765487bb14856c3a6f3ed05941de4c861df5146f Mon Sep 17 00:00:00 2001 From: Duke Date: Sat, 6 Jan 2024 23:30:19 -0800 Subject: [PATCH] Remove unused code --- src/rpc/server.cpp | 15 --- src/rpc/server.h | 11 --- src/wallet/rpcwallet.cpp | 200 --------------------------------------- 3 files changed, 226 deletions(-) diff --git a/src/rpc/server.cpp b/src/rpc/server.cpp index 9eb9076e7..c50d702a3 100644 --- a/src/rpc/server.cpp +++ b/src/rpc/server.cpp @@ -473,9 +473,6 @@ static const CRPCCommand vRPCCommands[] = { "oracles", "oraclessample", &oraclessample, true }, { "oracles", "oraclessamples", &oraclessamples, true }, - // Pegs - { "pegs", "pegsaddress", &pegsaddress, true }, - // Payments { "payments", "paymentsaddress", &paymentsaddress, true }, { "payments", "paymentstxidopret", &payments_txidopret, true }, @@ -539,18 +536,6 @@ static const CRPCCommand vRPCCommands[] = //{ "tokens", "tokenfillswap", &tokenfillswap, true }, { "tokens", "tokenconvert", &tokenconvert, true }, - // pegs - { "pegs", "pegscreate", &pegscreate, true }, - { "pegs", "pegsfund", &pegsfund, true }, - { "pegs", "pegsget", &pegsget, true }, - { "pegs", "pegsredeem", &pegsredeem, true }, - { "pegs", "pegsliquidate", &pegsliquidate, true }, - { "pegs", "pegsexchange", &pegsexchange, true }, - { "pegs", "pegsaccounthistory", &pegsaccounthistory, true }, - { "pegs", "pegsaccountinfo", &pegsaccountinfo, true }, - { "pegs", "pegsworstaccounts", &pegsworstaccounts, true }, - { "pegs", "pegsinfo", &pegsinfo, true }, - /* Address index */ { "addressindex", "getaddressmempool", &getaddressmempool, true }, { "addressindex", "getaddressutxos", &getaddressutxos, false }, diff --git a/src/rpc/server.h b/src/rpc/server.h index 8f88cb238..3b229d6f3 100644 --- a/src/rpc/server.h +++ b/src/rpc/server.h @@ -270,7 +270,6 @@ extern UniValue oraclessubscribe(const UniValue& params, bool fHelp, const CPubK extern UniValue oraclesdata(const UniValue& params, bool fHelp, const CPubKey& mypk); extern UniValue oraclessample(const UniValue& params, bool fHelp, const CPubKey& mypk); extern UniValue oraclessamples(const UniValue& params, bool fHelp, const CPubKey& mypk); -extern UniValue pegsaddress(const UniValue& params, bool fHelp, const CPubKey& mypk); extern UniValue paymentsaddress(const UniValue& params, bool fHelp, const CPubKey& mypk); extern UniValue payments_release(const UniValue& params, bool fHelp, const CPubKey& mypk); extern UniValue payments_fund(const UniValue& params, bool fHelp, const CPubKey& mypk); @@ -333,16 +332,6 @@ extern UniValue FSMcreate(const UniValue& params, bool fHelp, const CPubKey& myp extern UniValue FSMlist(const UniValue& params, bool fHelp, const CPubKey& mypk); extern UniValue FSMinfo(const UniValue& params, bool fHelp, const CPubKey& mypk); extern UniValue auctionaddress(const UniValue& params, bool fHelp, const CPubKey& mypk); -extern UniValue pegscreate(const UniValue& params, bool fHelp, const CPubKey& mypk); -extern UniValue pegsfund(const UniValue& params, bool fHelp, const CPubKey& mypk); -extern UniValue pegsget(const UniValue& params, bool fHelp, const CPubKey& mypk); -extern UniValue pegsredeem(const UniValue& params, bool fHelp, const CPubKey& mypk); -extern UniValue pegsliquidate(const UniValue& params, bool fHelp, const CPubKey& mypk); -extern UniValue pegsexchange(const UniValue& params, bool fHelp, const CPubKey& mypk); -extern UniValue pegsaccounthistory(const UniValue& params, bool fHelp, const CPubKey& mypk); -extern UniValue pegsaccountinfo(const UniValue& params, bool fHelp, const CPubKey& mypk); -extern UniValue pegsworstaccounts(const UniValue& params, bool fHelp, const CPubKey& mypk); -extern UniValue pegsinfo(const UniValue& params, bool fHelp, const CPubKey& mypk); extern UniValue getnewaddress(const UniValue& params, bool fHelp, const CPubKey& mypk); // in rpcwallet.cpp //extern UniValue getnewaddress64(const UniValue& params, bool fHelp, const CPubKey& mypk); // in rpcwallet.cpp diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 76aecf2b3..1dcc1525c 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -6102,7 +6102,6 @@ int32_t hush_notaryvin(CMutableTransaction &txNew,uint8_t *notarypub33, void *pT #include "../cc/CCPrices.h" #include "../cc/CCHeir.h" #include "../cc/CCPayments.h" -#include "../cc/CCPegs.h" int32_t ensure_CCrequirements(uint8_t evalcode) { CCerror = ""; @@ -6474,19 +6473,6 @@ UniValue oraclesaddress(const UniValue& params, bool fHelp, const CPubKey& mypk) return(CCaddress(cp,(char *)"Oracles",pubkey)); } -UniValue pegsaddress(const UniValue& params, bool fHelp, const CPubKey& mypk) -{ - struct CCcontract_info *cp,C; std::vector pubkey; - cp = CCinit(&C,EVAL_PEGS); - if ( fHelp || params.size() > 1 ) - throw runtime_error("pegssaddress [pubkey]\n"); - if ( ensure_CCrequirements(cp->evalcode) < 0 ) - throw runtime_error(CC_REQUIREMENTS_MSG); - if ( params.size() == 1 ) - pubkey = ParseHex(params[0].get_str().c_str()); - return(CCaddress(cp,(char *)"Pegs",pubkey)); -} - UniValue paymentsaddress(const UniValue& params, bool fHelp, const CPubKey& mypk) { struct CCcontract_info *cp,C; std::vector pubkey; @@ -8381,192 +8367,6 @@ UniValue heirlist(const UniValue& params, bool fHelp, const CPubKey& mypk) return (HeirList()); } -UniValue pegscreate(const UniValue& params, bool fHelp, const CPubKey& mypk) -{ - UniValue result(UniValue::VOBJ); int32_t i; std::vector txids; - uint8_t N; uint256 txid; int64_t amount; - - if ( fHelp || params.size()<3) - throw runtime_error("pegscreate amount N bindtxid1 [bindtxid2 ...]\n"); - if ( ensure_CCrequirements(EVAL_PEGS) < 0 ) - throw runtime_error(CC_REQUIREMENTS_MSG); - const CKeyStore& keystore = *pwalletMain; - Lock2NSPV(mypk); - amount = atof((char *)params[0].get_str().c_str()) * COIN + 0.00000000499999; - N = atoi((char *)params[1].get_str().c_str()); - if ( params.size() < N+1 ) - { - Unlock2NSPV(mypk); - throw runtime_error("not enough parameters for N pegscreate\n"); - } - for (i=0; i 0 ) - { - result.push_back(Pair("result", "success")); - } - Unlock2NSPV(mypk); - return(result); -} - -UniValue pegsfund(const UniValue& params, bool fHelp, const CPubKey& mypk) -{ - UniValue result(UniValue::VOBJ); uint256 pegstxid,tokenid; int64_t amount; - - - if ( fHelp || params.size()!=3) - throw runtime_error("pegsfund pegstxid tokenid amount\n"); - if ( ensure_CCrequirements(EVAL_PEGS) < 0 ) - throw runtime_error(CC_REQUIREMENTS_MSG); - const CKeyStore& keystore = *pwalletMain; - Lock2NSPV(mypk); - pegstxid = Parseuint256(params[0].get_str().c_str()); - tokenid = Parseuint256(params[1].get_str().c_str()); - amount = atof((char *)params[2].get_str().c_str()) * COIN + 0.00000000499999; - result = PegsFund(mypk,0,pegstxid,tokenid,amount); - if ( result[JSON_HEXTX].getValStr().size() > 0 ) - { - result.push_back(Pair("result", "success")); - } - Unlock2NSPV(mypk); - return(result); -} - -UniValue pegsget(const UniValue& params, bool fHelp, const CPubKey& mypk) -{ - UniValue result(UniValue::VOBJ); uint256 pegstxid,tokenid; int64_t amount; - - if ( fHelp || params.size()!=3) - throw runtime_error("pegsget pegstxid tokenid amount\n"); - if ( ensure_CCrequirements(EVAL_PEGS) < 0 ) - throw runtime_error(CC_REQUIREMENTS_MSG); - Lock2NSPV(mypk); - pegstxid = Parseuint256(params[0].get_str().c_str()); - tokenid = Parseuint256(params[1].get_str().c_str()); - amount = atof((char *)params[2].get_str().c_str()) * COIN + 0.00000000499999; - result = PegsGet(mypk,0,pegstxid,tokenid,amount); - if ( result[JSON_HEXTX].getValStr().size() > 0 ) - { - result.push_back(Pair("result", "success")); - } - Unlock2NSPV(mypk); - return(result); -} - -UniValue pegsredeem(const UniValue& params, bool fHelp, const CPubKey& mypk) -{ - UniValue result(UniValue::VOBJ); uint256 pegstxid,tokenid; int64_t amount; - - if ( fHelp || params.size()!=2) - throw runtime_error("pegsredeem pegstxid tokenid\n"); - if ( ensure_CCrequirements(EVAL_PEGS) < 0 ) - throw runtime_error(CC_REQUIREMENTS_MSG); - Lock2NSPV(mypk); - pegstxid = Parseuint256(params[0].get_str().c_str()); - tokenid = Parseuint256(params[1].get_str().c_str()); - result = PegsRedeem(mypk,0,pegstxid,tokenid); - if ( result[JSON_HEXTX].getValStr().size() > 0 ) - { - result.push_back(Pair("result", "success")); - } - Unlock2NSPV(mypk); - return(result); -} - -UniValue pegsliquidate(const UniValue& params, bool fHelp, const CPubKey& mypk) -{ - UniValue result(UniValue::VOBJ); uint256 pegstxid,tokenid,accounttxid; - - if ( fHelp || params.size()!=3) - throw runtime_error("pegsliquidate pegstxid tokenid accounttxid\n"); - if ( ensure_CCrequirements(EVAL_PEGS) < 0 ) - throw runtime_error(CC_REQUIREMENTS_MSG); - Lock2NSPV(mypk); - pegstxid = Parseuint256(params[0].get_str().c_str()); - tokenid = Parseuint256(params[1].get_str().c_str()); - accounttxid = Parseuint256(params[2].get_str().c_str()); - result = PegsLiquidate(mypk,0,pegstxid,tokenid,accounttxid); - if ( result[JSON_HEXTX].getValStr().size() > 0 ) - { - result.push_back(Pair("result", "success")); - } - Unlock2NSPV(mypk); - return(result); -} - -UniValue pegsexchange(const UniValue& params, bool fHelp, const CPubKey& mypk) -{ - UniValue result(UniValue::VOBJ); uint256 pegstxid,tokenid,accounttxid; int64_t amount; - - if ( fHelp || params.size()!=3) - throw runtime_error("pegsexchange pegstxid tokenid amount\n"); - if ( ensure_CCrequirements(EVAL_PEGS) < 0 ) - throw runtime_error(CC_REQUIREMENTS_MSG); - Lock2NSPV(mypk); - pegstxid = Parseuint256(params[0].get_str().c_str()); - tokenid = Parseuint256(params[1].get_str().c_str()); - amount = atof((char *)params[2].get_str().c_str()) * COIN + 0.00000000499999; - result = PegsExchange(mypk,0,pegstxid,tokenid,amount); - if ( result[JSON_HEXTX].getValStr().size() > 0 ) - { - result.push_back(Pair("result", "success")); - } - Unlock2NSPV(mypk); - return(result); -} - -UniValue pegsaccounthistory(const UniValue& params, bool fHelp, const CPubKey& mypk) -{ - uint256 pegstxid; - - if ( fHelp || params.size() != 1 ) - throw runtime_error("pegsaccounthistory pegstxid\n"); - if ( ensure_CCrequirements(EVAL_GATEWAYS) < 0 ) - throw runtime_error(CC_REQUIREMENTS_MSG); - pegstxid = Parseuint256((char *)params[0].get_str().c_str()); - return(PegsAccountHistory(mypk,pegstxid)); -} - -UniValue pegsaccountinfo(const UniValue& params, bool fHelp, const CPubKey& mypk) -{ - uint256 pegstxid; - - if ( fHelp || params.size() != 1 ) - throw runtime_error("pegsaccountinfo pegstxid\n"); - if ( ensure_CCrequirements(EVAL_GATEWAYS) < 0 ) - throw runtime_error(CC_REQUIREMENTS_MSG); - pegstxid = Parseuint256((char *)params[0].get_str().c_str()); - return(PegsAccountInfo(mypk,pegstxid)); -} - -UniValue pegsworstaccounts(const UniValue& params, bool fHelp, const CPubKey& mypk) -{ - uint256 pegstxid; - - if ( fHelp || params.size() != 1 ) - throw runtime_error("pegsworstaccounts pegstxid\n"); - if ( ensure_CCrequirements(EVAL_GATEWAYS) < 0 ) - throw runtime_error(CC_REQUIREMENTS_MSG); - pegstxid = Parseuint256((char *)params[0].get_str().c_str()); - return(PegsWorstAccounts(pegstxid)); -} - -UniValue pegsinfo(const UniValue& params, bool fHelp, const CPubKey& mypk) -{ - uint256 pegstxid; - - if ( fHelp || params.size() != 1 ) - throw runtime_error("pegsinfo pegstxid\n"); - if ( ensure_CCrequirements(EVAL_GATEWAYS) < 0 ) - throw runtime_error(CC_REQUIREMENTS_MSG); - pegstxid = Parseuint256((char *)params[0].get_str().c_str()); - return(PegsInfo(pegstxid)); -} - extern UniValue dumpprivkey(const UniValue& params, bool fHelp, const CPubKey& mypk); // in rpcdump.cpp extern UniValue convertpassphrase(const UniValue& params, bool fHelp, const CPubKey& mypk); extern UniValue importprivkey(const UniValue& params, bool fHelp, const CPubKey& mypk);