From 148e86a33b96981aa6b962d02d5eae48638ae736 Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Sun, 22 Dec 2019 05:03:11 -0500 Subject: [PATCH] Remove unneeded RPCs --- src/komodo_bitcoind.h | 3 - src/komodo_utils.h | 7 +- src/miner.cpp | 2 - src/rpc/server.cpp | 11 --- src/rpc/server.h | 9 -- src/wallet/rpcwallet.cpp | 200 --------------------------------------- 6 files changed, 1 insertion(+), 231 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 952291ce9..11aab7466 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -32,7 +32,6 @@ bool EnsureWalletIsAvailable(bool avoidException); extern bool fRequestShutdown; extern CScript KOMODO_EARLYTXID_SCRIPTPUB; -int32_t MarmaraSignature(uint8_t *utxosig,CMutableTransaction &txNew); uint8_t DecodeMaramaraCoinbaseOpRet(const CScript scriptPubKey,CPubKey &pk,int32_t &height,int32_t &unlockht); uint32_t komodo_heightstamp(int32_t height); @@ -712,8 +711,6 @@ bool hush_hardfork_active(uint32_t time) return isactive; } -bool MarmaraPoScheck(char *destaddr,CScript opret,CTransaction staketx); - int32_t komodo_isPoS(CBlock *pblock,int32_t height,bool fJustCheck) { return(0); diff --git a/src/komodo_utils.h b/src/komodo_utils.h index ea0d42d18..dc0cb7cb1 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1846,7 +1846,6 @@ void komodo_args(char *argv0) ASSETCHAINS_SCRIPTPUB = GetArg("-ac_script",""); ASSETCHAINS_BEAMPORT = GetArg("-ac_beam",0); ASSETCHAINS_CODAPORT = GetArg("-ac_coda",0); - ASSETCHAINS_MARMARA = GetArg("-ac_marmara",0); ASSETCHAINS_CBOPRET = GetArg("-ac_cbopret",0); ASSETCHAINS_CBMATURITY = GetArg("-ac_cbmaturity",0); ASSETCHAINS_ADAPTIVEPOW = GetArg("-ac_adaptivepow",0); @@ -2022,11 +2021,7 @@ void komodo_args(char *argv0) printf("ASSETCHAINS_FOUNDERS needs an ASSETCHAINS_OVERRIDE_PUBKEY or ASSETCHAINS_SCRIPTPUB\n"); } } - if ( ASSETCHAINS_SCRIPTPUB.size() > 1 && ASSETCHAINS_MARMARA != 0 ) - { - fprintf(stderr,"-ac_script and -ac_marmara are mutually exclusive\n"); - StartShutdown(); - } + if ( ASSETCHAINS_ENDSUBSIDY[0] != 0 || ASSETCHAINS_REWARD[0] != 0 || ASSETCHAINS_HALVING[0] != 0 || ASSETCHAINS_DECAY[0] != 0 || ASSETCHAINS_COMMISSION != 0 || ASSETCHAINS_PUBLIC != 0 || ASSETCHAINS_PRIVATE != 0 || ASSETCHAINS_TXPOW != 0 || ASSETCHAINS_FOUNDERS != 0 || ASSETCHAINS_SCRIPTPUB.size() > 1 || ASSETCHAINS_SELFIMPORT.size() > 0 || ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 || ASSETCHAINS_TIMELOCKGTE != _ASSETCHAINS_TIMELOCKOFF|| ASSETCHAINS_ALGO != ASSETCHAINS_EQUIHASH || ASSETCHAINS_LWMAPOS != 0 || ASSETCHAINS_LASTERA > 0 || ASSETCHAINS_BEAMPORT != 0 || ASSETCHAINS_CODAPORT != 0 || ASSETCHAINS_MARMARA != 0 || nonz > 0 || ASSETCHAINS_CCLIB.size() > 0 || ASSETCHAINS_FOUNDERS_REWARD != 0 || ASSETCHAINS_NOTARY_PAY[0] != 0 || ASSETCHAINS_BLOCKTIME != 60 || ASSETCHAINS_CBOPRET != 0 || Mineropret.size() != 0 || (ASSETCHAINS_NK[0] != 0 && ASSETCHAINS_NK[1] != 0) || KOMODO_SNAPSHOT_INTERVAL != 0 || ASSETCHAINS_EARLYTXIDCONTRACT != 0 || ASSETCHAINS_CBMATURITY != 0 || ASSETCHAINS_ADAPTIVEPOW != 0 ) { fprintf(stderr,"perc %.4f%% ac_pub=[%02x%02x%02x...] acsize.%d\n",dstr(ASSETCHAINS_COMMISSION)*100,ASSETCHAINS_OVERRIDE_PUBKEY33[0],ASSETCHAINS_OVERRIDE_PUBKEY33[1],ASSETCHAINS_OVERRIDE_PUBKEY33[2],(int32_t)ASSETCHAINS_SCRIPTPUB.size()); diff --git a/src/miner.cpp b/src/miner.cpp index 513f2dabd..079e2bbf9 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -153,8 +153,6 @@ uint64_t komodo_commission(const CBlock *block,int32_t height); int32_t komodo_notaryvin(CMutableTransaction &txNew,uint8_t *notarypub33, void *ptr); int32_t decode_hex(uint8_t *bytes,int32_t n,char *hex); int32_t komodo_is_notarytx(const CTransaction& tx); -CScript Marmara_scriptPubKey(int32_t height,CPubKey pk); -CScript MarmaraCoinbaseOpret(uint8_t funcid,int32_t height,CPubKey pk); uint64_t komodo_notarypay(CMutableTransaction &txNew, std::vector &NotarisationNotaries, uint32_t timestamp, int32_t height, uint8_t *script, int32_t len); int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp); int32_t komodo_getnotarizedheight(uint32_t timestamp,int32_t height, uint8_t *script, int32_t len); diff --git a/src/rpc/server.cpp b/src/rpc/server.cpp index 946dc411c..9903eab2d 100644 --- a/src/rpc/server.cpp +++ b/src/rpc/server.cpp @@ -500,17 +500,6 @@ static const CRPCCommand vRPCCommands[] = // Pegs { "pegs", "pegsaddress", &pegsaddress, true }, - // Marmara - { "marmara", "marmaraaddress", &marmaraaddress, true }, - { "marmara", "marmarapoolpayout", &marmara_poolpayout, true }, - { "marmara", "marmarareceive", &marmara_receive, true }, - { "marmara", "marmaraissue", &marmara_issue, true }, - { "marmara", "marmaratransfer", &marmara_transfer, true }, - { "marmara", "marmarainfo", &marmara_info, true }, - { "marmara", "marmaracreditloop", &marmara_creditloop, true }, - { "marmara", "marmarasettlement", &marmara_settlement, true }, - { "marmara", "marmaralock", &marmara_lock, true }, - // Payments { "payments", "paymentsaddress", &paymentsaddress, true }, { "payments", "paymentstxidopret", &payments_txidopret, true }, diff --git a/src/rpc/server.h b/src/rpc/server.h index 1688b0f67..7491f35ec 100644 --- a/src/rpc/server.h +++ b/src/rpc/server.h @@ -280,15 +280,6 @@ extern UniValue priceslist(const UniValue& params, bool fHelp, const CPubKey& my extern UniValue mypriceslist(const UniValue& params, bool fHelp, const CPubKey& mypk); extern UniValue pricesinfo(const UniValue& params, bool fHelp, const CPubKey& mypk); extern UniValue pegsaddress(const UniValue& params, bool fHelp, const CPubKey& mypk); -extern UniValue marmaraaddress(const UniValue& params, bool fHelp, const CPubKey& mypk); -extern UniValue marmara_poolpayout(const UniValue& params, bool fHelp, const CPubKey& mypk); -extern UniValue marmara_receive(const UniValue& params, bool fHelp, const CPubKey& mypk); -extern UniValue marmara_issue(const UniValue& params, bool fHelp, const CPubKey& mypk); -extern UniValue marmara_transfer(const UniValue& params, bool fHelp, const CPubKey& mypk); -extern UniValue marmara_info(const UniValue& params, bool fHelp, const CPubKey& mypk); -extern UniValue marmara_creditloop(const UniValue& params, bool fHelp, const CPubKey& mypk); -extern UniValue marmara_settlement(const UniValue& params, bool fHelp, const CPubKey& mypk); -extern UniValue marmara_lock(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); diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 98d7d2a35..8ba77f5ad 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -5468,7 +5468,6 @@ int32_t komodo_notaryvin(CMutableTransaction &txNew,uint8_t *notarypub33, void * #include "../cc/CCGateways.h" #include "../cc/CCPrices.h" #include "../cc/CCHeir.h" -#include "../cc/CCMarmara.h" #include "../cc/CCPayments.h" #include "../cc/CCPegs.h" @@ -5892,19 +5891,6 @@ UniValue pegsaddress(const UniValue& params, bool fHelp, const CPubKey& mypk) return(CCaddress(cp,(char *)"Pegs",pubkey)); } -UniValue marmaraaddress(const UniValue& params, bool fHelp, const CPubKey& mypk) -{ - struct CCcontract_info *cp,C; std::vector pubkey; - cp = CCinit(&C,EVAL_MARMARA); - if ( fHelp || params.size() > 1 ) - throw runtime_error("Marmaraaddress [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 *)"Marmara",pubkey)); -} - UniValue paymentsaddress(const UniValue& params, bool fHelp, const CPubKey& mypk) { struct CCcontract_info *cp,C; std::vector pubkey; @@ -6062,192 +6048,6 @@ UniValue importgatewayaddress(const UniValue& params, bool fHelp, const CPubKey& return(CCaddress(cp,(char *)"ImportGateway", pubkey)); } -UniValue marmara_poolpayout(const UniValue& params, bool fHelp, const CPubKey& mypk) -{ - int32_t firstheight; double perc; char *jsonstr; - if ( fHelp || params.size() != 3 ) - { - // marmarapoolpayout 0.5 2 '[["024131032ed90941e714db8e6dd176fe5a86c9d873d279edecf005c06f773da686",1000],["02ebc786cb83de8dc3922ab83c21f3f8a2f3216940c3bf9da43ce39e2a3a882c92",100]]'; - //marmarapoolpayout 0 2 '[["024131032ed90941e714db8e6dd176fe5a86c9d873d279edecf005c06f773da686",1000]]' - throw runtime_error("marmarapoolpayout perc firstheight \"[[\\\"pubkey\\\":shares], ...]\"\n"); - } - if ( ensure_CCrequirements(EVAL_MARMARA) < 0 ) - throw runtime_error(CC_REQUIREMENTS_MSG); - const CKeyStore& keystore = *pwalletMain; - LOCK2(cs_main, pwalletMain->cs_wallet); - perc = atof(params[0].get_str().c_str()) / 100.; - firstheight = atol(params[1].get_str().c_str()); - jsonstr = (char *)params[2].get_str().c_str(); - return(MarmaraPoolPayout(0,firstheight,perc,jsonstr)); // [[pk0, shares0], [pk1, shares1], ...] -} - -UniValue marmara_receive(const UniValue& params, bool fHelp, const CPubKey& mypk) -{ - UniValue result(UniValue::VOBJ); uint256 batontxid; std::vector senderpub; int64_t amount; int32_t matures; std::string currency; - if ( fHelp || (params.size() != 5 && params.size() != 4) ) - { - // automatic flag -> lsb of matures - // 1st marmarareceive 028076d42eb20efc10007fafb5ca66a2052523c0d2221e607adf958d1a332159f6 7.5 MARMARA 1440 - // after marmarareceive 039433dc3749aece1bd568f374a45da3b0bc6856990d7da3cd175399577940a775 7.5 MARMARA 1168 d72d87aa0d50436de695c93e2bf3d7273c63c92ef6307913aa01a6ee6a16548b - throw runtime_error("marmarareceive senderpk amount currency matures batontxid\n"); - } - if ( ensure_CCrequirements(EVAL_MARMARA) < 0 ) - throw runtime_error(CC_REQUIREMENTS_MSG); - const CKeyStore& keystore = *pwalletMain; - LOCK2(cs_main, pwalletMain->cs_wallet); - memset(&batontxid,0,sizeof(batontxid)); - senderpub = ParseHex(params[0].get_str().c_str()); - if (senderpub.size()!= 33) - { - ERR_RESULT("invalid sender pubkey"); - return result; - } - amount = atof(params[1].get_str().c_str()) * COIN + 0.00000000499999; - currency = params[2].get_str(); - if ( params.size() == 5 ) - { - matures = atol(params[3].get_str().c_str()); - batontxid = Parseuint256((char *)params[4].get_str().c_str()); - } else matures = atol(params[3].get_str().c_str()) + chainActive.LastTip()->GetHeight() + 1; - return(MarmaraReceive(0,pubkey2pk(senderpub),amount,currency,matures,batontxid,true)); -} - -UniValue marmara_issue(const UniValue& params, bool fHelp, const CPubKey& mypk) -{ - UniValue result(UniValue::VOBJ); uint256 approvaltxid; std::vector receiverpub; int64_t amount; int32_t matures; std::string currency; - if ( fHelp || params.size() != 5 ) - { - // marmaraissue 039433dc3749aece1bd568f374a45da3b0bc6856990d7da3cd175399577940a775 7.5 MARMARA 1168 32da4cb3e886ee42de90b4a15042d71169077306badf909099c5c5c692df3f27 - // marmaraissue 039433dc3749aece1bd568f374a45da3b0bc6856990d7da3cd175399577940a775 700 MARMARA 2629 11fe8bf1de80c2ef69124d08907f259aef7f41e3a632ca2d48ad072a8c8f3078 -> 335df3a5dd6b92a3d020c9465d4d76e0d8242126106b83756dcecbad9813fdf3 - - throw runtime_error("marmaraissue receiverpk amount currency matures approvaltxid\n"); - } - if ( ensure_CCrequirements(EVAL_MARMARA) < 0 ) - throw runtime_error(CC_REQUIREMENTS_MSG); - const CKeyStore& keystore = *pwalletMain; - LOCK2(cs_main, pwalletMain->cs_wallet); - receiverpub = ParseHex(params[0].get_str().c_str()); - if (receiverpub.size()!= 33) - { - ERR_RESULT("invalid receiverpub pubkey"); - return result; - } - amount = atof(params[1].get_str().c_str()) * COIN + 0.00000000499999; - currency = params[2].get_str(); - matures = atol(params[3].get_str().c_str()); - approvaltxid = Parseuint256((char *)params[4].get_str().c_str()); - return(MarmaraIssue(0,'I',pubkey2pk(receiverpub),amount,currency,matures,approvaltxid,zeroid)); -} - -UniValue marmara_transfer(const UniValue& params, bool fHelp, const CPubKey& mypk) -{ - UniValue result(UniValue::VOBJ); uint256 approvaltxid,batontxid; std::vector receiverpub; int64_t amount; int32_t matures; std::string currency; std::vector creditloop; - if ( fHelp || params.size() != 5 ) - { - // marmaratransfer 028076d42eb20efc10007fafb5ca66a2052523c0d2221e607adf958d1a332159f6 7.5 MARMARA 1168 1506c774e4b2804a6e25260920840f4cfca8d1fb400e69fe6b74b8e593dbedc5 - throw runtime_error("marmaratransfer receiverpk amount currency matures approvaltxid\n"); - } - if ( ensure_CCrequirements(EVAL_MARMARA) < 0 ) - throw runtime_error(CC_REQUIREMENTS_MSG); - receiverpub = ParseHex(params[0].get_str().c_str()); - if (receiverpub.size()!= 33) - { - ERR_RESULT("invalid receiverpub pubkey"); - return result; - } - const CKeyStore& keystore = *pwalletMain; - LOCK2(cs_main, pwalletMain->cs_wallet); - amount = atof(params[1].get_str().c_str()) * COIN + 0.00000000499999; - currency = params[2].get_str(); - matures = atol(params[3].get_str().c_str()); - approvaltxid = Parseuint256((char *)params[4].get_str().c_str()); - if ( MarmaraGetbatontxid(creditloop,batontxid,approvaltxid) < 0 ) - throw runtime_error("couldnt find batontxid\n"); - return(MarmaraIssue(0,'T',pubkey2pk(receiverpub),amount,currency,matures,approvaltxid,batontxid)); -} - -UniValue marmara_info(const UniValue& params, bool fHelp, const CPubKey& mypk) -{ - UniValue result(UniValue::VOBJ); CPubKey issuerpk; std::vector issuerpub; int64_t minamount,maxamount; int32_t firstheight,lastheight; std::string currency; - if ( fHelp || params.size() < 4 || params.size() > 6 ) - { - throw runtime_error("marmarainfo firstheight lastheight minamount maxamount [currency issuerpk]\n"); - } - if ( ensure_CCrequirements(EVAL_MARMARA) < 0 ) - throw runtime_error(CC_REQUIREMENTS_MSG); - const CKeyStore& keystore = *pwalletMain; - LOCK2(cs_main, pwalletMain->cs_wallet); - firstheight = atol(params[0].get_str().c_str()); - lastheight = atol(params[1].get_str().c_str()); - minamount = atof(params[2].get_str().c_str()) * COIN + 0.00000000499999; - maxamount = atof(params[3].get_str().c_str()) * COIN + 0.00000000499999; - if ( params.size() >= 5 ) - currency = params[4].get_str(); - if ( params.size() == 6 ) - { - issuerpub = ParseHex(params[5].get_str().c_str()); - if ( issuerpub.size()!= 33 ) - { - ERR_RESULT("invalid issuer pubkey"); - return result; - } - issuerpk = pubkey2pk(issuerpub); - } - result = MarmaraInfo(issuerpk,firstheight,lastheight,minamount,maxamount,currency); - return(result); -} - -UniValue marmara_creditloop(const UniValue& params, bool fHelp, const CPubKey& mypk) -{ - UniValue result(UniValue::VOBJ); uint256 txid; - if ( fHelp || params.size() != 1 ) - { - // marmaracreditloop 010ff7f9256cefe3b5dee3d72c0eeae9fc6f34884e6f32ffe5b60916df54a9be - throw runtime_error("marmaracreditloop txid\n"); - } - if ( ensure_CCrequirements(EVAL_MARMARA) < 0 ) - throw runtime_error(CC_REQUIREMENTS_MSG); - const CKeyStore& keystore = *pwalletMain; - LOCK2(cs_main, pwalletMain->cs_wallet); - txid = Parseuint256((char *)params[0].get_str().c_str()); - result = MarmaraCreditloop(txid); - return(result); -} - -UniValue marmara_settlement(const UniValue& params, bool fHelp, const CPubKey& mypk) -{ - UniValue result(UniValue::VOBJ); uint256 batontxid; - if ( fHelp || params.size() != 1 ) - { - // marmarasettlement 010ff7f9256cefe3b5dee3d72c0eeae9fc6f34884e6f32ffe5b60916df54a9be - // marmarasettlement ff3e259869196f3da9b5ea3f9e088a76c4fc063cf36ab586b652e121d441a603 - throw runtime_error("marmarasettlement batontxid\n"); - } - if ( ensure_CCrequirements(EVAL_MARMARA) < 0 ) - throw runtime_error(CC_REQUIREMENTS_MSG); - const CKeyStore& keystore = *pwalletMain; - LOCK2(cs_main, pwalletMain->cs_wallet); - batontxid = Parseuint256((char *)params[0].get_str().c_str()); - result = MarmaraSettlement(0,batontxid); - return(result); -} - -UniValue marmara_lock(const UniValue& params, bool fHelp, const CPubKey& mypk) -{ - UniValue result(UniValue::VOBJ); int64_t amount; int32_t height; - if ( fHelp || params.size() > 2 || params.size() == 0 ) - { - throw runtime_error("marmaralock amount unlockht\n"); - } - const CKeyStore& keystore = *pwalletMain; - LOCK2(cs_main, pwalletMain->cs_wallet); - amount = atof(params[0].get_str().c_str()) * COIN + 0.00000000499999; - if ( params.size() == 2 ) - height = atol(params[1].get_str().c_str()); - else height = chainActive.LastTip()->GetHeight() + 1; - return(MarmaraLock(0,amount,height)); -} - UniValue channelslist(const UniValue& params, bool fHelp, const CPubKey& mypk) { if ( fHelp || params.size() > 0 )