We call them Hush Smart Chains around here

This commit is contained in:
Duke Leto
2020-11-15 11:54:06 -05:00
parent ebf0df633b
commit c737c0dfaf
58 changed files with 422 additions and 421 deletions

View File

@@ -109,7 +109,7 @@ UniValue height_MoM(const UniValue& params, bool fHelp, const CPubKey& mypk)
}
//fprintf(stderr,"height_MoM height.%d\n",height);
depth = komodo_MoM(&notarized_height,&MoM,&kmdtxid,height,&MoMoM,&MoMoMoffset,&MoMoMdepth,&kmdstarti,&kmdendi);
ret.push_back(Pair("coin",(char *)(ASSETCHAINS_SYMBOL[0] == 0 ? "KMD" : ASSETCHAINS_SYMBOL)));
ret.push_back(Pair("coin",(char *)(SMART_CHAIN_SYMBOL[0] == 0 ? "HUSH" : SMART_CHAIN_SYMBOL)));
ret.push_back(Pair("height",height));
ret.push_back(Pair("timestamp",(uint64_t)timestamp));
if ( depth > 0 )
@@ -118,7 +118,7 @@ UniValue height_MoM(const UniValue& params, bool fHelp, const CPubKey& mypk)
ret.push_back(Pair("notarized_height",notarized_height));
ret.push_back(Pair("MoM",MoM.GetHex()));
ret.push_back(Pair("kmdtxid",kmdtxid.GetHex()));
if ( ASSETCHAINS_SYMBOL[0] != 0 )
if ( SMART_CHAIN_SYMBOL[0] != 0 )
{
ret.push_back(Pair("MoMoM",MoMoM.GetHex()));
ret.push_back(Pair("MoMoMoffset",MoMoMoffset));
@@ -170,7 +170,7 @@ UniValue calc_MoM(const UniValue& params, bool fHelp, const CPubKey& mypk)
throw runtime_error("calc_MoM illegal height or MoMdepth\n");
//fprintf(stderr,"height_MoM height.%d\n",height);
MoM = komodo_calcMoM(height,MoMdepth);
ret.push_back(Pair("coin",(char *)(ASSETCHAINS_SYMBOL[0] == 0 ? "KMD" : ASSETCHAINS_SYMBOL)));
ret.push_back(Pair("coin",(char *)(SMART_CHAIN_SYMBOL[0] == 0 ? "HUSH" : SMART_CHAIN_SYMBOL)));
ret.push_back(Pair("height",height));
ret.push_back(Pair("MoMdepth",MoMdepth));
ret.push_back(Pair("MoM",MoM.GetHex()));
@@ -195,7 +195,7 @@ UniValue migrate_converttoexport(const UniValue& params, bool fHelp, const CPubK
if (ASSETCHAINS_CC < KOMODO_FIRSTFUNGIBLEID)
throw runtime_error("-ac_cc < KOMODO_FIRSTFUNGIBLEID");
if (ASSETCHAINS_SYMBOL[0] == 0)
if (SMART_CHAIN_SYMBOL[0] == 0)
throw runtime_error("Must be called on assetchain");
vector<uint8_t> txData(ParseHexV(params[0], "argument 1"));
@@ -207,7 +207,7 @@ UniValue migrate_converttoexport(const UniValue& params, bool fHelp, const CPubK
if (targetSymbol.size() == 0 || targetSymbol.size() > 32)
throw runtime_error("targetSymbol length must be >0 and <=32");
if (strcmp(ASSETCHAINS_SYMBOL,targetSymbol.c_str()) == 0)
if (strcmp(SMART_CHAIN_SYMBOL,targetSymbol.c_str()) == 0)
throw runtime_error("cant send a coin to the same chain");
/// Tested 44 vins p2pkh inputs as working. Set this at 25, but its a tx size limit.
@@ -226,11 +226,11 @@ UniValue migrate_converttoexport(const UniValue& params, bool fHelp, const CPubK
throw JSONRPCError(RPC_TYPE_ERROR, "Cannot export more than 1 million coins per export.");
/* note: we marshal to rawproof in a different way (to be able to add other objects)
rawproof.resize(strlen(ASSETCHAINS_SYMBOL));
rawproof.resize(strlen(SMART_CHAIN_SYMBOL));
ptr = rawproof.data();
for (i=0; i<rawproof.size(); i++)
ptr[i] = ASSETCHAINS_SYMBOL[i]; */
const std::string chainSymbol(ASSETCHAINS_SYMBOL);
ptr[i] = SMART_CHAIN_SYMBOL[i]; */
const std::string chainSymbol(SMART_CHAIN_SYMBOL);
rawproof = E_MARSHAL(ss << chainSymbol); // add src chain name
CTxOut burnOut = MakeBurnOutput(burnAmount+txfee, ccid, targetSymbol, tx.vout,rawproof);
@@ -269,7 +269,7 @@ UniValue migrate_createburntransaction(const UniValue& params, bool fHelp, const
if (ASSETCHAINS_CC < KOMODO_FIRSTFUNGIBLEID)
throw runtime_error("-ac_cc < KOMODO_FIRSTFUNGIBLEID");
if (ASSETCHAINS_SYMBOL[0] == 0)
if (SMART_CHAIN_SYMBOL[0] == 0)
throw runtime_error("Must be called on assetchain");
// if -pubkey not set it sends change to null pubkey.
@@ -281,7 +281,7 @@ UniValue migrate_createburntransaction(const UniValue& params, bool fHelp, const
if (targetSymbol.size() == 0 || targetSymbol.size() > 32)
throw runtime_error("targetSymbol length must be >0 and <=32");
if (strcmp(ASSETCHAINS_SYMBOL, targetSymbol.c_str()) == 0)
if (strcmp(SMART_CHAIN_SYMBOL, targetSymbol.c_str()) == 0)
throw runtime_error("cant send a coin to the same chain");
std::string dest_addr_or_pubkey = params[1].get_str();
@@ -307,7 +307,7 @@ UniValue migrate_createburntransaction(const UniValue& params, bool fHelp, const
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
const std::string chainSymbol(ASSETCHAINS_SYMBOL);
const std::string chainSymbol(SMART_CHAIN_SYMBOL);
std::vector<uint8_t> rawproof; //(chainSymbol.begin(), chainSymbol.end());
if (tokenid.IsNull()) { // coins
@@ -502,13 +502,13 @@ void CheckBurnTxSource(uint256 burntxid, UniValue &info) {
throw std::runtime_error("No opreturn in burn tx");
if (sourceSymbol != ASSETCHAINS_SYMBOL)
if (sourceSymbol != SMART_CHAIN_SYMBOL)
throw std::runtime_error("Incorrect source chain in rawproof");
if (targetCCid != ASSETCHAINS_CC)
throw std::runtime_error("Incorrect CCid in burn tx");
if (targetSymbol == ASSETCHAINS_SYMBOL)
if (targetSymbol == SMART_CHAIN_SYMBOL)
throw std::runtime_error("Must not be called on the destination chain");
// fill info to return for the notary operator (if manual notarization) or user
@@ -548,7 +548,7 @@ UniValue migrate_createimporttransaction(const UniValue& params, bool fHelp, con
if (ASSETCHAINS_CC < KOMODO_FIRSTFUNGIBLEID)
throw runtime_error("-ac_cc < KOMODO_FIRSTFUNGIBLEID");
if (ASSETCHAINS_SYMBOL[0] == 0)
if (SMART_CHAIN_SYMBOL[0] == 0)
throw runtime_error("Must be called on assetchain");
vector<uint8_t> txData(ParseHexV(params[0], "argument 1"));
@@ -602,10 +602,10 @@ UniValue migrate_completeimporttransaction(const UniValue& params, bool fHelp, c
throw runtime_error("migrate_completeimporttransaction importTx [offset]\n\n"
"Takes a cross chain import tx with proof generated on assetchain "
"and extends proof to target chain proof root\n"
"offset is optional, use it to increase the used KMD height, use when import fails.");
"offset is optional, use it to increase the used HUSH height, use when import fails.");
if (ASSETCHAINS_SYMBOL[0] != 0)
throw runtime_error("Must be called on KMD");
if (SMART_CHAIN_SYMBOL[0] != 0)
throw runtime_error("Must be called on HUSH");
CTransaction importTx;
if (!E_UNMARSHAL(ParseHexV(params[0], "argument 1"), ss >> importTx))
@@ -644,7 +644,7 @@ UniValue migrate_checkburntransactionsource(const UniValue& params, bool fHelp,
throw runtime_error("migrate_checkburntransactionsource burntxid\n\n"
"checks if params stored in the burn tx match to its tx chain");
if (ASSETCHAINS_SYMBOL[0] == 0)
if (SMART_CHAIN_SYMBOL[0] == 0)
throw runtime_error("Must be called on asset chain");
uint256 burntxid = Parseuint256(params[0].get_str().c_str());
@@ -672,7 +672,7 @@ UniValue migrate_createnotaryapprovaltransaction(const UniValue& params, bool fH
"Creates a tx for destination chain with burn tx proof\n"
"txoutproof should be retrieved by komodo-cli migrate_checkburntransactionsource call on the source chain\n" );
if (ASSETCHAINS_SYMBOL[0] == 0)
if (SMART_CHAIN_SYMBOL[0] == 0)
throw runtime_error("Must be called on asset chain");
uint256 burntxid = Parseuint256(params[0].get_str().c_str());