Hush is the extreme future, Komodo is the KYC past

This commit is contained in:
Duke Leto
2020-12-16 22:49:58 -05:00
parent 676931bc84
commit e3a68dfdfb
33 changed files with 106 additions and 186 deletions

View File

@@ -257,9 +257,9 @@ void CCclearvars(struct CCcontract_info *cp);
UniValue CClib(struct CCcontract_info *cp,char *method,char *jsonstr);
UniValue CClib_info(struct CCcontract_info *cp);
//CBlockIndex *komodo_blockindex(uint256 hash); //moved to komodo_def.h
//CBlockIndex *komodo_chainactive(int32_t height); //moved to komodo_def.h
//int32_t komodo_blockheight(uint256 hash); //moved to komodo_def.h
//CBlockIndex *hush_blockindex(uint256 hash); //moved to komodo_def.h
//CBlockIndex *hush_chainactive(int32_t height); //moved to komodo_def.h
//int32_t hush_blockheight(uint256 hash); //moved to komodo_def.h
//void StartShutdown();
static const uint256 zeroid; //!< null uint256 constant

View File

@@ -715,7 +715,7 @@ bool komodo_txnotarizedconfirmed(uint256 txid)
fprintf(stderr,"komodo_txnotarizedconfirmed no hashBlock for txid %s\n",txid.ToString().c_str());
return(0);
}
else if ( (pindex= komodo_blockindex(hashBlock)) == 0 || (txheight= pindex->GetHeight()) <= 0 )
else if ( (pindex= hush_blockindex(hashBlock)) == 0 || (txheight= pindex->GetHeight()) <= 0 )
{
fprintf(stderr,"komodo_txnotarizedconfirmed no txheight.%d %p for txid %s\n",txheight,pindex,txid.ToString().c_str());
return(0);

View File

@@ -1,4 +1,6 @@
// Copyright (c) 2016-2020 The Hush developers
// Distributed under the GPLv3 software license, see the accompanying
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
/******************************************************************************
* Copyright © 2014-2019 The SuperNET Developers. *
* *
@@ -67,7 +69,7 @@ void prices_bardisp(struct prices_bar *bar)
int64_t prices_blockinfo(int32_t height,char *acaddr)
{
std::vector<uint8_t> vopret; CBlockIndex *pindex; CBlock block; CTransaction tx,vintx; uint64_t pricebits; char destaddr[64]; uint32_t aveprice=0,timestamp,uprice; uint256 hashBlock; int64_t dist,mindist=(1LL<<60),prizefund = 0; int32_t mini=-1,i,n,vini,numvouts,iter; struct prices_bar refbar;
if ( (pindex= komodo_chainactive(height)) != 0 )
if ( (pindex= hush_chainactive(height)) != 0 )
{
if ( komodo_blockload(block,pindex) == 0 )
{

View File

@@ -601,7 +601,7 @@ int32_t games_isvalidgame(struct CCcontract_info *cp,int32_t &gameheight,CTransa
if ( (txid == zeroid || myGetTransaction(txid,tx,hashBlock) != 0) && (numvouts= tx.vout.size()) > 1 )
{
if ( txid != zeroid )
gameheight = komodo_blockheight(hashBlock);
gameheight = hush_blockheight(hashBlock);
else
{
txid = tx.GetHash();
@@ -674,7 +674,7 @@ int32_t games_playersalive(int32_t &openslots,int32_t &numplayers,uint256 gametx
{
if ( myGetTransaction(txid,tx,hashBlock) != 0 )
{
if ( (pindex= komodo_blockindex(hashBlock)) != 0 )
if ( (pindex= hush_blockindex(hashBlock)) != 0 )
{
if ( pindex->GetHeight() <= gameht+GAMES_MAXKEYSTROKESGAP )
alive++;
@@ -857,7 +857,7 @@ int64_t games_buyins(uint256 gametxid,int32_t maxplayers)
uint64_t games_gamefields(UniValue &obj,int64_t maxplayers,int64_t buyin,uint256 gametxid,char *mygamesaddr)
{
CBlockIndex *pindex; int32_t ht,openslots,delay,numplayers; uint256 hashBlock; uint64_t seed=0; char cmd[512]; CTransaction tx;
if ( myGetTransaction(gametxid,tx,hashBlock) != 0 && (pindex= komodo_blockindex(hashBlock)) != 0 )
if ( myGetTransaction(gametxid,tx,hashBlock) != 0 && (pindex= hush_blockindex(hashBlock)) != 0 )
{
ht = pindex->GetHeight();
delay = GAMES_REGISTRATION * (maxplayers > 1);
@@ -865,7 +865,7 @@ uint64_t games_gamefields(UniValue &obj,int64_t maxplayers,int64_t buyin,uint256
obj.push_back(Pair("start",ht+delay));
if ( hush_nextheight() > ht+delay )
{
if ( (pindex= komodo_chainactive(ht+delay)) != 0 )
if ( (pindex= hush_chainactive(ht+delay)) != 0 )
{
hashBlock = pindex->GetBlockHash();
obj.push_back(Pair("starthash",hashBlock.ToString()));
@@ -1066,7 +1066,7 @@ int32_t games_findbaton(struct CCcontract_info *cp,uint256 &playertxid,gameseven
{
if ( hashBlock == zeroid )
batonht = hush_nextheight();
else if ( (pindex= komodo_blockindex(hashBlock)) == 0 )
else if ( (pindex= hush_blockindex(hashBlock)) == 0 )
return(-4);
else batonht = pindex->GetHeight();
batonvalue = batontx.vout[0].nValue;

View File

@@ -903,7 +903,7 @@ UniValue OracleFund(const CPubKey& pk, int64_t txfee,uint256 oracletxid)
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight()); CTransaction tx;
CPubKey mypk,oraclespk; struct CCcontract_info *cp,C; std::string name,desc,format; int32_t numvouts; uint256 hashBlock;
if (GetLatestTimestamp(komodo_currentheight())<PUBKEY_SPOOFING_FIX_ACTIVATION)
if (GetLatestTimestamp(hush_currentheight())<PUBKEY_SPOOFING_FIX_ACTIVATION)
CCERR_RESULT("oraclescc",CCLOG_INFO, stream << "oraclesfund not active yet, activation scheduled for July 15th");
if (myGetTransaction(oracletxid,tx,hashBlock)==0 || (numvouts=tx.vout.size())<=0)
CCERR_RESULT("oraclecc",CCLOG_INFO, stream << "cant find oracletxid " << oracletxid.GetHex());
@@ -942,7 +942,7 @@ UniValue OracleRegister(const CPubKey& pk, int64_t txfee,uint256 oracletxid,int6
markerpubkey = CCtxidaddr(markeraddr,oracletxid);
if (AddNormalinputs(mtx,mypk,3*txfee,4,pk.IsValid()))
{
if (GetLatestTimestamp(komodo_currentheight())>PUBKEY_SPOOFING_FIX_ACTIVATION && AddMyOraclesFunds(cp,mtx,mypk,oracletxid)!=CC_MARKER_VALUE)
if (GetLatestTimestamp(hush_currentheight())>PUBKEY_SPOOFING_FIX_ACTIVATION && AddMyOraclesFunds(cp,mtx,mypk,oracletxid)!=CC_MARKER_VALUE)
CCERR_RESULT("oraclescc",CCLOG_INFO, stream << "error adding inputs from your Oracles CC address, please fund it first with oraclesfund rpc!");
mtx.vout.push_back(CTxOut(txfee,CScript() << ParseHex(HexStr(markerpubkey)) << OP_CHECKSIG));
mtx.vout.push_back(MakeCC1vout(cp->evalcode,txfee,batonpk));

View File

@@ -268,7 +268,7 @@ bool payments_game(int32_t &top, int32_t &bottom)
bool payments_lockedblocks(uint256 blockhash,int32_t lockedblocks,int32_t &blocksleft)
{
int32_t ht = chainActive.Height();
CBlockIndex* pblockindex = komodo_blockindex(blockhash);
CBlockIndex* pblockindex = hush_blockindex(blockhash);
if ( pblockindex == 0 || pblockindex->GetHeight()+lockedblocks > ht)
{
blocksleft = pblockindex->GetHeight()+lockedblocks - ht;

View File

@@ -104,7 +104,7 @@ extern uint64_t ASSETCHAINS_PEGSCCPARAMS[3];
extern uint8_t DecodeGatewaysBindOpRet(char *depositaddr,const CScript &scriptPubKey,uint256 &tokenid,std::string &coin,int64_t &totalsupply,uint256 &oracletxid,uint8_t &M,uint8_t &N,std::vector<CPubKey> &gatewaypubkeys,uint8_t &taddr,uint8_t &prefix,uint8_t &prefix2,uint8_t &wiftype);
extern int64_t GetTokenBalance(CPubKey pk, uint256 tokenid);
extern int32_t komodo_currentheight();
extern int32_t hush_currentheight();
extern int32_t prices_syntheticvec(std::vector<uint16_t> &vec, std::vector<std::string> synthetic);
extern int64_t prices_syntheticprice(std::vector<uint16_t> vec, int32_t height, int32_t minmax, int16_t leverage);
@@ -529,7 +529,7 @@ int64_t PegsGetTokenPrice(uint256 tokenid)
{
std::vector<std::string> vexpr;
SplitStr(desc, vexpr);
if (prices_syntheticvec(exp, vexpr)>=0 && (price = prices_syntheticprice(exp, komodo_currentheight(), 0, 1))>=0)
if (prices_syntheticvec(exp, vexpr)>=0 && (price = prices_syntheticprice(exp, hush_currentheight(), 0, 1))>=0)
return (price);
}
return (0);

View File

@@ -712,7 +712,7 @@ std::string RewardsUnlock(uint64_t txfee,char *planstr,uint256 fundingtxid,uint2
}
if ( amount > txfee )
{
reward = RewardsCalc((int64_t)amount,mtx.vin[0].prevout.hash,(int64_t)APR,(int64_t)minseconds,(int64_t)maxseconds,komodo_chainactive_timestamp());
reward = RewardsCalc((int64_t)amount,mtx.vin[0].prevout.hash,(int64_t)APR,(int64_t)minseconds,(int64_t)maxseconds,hush_chainactive_timestamp());
if ( scriptPubKey.size() > 0 )
{
if ( reward > txfee )

View File

@@ -311,7 +311,7 @@ int32_t rogue_isvalidgame(struct CCcontract_info *cp,int32_t &gameheight,CTransa
if ( (txid == zeroid || myGetTransaction(txid,tx,hashBlock) != 0) && (numvouts= tx.vout.size()) > 1 )
{
if ( txid != zeroid )
gameheight = komodo_blockheight(hashBlock);
gameheight = hush_blockheight(hashBlock);
else
{
txid = tx.GetHash();
@@ -613,7 +613,7 @@ int32_t rogue_findbaton(struct CCcontract_info *cp,uint256 &playertxid,char **ke
{
if ( hashBlock == zeroid )
batonht = hush_nextheight();
else if ( (pindex= komodo_blockindex(hashBlock)) == 0 )
else if ( (pindex= hush_blockindex(hashBlock)) == 0 )
return(-4);
else batonht = pindex->GetHeight();
batonvalue = batontx.vout[0].nValue;
@@ -668,7 +668,7 @@ int32_t rogue_playersalive(int32_t &openslots,int32_t &numplayers,uint256 gametx
{
if ( myGetTransaction(txid,tx,hashBlock) != 0 )
{
if ( (pindex= komodo_blockindex(hashBlock)) != 0 )
if ( (pindex= hush_blockindex(hashBlock)) != 0 )
{
if ( pindex->GetHeight() <= gameht+ROGUE_MAXKEYSTROKESGAP )
alive++;
@@ -687,7 +687,7 @@ int32_t rogue_playersalive(int32_t &openslots,int32_t &numplayers,uint256 gametx
uint64_t rogue_gamefields(UniValue &obj,int64_t maxplayers,int64_t buyin,uint256 gametxid,char *myrogueaddr)
{
CBlockIndex *pindex; int32_t ht,openslots,delay,numplayers; uint256 hashBlock; uint64_t seed=0; char cmd[512]; CTransaction tx;
if ( myGetTransaction(gametxid,tx,hashBlock) != 0 && (pindex= komodo_blockindex(hashBlock)) != 0 )
if ( myGetTransaction(gametxid,tx,hashBlock) != 0 && (pindex= hush_blockindex(hashBlock)) != 0 )
{
ht = pindex->GetHeight();
delay = ROGUE_REGISTRATION * (maxplayers > 1);
@@ -695,7 +695,7 @@ uint64_t rogue_gamefields(UniValue &obj,int64_t maxplayers,int64_t buyin,uint256
obj.push_back(Pair("start",ht+delay));
if ( hush_nextheight() > ht+delay )
{
if ( (pindex= komodo_chainactive(ht+delay)) != 0 )
if ( (pindex= hush_chainactive(ht+delay)) != 0 )
{
hashBlock = pindex->GetBlockHash();
obj.push_back(Pair("starthash",hashBlock.ToString()));

View File

@@ -2738,7 +2738,7 @@ UniValue sudoku_txidinfo(uint64_t txfee,struct CCcontract_info *cp,cJSON *params
if ( sudoku_genopreturndecode(unsolved,tx.vout[numvouts-1].scriptPubKey) == 'G' )
{
result.push_back(Pair("result","success"));
if ( (pindex= komodo_blockindex(hashBlock)) != 0 )
if ( (pindex= hush_blockindex(hashBlock)) != 0 )
result.push_back(Pair("height",pindex->GetHeight()));
Getscriptaddress(CCaddr,tx.vout[1].scriptPubKey);
result.push_back(Pair("sudokuaddr",CCaddr));
@@ -2790,7 +2790,7 @@ UniValue sudoku_pending(uint64_t txfee,struct CCcontract_info *cp,cJSON *params)
if ( sudoku_genopreturndecode(unsolved,tx.vout[numvouts-1].scriptPubKey) == 'G' )
{
UniValue obj(UniValue::VOBJ);
if ( (pindex= komodo_blockindex(hashBlock)) != 0 )
if ( (pindex= hush_blockindex(hashBlock)) != 0 )
obj.push_back(Pair("height",pindex->GetHeight()));
obj.push_back(Pair("amount",ValueFromAmount(tx.vout[1].nValue)));
obj.push_back(Pair("txid",txid.GetHex()));