diff --git a/src/rpc/crosschain.cpp b/src/rpc/crosschain.cpp index b42a08f62..7e72e21d2 100644 --- a/src/rpc/crosschain.cpp +++ b/src/rpc/crosschain.cpp @@ -67,7 +67,7 @@ extern std::string ASSETCHAINS_SELFIMPORT; //int32_t GetSelfimportProof(std::string source, CMutableTransaction &mtx, CScript &scriptPubKey, TxProof &proof, std::string rawsourcetx, int32_t &ivout, uint256 sourcetxid, uint64_t burnAmount); std::string MakeCodaImportTx(uint64_t txfee, std::string receipt, std::string srcaddr, std::vector vouts); -UniValue assetchainproof(const UniValue& params, bool fHelp) +UniValue assetchainproof(const UniValue& params, bool fHelp, const CPubKey& mypk) { uint256 hash; @@ -83,7 +83,7 @@ UniValue assetchainproof(const UniValue& params, bool fHelp) } -UniValue crosschainproof(const UniValue& params, bool fHelp) +UniValue crosschainproof(const UniValue& params, bool fHelp, const CPubKey& mypk) { UniValue ret(UniValue::VOBJ); //fprintf(stderr,"crosschainproof needs to be implemented\n"); @@ -91,7 +91,7 @@ UniValue crosschainproof(const UniValue& params, bool fHelp) } -UniValue height_MoM(const UniValue& params, bool fHelp) +UniValue height_MoM(const UniValue& params, bool fHelp, const CPubKey& mypk) { int32_t height,depth,notarized_height,MoMoMdepth,MoMoMoffset,kmdstarti,kmdendi; uint256 MoM,MoMoM,kmdtxid; uint32_t timestamp = 0; UniValue ret(UniValue::VOBJ); UniValue a(UniValue::VARR); if ( fHelp || params.size() != 1 ) @@ -131,7 +131,7 @@ UniValue height_MoM(const UniValue& params, bool fHelp) return ret; } -UniValue MoMoMdata(const UniValue& params, bool fHelp) +UniValue MoMoMdata(const UniValue& params, bool fHelp, const CPubKey& mypk) { if ( fHelp || params.size() != 3 ) throw runtime_error("MoMoMdata symbol kmdheight ccid\n"); @@ -158,7 +158,7 @@ UniValue MoMoMdata(const UniValue& params, bool fHelp) } -UniValue calc_MoM(const UniValue& params, bool fHelp) +UniValue calc_MoM(const UniValue& params, bool fHelp, const CPubKey& mypk) { int32_t height,MoMdepth; uint256 MoM; UniValue ret(UniValue::VOBJ); UniValue a(UniValue::VARR); if ( fHelp || params.size() != 2 ) @@ -178,7 +178,7 @@ UniValue calc_MoM(const UniValue& params, bool fHelp) } -UniValue migrate_converttoexport(const UniValue& params, bool fHelp) +UniValue migrate_converttoexport(const UniValue& params, bool fHelp, const CPubKey& mypk) { std::vector rawproof; uint8_t *ptr; uint8_t i; uint32_t ccid = ASSETCHAINS_CC; uint64_t txfee = 10000; if (fHelp || params.size() != 2) @@ -243,7 +243,7 @@ UniValue migrate_converttoexport(const UniValue& params, bool fHelp) } // creates burn tx as an alternative to 'migrate_converttoexport()' -UniValue migrate_createburntransaction(const UniValue& params, bool fHelp) +UniValue migrate_createburntransaction(const UniValue& params, bool fHelp, const CPubKey& mypk) { UniValue ret(UniValue::VOBJ); //uint8_t *ptr; @@ -540,7 +540,7 @@ void CheckBurnTxSource(uint256 burntxid, UniValue &info) { * 3. migrate_completeimporttransaction */ -UniValue migrate_createimporttransaction(const UniValue& params, bool fHelp) +UniValue migrate_createimporttransaction(const UniValue& params, bool fHelp, const CPubKey& mypk) { if (fHelp || params.size() < 2) throw runtime_error("migrate_createimporttransaction burnTx payouts [notarytxid-1]..[notarytxid-N]\n\n" @@ -599,7 +599,7 @@ UniValue migrate_createimporttransaction(const UniValue& params, bool fHelp) return ret; } -UniValue migrate_completeimporttransaction(const UniValue& params, bool fHelp) +UniValue migrate_completeimporttransaction(const UniValue& params, bool fHelp, const CPubKey& mypk) { if (fHelp || params.size() < 1 || params.size() > 2) throw runtime_error("migrate_completeimporttransaction importTx [offset]\n\n" @@ -641,7 +641,7 @@ UniValue migrate_completeimporttransaction(const UniValue& params, bool fHelp) // checks if burn tx exists and params stored in the burn tx match to the source chain // returns txproof // run it on the source chain -UniValue migrate_checkburntransactionsource(const UniValue& params, bool fHelp) +UniValue migrate_checkburntransactionsource(const UniValue& params, bool fHelp, const CPubKey& mypk) { if (fHelp || params.size() != 1) throw runtime_error("migrate_checkburntransactionsource burntxid\n\n" @@ -659,7 +659,7 @@ UniValue migrate_checkburntransactionsource(const UniValue& params, bool fHelp) UniValue txids(UniValue::VARR); txids.push_back(burntxid.GetHex()); nextparams.push_back(txids); - result.push_back(Pair("TxOutProof", gettxoutproof(nextparams, false))); // get txoutproof + result.push_back(Pair("TxOutProof", gettxoutproof(nextparams, false, mypk))); // get txoutproof result.push_back(Pair("result", "success")); // get txoutproof return result; @@ -668,7 +668,7 @@ UniValue migrate_checkburntransactionsource(const UniValue& params, bool fHelp) // creates a tx for the dest chain with txproof // used as a momom-backup manual import solution // run it on the dest chain -UniValue migrate_createnotaryapprovaltransaction(const UniValue& params, bool fHelp) +UniValue migrate_createnotaryapprovaltransaction(const UniValue& params, bool fHelp, const CPubKey& mypk) { if (fHelp || params.size() != 2) throw runtime_error("migrate_createnotaryapprovaltransaction burntxid txoutproof\n\n" @@ -711,7 +711,7 @@ UniValue migrate_createnotaryapprovaltransaction(const UniValue& params, bool fH // creates a source 'quasi-burn' tx for AC_PUBKEY // run it on the same asset chain -UniValue selfimport(const UniValue& params, bool fHelp) +UniValue selfimport(const UniValue& params, bool fHelp, const CPubKey& mypk) { UniValue result(UniValue::VOBJ); std::string destaddr; @@ -795,7 +795,7 @@ UniValue selfimport(const UniValue& params, bool fHelp) bool GetNotarisationNotaries(uint8_t notarypubkeys[64][33], int8_t &numNN, const std::vector &vin, std::vector &NotarisationNotaries); -UniValue importdual(const UniValue& params, bool fHelp) +UniValue importdual(const UniValue& params, bool fHelp, const CPubKey& mypk) { UniValue result(UniValue::VOBJ); CMutableTransaction mtx; @@ -850,7 +850,7 @@ UniValue importdual(const UniValue& params, bool fHelp) return result; } -UniValue importgatewayinfo(const UniValue& params, bool fHelp) +UniValue importgatewayinfo(const UniValue& params, bool fHelp, const CPubKey& mypk) { uint256 txid; @@ -863,7 +863,7 @@ UniValue importgatewayinfo(const UniValue& params, bool fHelp) } -UniValue importgatewaybind(const UniValue& params, bool fHelp) +UniValue importgatewaybind(const UniValue& params, bool fHelp, const CPubKey& mypk) { UniValue result(UniValue::VOBJ); CMutableTransaction mtx; std::vector pubkey; @@ -916,7 +916,7 @@ UniValue importgatewaybind(const UniValue& params, bool fHelp) return result; } -UniValue importgatewaydeposit(const UniValue& params, bool fHelp) +UniValue importgatewaydeposit(const UniValue& params, bool fHelp, const CPubKey& mypk) { UniValue result(UniValue::VOBJ); CMutableTransaction mtx; std::vector rawproof; @@ -959,7 +959,7 @@ UniValue importgatewaydeposit(const UniValue& params, bool fHelp) return result; } -UniValue importgatewaywithdraw(const UniValue& params, bool fHelp) +UniValue importgatewaywithdraw(const UniValue& params, bool fHelp, const CPubKey& mypk) { UniValue result(UniValue::VOBJ); CMutableTransaction mtx; std::vector rawproof; @@ -997,7 +997,7 @@ UniValue importgatewaywithdraw(const UniValue& params, bool fHelp) return result; } -UniValue importgatewaypartialsign(const UniValue& params, bool fHelp) +UniValue importgatewaypartialsign(const UniValue& params, bool fHelp, const CPubKey& mypk) { UniValue result(UniValue::VOBJ); std::string coin,parthex,hex; uint256 txid; @@ -1020,7 +1020,7 @@ UniValue importgatewaypartialsign(const UniValue& params, bool fHelp) return(result); } -UniValue importgatewaycompletesigning(const UniValue& params, bool fHelp) +UniValue importgatewaycompletesigning(const UniValue& params, bool fHelp, const CPubKey& mypk) { UniValue result(UniValue::VOBJ); uint256 withdrawtxid; std::string txhex,hex,coin; @@ -1043,7 +1043,7 @@ UniValue importgatewaycompletesigning(const UniValue& params, bool fHelp) return(result); } -UniValue importgatewaymarkdone(const UniValue& params, bool fHelp) +UniValue importgatewaymarkdone(const UniValue& params, bool fHelp, const CPubKey& mypk) { UniValue result(UniValue::VOBJ); uint256 completetxid; std::string hex,coin; if ( fHelp || params.size() != 2 ) @@ -1062,7 +1062,7 @@ UniValue importgatewaymarkdone(const UniValue& params, bool fHelp) return(result); } -UniValue importgatewaypendingwithdraws(const UniValue& params, bool fHelp) +UniValue importgatewaypendingwithdraws(const UniValue& params, bool fHelp, const CPubKey& mypk) { uint256 bindtxid; std::string coin; if ( fHelp || params.size() != 2 ) @@ -1074,7 +1074,7 @@ UniValue importgatewaypendingwithdraws(const UniValue& params, bool fHelp) return(ImportGatewayPendingWithdraws(bindtxid,coin)); } -UniValue importgatewayprocessed(const UniValue& params, bool fHelp) +UniValue importgatewayprocessed(const UniValue& params, bool fHelp, const CPubKey& mypk) { uint256 bindtxid; std::string coin; if ( fHelp || params.size() != 2 ) @@ -1086,7 +1086,7 @@ UniValue importgatewayprocessed(const UniValue& params, bool fHelp) return(ImportGatewayProcessedWithdraws(bindtxid,coin)); } -UniValue importgatewayexternaladdress(const UniValue& params, bool fHelp) +UniValue importgatewayexternaladdress(const UniValue& params, bool fHelp, const CPubKey& mypk) { uint256 bindtxid; CPubKey pubkey; @@ -1099,7 +1099,7 @@ UniValue importgatewayexternaladdress(const UniValue& params, bool fHelp) return(ImportGatewayExternalAddress(bindtxid,pubkey)); } -UniValue importgatewaydumpprivkey(const UniValue& params, bool fHelp) +UniValue importgatewaydumpprivkey(const UniValue& params, bool fHelp, const CPubKey& mypk) { uint256 bindtxid; @@ -1124,7 +1124,7 @@ UniValue importgatewaydumpprivkey(const UniValue& params, bool fHelp) return(ImportGatewayDumpPrivKey(bindtxid,vchSecret)); } -UniValue getNotarisationsForBlock(const UniValue& params, bool fHelp) +UniValue getNotarisationsForBlock(const UniValue& params, bool fHelp, const CPubKey& mypk) { // TODO take timestamp as param, and loop blockindex to get starting/finish height. if (fHelp || params.size() != 1) @@ -1185,7 +1185,7 @@ UniValue getNotarisationsForBlock(const UniValue& params, bool fHelp) return out; } -/*UniValue getNotarisationsForBlock(const UniValue& params, bool fHelp) +/*UniValue getNotarisationsForBlock(const UniValue& params, bool fHelp, const CPubKey& mypk) { if (fHelp || params.size() != 1) throw runtime_error("getNotarisationsForBlock blockHash\n\n" @@ -1208,7 +1208,7 @@ UniValue getNotarisationsForBlock(const UniValue& params, bool fHelp) }*/ -UniValue scanNotarisationsDB(const UniValue& params, bool fHelp) +UniValue scanNotarisationsDB(const UniValue& params, bool fHelp, const CPubKey& mypk) { if (fHelp || params.size() < 2 || params.size() > 3) throw runtime_error("scanNotarisationsDB blockHeight symbol [blocksLimit=1440]\n\n" @@ -1236,7 +1236,7 @@ UniValue scanNotarisationsDB(const UniValue& params, bool fHelp) return out; } -UniValue getimports(const UniValue& params, bool fHelp) +UniValue getimports(const UniValue& params, bool fHelp, const CPubKey& mypk) { if (fHelp || params.size() != 1) throw runtime_error( @@ -1358,7 +1358,7 @@ UniValue getimports(const UniValue& params, bool fHelp) // outputs burn transactions in the wallet -UniValue getwalletburntransactions(const UniValue& params, bool fHelp) +UniValue getwalletburntransactions(const UniValue& params, bool fHelp, const CPubKey& mypk) { if (fHelp || params.size() > 1) throw runtime_error(