diff --git a/src/cc/CCPrices.h b/src/cc/CCPrices.h index bb3a4563d..cf55dc22b 100644 --- a/src/cc/CCPrices.h +++ b/src/cc/CCPrices.h @@ -32,7 +32,7 @@ extern CScript HUSH_EARLYTXID_SCRIPTPUB; #define PRICES_MAXLEVERAGE 777 #define PRICES_SMOOTHWIDTH 1 #define HUSH_MAXPRICES 2048 // must be power of 2 and less than 8192 -#define KOMODO_PRICEMASK (~(HUSH_MAXPRICES - 1)) // actually 1111 1000 0000 0000 +#define HUSH_PRICEMASK (~(HUSH_MAXPRICES - 1)) // actually 1111 1000 0000 0000 #define PRICES_WEIGHT (HUSH_MAXPRICES * 1) // 0000 1000 0000 0000 #define PRICES_MULT (HUSH_MAXPRICES * 2) // 0001 0000 0000 0000 #define PRICES_DIV (HUSH_MAXPRICES * 3) // 0001 1000 0000 0000 diff --git a/src/cc/CCutils.cpp b/src/cc/CCutils.cpp index 852c2e4ee..f6e244e1c 100644 --- a/src/cc/CCutils.cpp +++ b/src/cc/CCutils.cpp @@ -173,7 +173,7 @@ bool CheckTxFee(const CTransaction &tx, uint64_t txfee, uint32_t height, uint64_ uint32_t GetLatestTimestamp(int32_t height) { if ( HUSH_NSPV_SUPERLITE ) return ((uint32_t)NSPV_blocktime(height)); - return(komodo_heightstamp(height)); + return(hush_heightstamp(height)); } // :P void CCaddr2set(struct CCcontract_info *cp,uint8_t evalcode,CPubKey pk,uint8_t *priv,char *coinaddr) diff --git a/src/cc/oracles.cpp b/src/cc/oracles.cpp index f7635c03e..21e7cbb82 100644 --- a/src/cc/oracles.cpp +++ b/src/cc/oracles.cpp @@ -645,7 +645,7 @@ bool OraclesDataValidate(struct CCcontract_info *cp,Eval* eval,const CTransactio /*nt32_t GetLatestTimestamp(int32_t height) { if ( HUSH_NSPV_SUPERLITE ) return (NSPV_blocktime(height)); - return(komodo_heightstamp(height)); + return(hush_heightstamp(height)); } */ bool OraclesValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx, uint32_t nIn) diff --git a/src/cc/prices.cpp b/src/cc/prices.cpp index 6a9779050..e449f207f 100644 --- a/src/cc/prices.cpp +++ b/src/cc/prices.cpp @@ -659,7 +659,7 @@ static std::string prices_getsourceexpression(const std::vector &vec) uint16_t opcode = vec[i]; int32_t value = (opcode & (HUSH_MAXPRICES - 1)); // index or weight - switch (opcode & KOMODO_PRICEMASK) + switch (opcode & HUSH_PRICEMASK) { case 0: // indices komodo_pricename(name, value); @@ -949,7 +949,7 @@ int32_t prices_syntheticvec(std::vector &vec, std::vector } depth -= need; ///std::cerr << "prices_syntheticvec() opcode=" << opcode << " opstr=" << opstr << " need=" << need << " depth=" << depth << std::endl; - if ((opcode & KOMODO_PRICEMASK) != PRICES_WEIGHT) { // skip weight + if ((opcode & HUSH_PRICEMASK) != PRICES_WEIGHT) { // skip weight depth++; // increase operands count ///std::cerr << "depth++=" << depth << std::endl; } @@ -997,8 +997,8 @@ int64_t prices_syntheticprice(std::vector vec, int32_t height, int32_t mpz_set_ui(mpzResult, 0); // clear result to test overflow (see below) - //std::cerr << "prices_syntheticprice" << " i=" << i << " mpzTotalPrice=" << mpz_get_si(mpzTotalPrice) << " value=" << value << " depth=" << depth << " opcode&KOMODO_PRICEMASK=" << (opcode & KOMODO_PRICEMASK) < 0 && !isInverted || leverage < 0 && isInverted) || @@ -2280,7 +2280,7 @@ static bool prices_isopposite(BetInfo p1, BetInfo p2) { int32_t value1 = (opcode1 & (HUSH_MAXPRICES - 1)); // index or weight int32_t value2 = (opcode2 & (HUSH_MAXPRICES - 1)); // index or weight - if ( (opcode1 & KOMODO_PRICEMASK) == 0 && (opcode2 & KOMODO_PRICEMASK) == 0 ) { + if ( (opcode1 & HUSH_PRICEMASK) == 0 && (opcode2 & HUSH_PRICEMASK) == 0 ) { char name1[65]; char name2[65]; if (komodo_pricename(name1, value1) && komodo_pricename(name2, value2)) { @@ -2292,10 +2292,10 @@ static bool prices_isopposite(BetInfo p1, BetInfo p2) { prices_splitpair(std::string(name1), upperquote1, bottomquote1); prices_splitpair(std::string(name2), upperquote2, bottomquote2); - bool isInverted1 = ((opcode1 & KOMODO_PRICEMASK) != PRICES_INV); - bool isInverted2 = ((opcode2 & KOMODO_PRICEMASK) != PRICES_INV); + bool isInverted1 = ((opcode1 & HUSH_PRICEMASK) != PRICES_INV); + bool isInverted2 = ((opcode2 & HUSH_PRICEMASK) != PRICES_INV); - if (/*upperquote1 == bottomquote2 && bottomquote1 == upperquote2 && (p1.leverage > 0 == p2.leverage > 0 || (opcode1 & KOMODO_PRICEMASK) == PRICES_INV == (opcode2 & KOMODO_PRICEMASK) == PRICES_INV) ||*/ + if (/*upperquote1 == bottomquote2 && bottomquote1 == upperquote2 && (p1.leverage > 0 == p2.leverage > 0 || (opcode1 & HUSH_PRICEMASK) == PRICES_INV == (opcode2 & HUSH_PRICEMASK) == PRICES_INV) ||*/ upperquote1 == upperquote2 && bottomquote1 == bottomquote2 && ((p1.leverage > 0) != (p2.leverage > 0) || isInverted1 != isInverted2) ) return true; } @@ -2313,7 +2313,7 @@ static std::string findMatchedBook(const std::vector &vecparsed, const int32_t value = (opcode & (HUSH_MAXPRICES - 1)); // filter index or weight = opcode & (2048-1) - if ((opcode & KOMODO_PRICEMASK) == 0) { + if ((opcode & HUSH_PRICEMASK) == 0) { char name[65]; if (komodo_pricename(name, value)) { auto it = bookmatched.find(std::string(name)); diff --git a/src/compat.h b/src/compat.h index 61ac03dd4..af902e705 100644 --- a/src/compat.h +++ b/src/compat.h @@ -2,7 +2,6 @@ // Copyright (c) 2009-2014 The Bitcoin Core 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. * * * @@ -42,7 +41,6 @@ #define FD_SETSIZE 1024 // max number of fds in fd_set #include // Must be included before mswsock.h and windows.h - #include #include #include @@ -85,10 +83,12 @@ typedef u_int SOCKET; #define S_IWUSR 0200 #endif #else +#undef MAX_PATH #define MAX_PATH 1024 #endif // As Solaris does not have the MSG_NOSIGNAL flag for send(2) syscall, it is defined as 0 +// Should we add support for PDP-11's too? - Duke #if !defined(HAVE_MSG_NOSIGNAL) && !defined(MSG_NOSIGNAL) #define MSG_NOSIGNAL 0 #endif diff --git a/src/hush.h b/src/hush.h index f013f2f5e..225f46259 100644 --- a/src/hush.h +++ b/src/hush.h @@ -25,7 +25,7 @@ // Todo: verify: reorgs, lollerskates #define HUSH_SMART_CHAINS_WAITNOTARIZE -#define KOMODO_PAXMAX (10000 * COIN) +#define HUSH_PAXMAX (10000 * COIN) extern int32_t NOTARIZED_HEIGHT; uint256 NOTARIZED_HASH,NOTARIZED_DESTTXID; @@ -545,9 +545,9 @@ int32_t komodo_voutupdate(bool fJustCheck,int32_t *isratificationp,int32_t notar { if ( i == 0 && j == 0 && memcmp(NOTARY_PUBKEY33,scriptbuf+1,33) == 0 && IS_HUSH_NOTARY != 0 ) { - printf("%s KOMODO_LASTMINED.%d -> %d\n",SMART_CHAIN_SYMBOL,KOMODO_LASTMINED,height); - prevKOMODO_LASTMINED = KOMODO_LASTMINED; - KOMODO_LASTMINED = height; + printf("%s HUSH_LASTMINED.%d -> %d\n",SMART_CHAIN_SYMBOL,HUSH_LASTMINED,height); + prevHUSH_LASTMINED = HUSH_LASTMINED; + HUSH_LASTMINED = height; } decode_hex(crypto555,33,(char *)CRYPTO555_PUBSECPSTR); /*for (k=0; k<33; k++) @@ -620,7 +620,7 @@ int32_t komodo_voutupdate(bool fJustCheck,int32_t *isratificationp,int32_t notar if ( j == 1 && opretlen >= len+offset-opoffset ) { memset(&MoMoMdata,0,sizeof(MoMoMdata)); - if ( matched == 0 && signedmask != 0 && bitweight(signedmask) >= KOMODO_MINRATIFY ) + if ( matched == 0 && signedmask != 0 && bitweight(signedmask) >= HUSH_MINRATIFY ) notarized = 1; if ( strcmp("PIZZA",ccdata.symbol) == 0 || strncmp("TXSCL",ccdata.symbol,5) == 0 || strcmp("BEER",ccdata.symbol) == 0) notarized = 1; @@ -777,13 +777,13 @@ int32_t komodo_voutupdate(bool fJustCheck,int32_t *isratificationp,int32_t notar /*int32_t komodo_isratify(int32_t isspecial,int32_t numvalid) { - if ( isspecial != 0 && numvalid >= KOMODO_MINRATIFY ) + if ( isspecial != 0 && numvalid >= HUSH_MINRATIFY ) return(1); else return(0); }*/ // Special tx have vout[0] -> CRYPTO555 address -// with more than KOMODO_MINRATIFY pay2pubkey outputs -> ratify +// with more than HUSH_MINRATIFY pay2pubkey outputs -> ratify // if all outputs to notary -> notary utxo // if txi == 0 && 2 outputs and 2nd OP_RETURN, len == 32*2+4 -> notarized, 1st byte 'P' -> pricefeed // OP_RETURN: 'D' -> deposit, 'W' -> withdraw @@ -880,8 +880,8 @@ int32_t hush_connectblock(bool fJustCheck, CBlockIndex *pindex,CBlock& block) } //else printf("cant get scriptPubKey for ht.%d txi.%d vin.%d\n",height,i,j); } numvalid = bitweight(signedmask); - if ( ((height < 90000 || (signedmask & 1) != 0) && numvalid >= KOMODO_MINRATIFY) || - (numvalid >= KOMODO_MINRATIFY && SMART_CHAIN_SYMBOL[0] != 0) || + if ( ((height < 90000 || (signedmask & 1) != 0) && numvalid >= HUSH_MINRATIFY) || + (numvalid >= HUSH_MINRATIFY && SMART_CHAIN_SYMBOL[0] != 0) || numvalid > (numnotaries/5) ) { if ( !fJustCheck && SMART_CHAIN_SYMBOL[0] != 0) @@ -984,7 +984,7 @@ int32_t hush_connectblock(bool fJustCheck, CBlockIndex *pindex,CBlock& block) } if ( SMART_CHAIN_SYMBOL[0] != 0 || height < 100000 ) { - if ( ((signedmask & 1) != 0 && numvalid >= KOMODO_MINRATIFY) || bitweight(signedmask) > (numnotaries/3) ) + if ( ((signedmask & 1) != 0 && numvalid >= HUSH_MINRATIFY) || bitweight(signedmask) > (numnotaries/3) ) { memset(&txhash,0,sizeof(txhash)); hush_stateupdate(height,pubkeys,numvalid,0,txhash,0,0,0,0,0,0,0,0,0,0,zero,0); diff --git a/src/hush_bitcoind.h b/src/hush_bitcoind.h index 375942951..f3be69c98 100644 --- a/src/hush_bitcoind.h +++ b/src/hush_bitcoind.h @@ -31,8 +31,7 @@ bool EnsureWalletIsAvailable(bool avoidException); extern bool fRequestShutdown; extern CScript HUSH_EARLYTXID_SCRIPTPUB; -uint8_t DecodeMaramaraCoinbaseOpRet(const CScript scriptPubKey,CPubKey &pk,int32_t &height,int32_t &unlockht); -uint32_t komodo_heightstamp(int32_t height); +uint32_t hush_heightstamp(int32_t height); //#define issue_curl(cmdstr) bitcoind_RPC(0,(char *)"curl",(char *)"http://127.0.0.1:7776",0,0,(char *)(cmdstr)) @@ -672,28 +671,6 @@ uint32_t komodo_txtime2(uint64_t *valuep,uint256 hash,int32_t n,char *destaddr) return(txtime); } -int32_t komodo_WhoStaked(CBlock *pblock, CTxDestination &addressout) -{ - int32_t n,vout; uint32_t txtime; uint64_t value; char voutaddr[64],destaddr[64]; CTxDestination voutaddress; uint256 txid; CScript opret; - if ( (n= pblock->vtx.size()) > 1 && pblock->vtx[n-1].vin.size() == 1 && pblock->vtx[n-1].vout.size() == 1 ) - { - txid = pblock->vtx[n-1].vin[0].prevout.hash; - vout = pblock->vtx[n-1].vin[0].prevout.n; - txtime = komodo_txtime(opret,&value,txid,vout,destaddr); - if ( ExtractDestination(pblock->vtx[n-1].vout[0].scriptPubKey,voutaddress) ) - { - strcpy(voutaddr,CBitcoinAddress(voutaddress).ToString().c_str()); - if ( strcmp(destaddr,voutaddr) == 0 && pblock->vtx[n-1].vout[0].nValue == value ) - { - //fprintf(stderr,"is PoS block!\n"); - addressout = voutaddress; - return(1); - } - } - } - return(0); -} - bool komodo_checkopret(CBlock *pblock, CScript &merkleroot) { merkleroot = pblock->vtx.back().vout.back().scriptPubKey; @@ -728,7 +705,7 @@ void komodo_disconnect(CBlockIndex *pindex,CBlock& block) { //sp->rewinding = pindex->GetHeight(); //fprintf(stderr,"-%d ",pindex->GetHeight()); - } else printf("komodo_disconnect: ht.%d cant get hush_state.(%s)\n",pindex->GetHeight(),SMART_CHAIN_SYMBOL); + } else printf("hush_disconnect: ht.%d cant get hush_state.(%s)\n",pindex->GetHeight(),SMART_CHAIN_SYMBOL); } int32_t hush_is_notarytx(const CTransaction& tx) @@ -851,12 +828,12 @@ CBlockIndex *hush_chainactive(int32_t height) return(0); } -uint32_t komodo_heightstamp(int32_t height) +uint32_t hush_heightstamp(int32_t height) { CBlockIndex *ptr; if ( height > 0 && (ptr= hush_chainactive(height)) != 0 ) return(ptr->nTime); - //else fprintf(stderr,"komodo_heightstamp null ptr for block.%d\n",height); + //else fprintf(stderr,"hush_heightstamp null ptr for block.%d\n",height); return(0); } @@ -1285,14 +1262,14 @@ uint64_t the_commission(const CBlock *pblock,int32_t height) return(commission); } -uint32_t komodo_segid32(char *coinaddr) +uint32_t hush_segid32(char *coinaddr) { bits256 addrhash; vcalc_sha256(0,(uint8_t *)&addrhash,(uint8_t *)coinaddr,(int32_t)strlen(coinaddr)); return(addrhash.uints[0]); } -int8_t komodo_segid(int32_t nocache,int32_t height) +int8_t hush_segid(int32_t nocache,int32_t height) { CTxDestination voutaddress; CBlock block; CBlockIndex *pindex; uint64_t value; uint32_t txtime; char voutaddr[64],destaddr[64]; int32_t txn_count,vout; uint256 txid; CScript opret; int8_t segid = -1; if ( height > 0 && (pindex= hush_chainactive(height)) != 0 ) @@ -1312,18 +1289,18 @@ int8_t komodo_segid(int32_t nocache,int32_t height) strcpy(voutaddr,CBitcoinAddress(voutaddress).ToString().c_str()); if ( strcmp(destaddr,voutaddr) == 0 && block.vtx[txn_count-1].vout[0].nValue == value ) { - segid = komodo_segid32(voutaddr) & 0x3f; + segid = hush_segid32(voutaddr) & 0x3f; pindex->segid = segid; - //fprintf(stderr,"komodo_segid.(%d) -> %d\n",height,pindex->segid); + //fprintf(stderr,"hush_segid.(%d) -> %d\n",height,pindex->segid); } - } else fprintf(stderr,"komodo_segid ht.%d couldnt extract voutaddress\n",height); + } else fprintf(stderr,"hush_segid ht.%d couldnt extract voutaddress\n",height); } } } return(segid); } -void komodo_segids(uint8_t *hashbuf,int32_t height,int32_t n) +void hush_segids(uint8_t *hashbuf,int32_t height,int32_t n) { static uint8_t prevhashbuf[100]; static int32_t prevheight; int32_t i; @@ -1334,7 +1311,7 @@ void komodo_segids(uint8_t *hashbuf,int32_t height,int32_t n) memset(hashbuf,0xff,n); for (i=0; i= 0 ) + if ( hush_segid(0,ht) >= 0 ) { n++; percPoS++; @@ -1487,93 +1453,8 @@ arith_uint256 komodo_PoWtarget(int32_t *percPoSp,arith_uint256 target,int32_t he return(bnTarget); } -uint32_t komodo_stake(int32_t validateflag,arith_uint256 bnTarget,int32_t nHeight,uint256 txid,int32_t vout,uint32_t blocktime,uint32_t prevtime,char *destaddr,int32_t PoSperc) -{ - bool fNegative,fOverflow; uint8_t hashbuf[256]; char address[64]; bits256 addrhash; arith_uint256 hashval,mindiff,ratio,coinage256; uint256 hash,pasthash; int32_t segid,minage,i,iter=0; int64_t diff=0; uint32_t txtime,segid32,winner = 0 ; uint64_t value,coinage; - txtime = komodo_txtime2(&value,txid,vout,address); - if ( validateflag == 0 ) - { - //fprintf(stderr,"blocktime.%u -> ",blocktime); - if ( blocktime < prevtime+3 ) - blocktime = prevtime+3; - if ( blocktime < GetTime()-60 ) - blocktime = GetTime()+30; - //fprintf(stderr,"blocktime.%u txtime.%u\n",blocktime,txtime); - } - if ( value == 0 || txtime == 0 || blocktime == 0 || prevtime == 0 ) - { - //fprintf(stderr,"komodo_stake null %.8f %u %u %u\n",dstr(value),txtime,blocktime,prevtime); - return(0); - } - if ( value < SATOSHIDEN ) - return(0); - value /= SATOSHIDEN; - mindiff.SetCompact(STAKING_MIN_DIFF,&fNegative,&fOverflow); - ratio = (mindiff / bnTarget); - if ( (minage= nHeight*3) > 6000 ) // about 100 blocks - minage = 6000; - komodo_segids(hashbuf,nHeight-101,100); - segid32 = komodo_stakehash(&hash,address,hashbuf,txid,vout); - segid = ((nHeight + segid32) & 0x3f); - for (iter=0; iter<600; iter++) - { - if ( blocktime+iter+segid*2 < txtime+minage ) - continue; - diff = (iter + blocktime - txtime - minage); - if ( diff < 0 ) - diff = 60; - else if ( diff > 3600*24*30 ) - { - //printf("diff.%d (iter.%d blocktime.%u txtime.%u minage.%d)\n",(int32_t)diff,iter,blocktime,txtime,(int32_t)minage); - diff = 3600*24*30; - } - if ( iter > 0 ) - diff += segid*2; - coinage = (value * diff); - if ( blocktime+iter+segid*2 > prevtime+480 ) - coinage *= ((blocktime+iter+segid*2) - (prevtime+400)); - coinage256 = arith_uint256(coinage+1); - hashval = ratio * (UintToArith256(hash) / coinage256); - if ( hashval <= bnTarget ) - { - winner = 1; - if ( validateflag == 0 ) - { - //fprintf(stderr,"winner blocktime.%u iter.%d segid.%d\n",blocktime,iter,segid); - blocktime += iter; - blocktime += segid * 2; - } - break; - } - if ( validateflag != 0 ) - { - /*for (i=31; i>=24; i--) - fprintf(stderr,"%02x",((uint8_t *)&hashval)[i]); - fprintf(stderr," vs "); - for (i=31; i>=24; i--) - fprintf(stderr,"%02x",((uint8_t *)&bnTarget)[i]); - fprintf(stderr," segid.%d iter.%d winner.%d coinage.%llu %d ht.%d t.%u v%d diff.%d\n",segid,iter,winner,(long long)coinage,(int32_t)(blocktime - txtime),nHeight,blocktime,(int32_t)value,(int32_t)diff); */ - break; - } - } - //fprintf(stderr,"iterated until i.%d winner.%d\n",i,winner); - if ( 0 && validateflag != 0 ) - { - for (i=31; i>=24; i--) - fprintf(stderr,"%02x",((uint8_t *)&hashval)[i]); - fprintf(stderr," vs "); - for (i=31; i>=24; i--) - fprintf(stderr,"%02x",((uint8_t *)&bnTarget)[i]); - fprintf(stderr," segid.%d iter.%d winner.%d coinage.%llu %d ht.%d t.%u v%d diff.%d ht.%d\n",segid,iter,winner,(long long)coinage,(int32_t)(blocktime - txtime),nHeight,blocktime,(int32_t)value,(int32_t)diff,nHeight); - } - if ( nHeight < 10 ) - return(blocktime); - return(blocktime * winner); -} - +// lulz int32_t komodo_is_PeiceOfShit() { return(1); } -bool GetStakeParams(const CTransaction &stakeTx, CStakeParams &stakeParams); -bool ValidateMatchingStake(const CTransaction &ccTx, uint32_t voutNum, const CTransaction &stakeTx, bool &cheating); uint64_t komodo_notarypayamount(int32_t nHeight, int64_t notarycount) { @@ -1908,13 +1789,13 @@ int64_t komodo_checkcommission(CBlock *pblock,int32_t height) return(checktoshis); } -bool KOMODO_TEST_ASSETCHAIN_SKIP_POW = 0; +bool HUSH_TEST_ASSETCHAIN_SKIP_POW = 0; int32_t komodo_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height) { uint256 hash,merkleroot; arith_uint256 bnTarget,bhash; bool fNegative,fOverflow; uint8_t *script,pubkey33[33],pubkeys[64][33]; int32_t i,scriptlen,possible,PoSperc,is_PoSblock=0,n,failed = 0,notaryid = -1; int64_t checktoshis,value; CBlockIndex *pprev; - if ( KOMODO_TEST_ASSETCHAIN_SKIP_POW == 0 && Params().NetworkIDString() == "regtest" ) - KOMODO_TEST_ASSETCHAIN_SKIP_POW = 1; + if ( HUSH_TEST_ASSETCHAIN_SKIP_POW == 0 && Params().NetworkIDString() == "regtest" ) + HUSH_TEST_ASSETCHAIN_SKIP_POW = 1; if ( !CheckEquihashSolution(pblock, Params()) ) { fprintf(stderr,"komodo_checkPOW slowflag.%d ht.%d CheckEquihashSolution failed\n",slowflag,height); @@ -1950,7 +1831,7 @@ int32_t komodo_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height) } } } else if ( possible == 0 || SMART_CHAIN_SYMBOL[0] != 0 ) { - if ( KOMODO_TEST_ASSETCHAIN_SKIP_POW ) + if ( HUSH_TEST_ASSETCHAIN_SKIP_POW ) return(0); if ( ASSETCHAINS_STAKED == 0 ) return(-1); diff --git a/src/hush_defs.h b/src/hush_defs.h index 3c5191ea8..7bf98cff7 100644 --- a/src/hush_defs.h +++ b/src/hush_defs.h @@ -497,13 +497,9 @@ extern uint16_t ASSETCHAINS_P2PPORT,ASSETCHAINS_RPCPORT; extern uint32_t ASSETCHAIN_INIT, ASSETCHAINS_MAGIC; extern int32_t ASSETCHAINS_LWMAPOS, ASSETCHAINS_SAPLING, ASSETCHAINS_OVERWINTER,ASSETCHAINS_BLOCKTIME; extern uint64_t ASSETCHAINS_SUPPLY, ASSETCHAINS_FOUNDERS_REWARD; - extern int32_t ASSETCHAINS_LWMAPOS, ASSETCHAINS_SAPLING, ASSETCHAINS_OVERWINTER,ASSETCHAINS_BLOCKTIME; -extern int32_t KOMODO_BLOCK_POSUNITS, KOMODO_CONSECUTIVE_POS_THRESHOLD, KOMODO_NOPOS_THRESHHOLD; - extern uint64_t ASSETCHAINS_TIMELOCKGTE; extern uint32_t ASSETCHAINS_ALGO,ASSETCHAINS_EQUIHASH,HUSH_INITDONE; - extern int32_t HUSH_MININGTHREADS,HUSH_LONGESTCHAIN,ASSETCHAINS_SEED,IS_HUSH_NOTARY,USE_EXTERNAL_PUBKEY,HUSH_CHOSEN_ONE,KOMODO_ON_DEMAND,HUSH_PASSPORT_INITDONE,ASSETCHAINS_STAKED,HUSH_NSPV; extern uint64_t ASSETCHAINS_COMMISSION, ASSETCHAINS_LASTERA,ASSETCHAINS_CBOPRET; extern uint64_t ASSETCHAINS_REWARD[ASSETCHAINS_MAX_ERAS+1], ASSETCHAINS_NOTARY_PAY[ASSETCHAINS_MAX_ERAS+1], ASSETCHAINS_TIMELOCKGTE, ASSETCHAINS_NONCEMASK[],ASSETCHAINS_NK[2]; @@ -512,14 +508,11 @@ extern uint32_t ASSETCHAINS_NONCESHIFT[], ASSETCHAINS_HASHESPERROUND[]; extern std::string NOTARY_PUBKEY,ASSETCHAINS_OVERRIDE_PUBKEY,ASSETCHAINS_SCRIPTPUB; extern uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33],ASSETCHAINS_MARMARA; extern std::vector ASSETCHAINS_PRICES,ASSETCHAINS_STOCKS; - extern uint256 HUSH_EARLYTXID; - extern int32_t HUSH_CONNECTING,HUSH_CCACTIVATE,KOMODO_DEALERNODE; extern uint32_t ASSETCHAINS_CC; extern std::string CCerror,ASSETCHAINS_CCLIB; extern uint8_t ASSETCHAINS_CCDISABLES[256]; - extern int32_t USE_EXTERNAL_PUBKEY; extern std::string NOTARY_PUBKEY,NOTARY_ADDRESS; extern std::string DONATION_PUBKEY; @@ -551,15 +544,15 @@ int32_t komodo_kvsearch(uint256 *refpubkeyp,int32_t current_height,uint32_t *fla uint32_t hush_blocktime(uint256 hash); int32_t hush_longestchain(); int32_t hush_dpowconfs(int32_t height,int32_t numconfs); -int8_t komodo_segid(int32_t nocache,int32_t height); -int32_t komodo_heightpricebits(uint64_t *seedp,uint32_t *heightbits,int32_t nHeight); +int8_t hush_segid(int32_t nocache,int32_t height); +int32_t hush_heightpricebits(uint64_t *seedp,uint32_t *heightbits,int32_t nHeight); char *komodo_pricename(char *name,int32_t ind); int32_t komodo_priceind(const char *symbol); int32_t komodo_pricesinit(); int64_t komodo_priceave(int64_t *tmpbuf,int64_t *correlated,int32_t cskip); int64_t komodo_pricecorrelated(uint64_t seed,int32_t ind,uint32_t *rawprices,int32_t rawskip,uint32_t *nonzprices,int32_t smoothwidth); int32_t hush_nextheight(); -uint32_t komodo_heightstamp(int32_t height); +uint32_t hush_heightstamp(int32_t height); int64_t komodo_pricemult(int32_t ind); int32_t komodo_priceget(int64_t *buf64,int32_t ind,int32_t height,int32_t numblocks); int32_t hush_currentheight(); diff --git a/src/hush_events.h b/src/hush_events.h index 31655109a..a1c7c3513 100644 --- a/src/hush_events.h +++ b/src/hush_events.h @@ -135,11 +135,11 @@ void hush_event_rewind(struct hush_state *sp,char *symbol,int32_t height) struct hush_event *ep; if ( sp != 0 ) { - if ( SMART_CHAIN_SYMBOL[0] == 0 && height <= KOMODO_LASTMINED && prevKOMODO_LASTMINED != 0 ) + if ( SMART_CHAIN_SYMBOL[0] == 0 && height <= HUSH_LASTMINED && prevHUSH_LASTMINED != 0 ) { - printf("undo KOMODO_LASTMINED %d <- %d\n",KOMODO_LASTMINED,prevKOMODO_LASTMINED); - KOMODO_LASTMINED = prevKOMODO_LASTMINED; - prevKOMODO_LASTMINED = 0; + printf("undo HUSH_LASTMINED %d <- %d\n",HUSH_LASTMINED,prevHUSH_LASTMINED); + HUSH_LASTMINED = prevHUSH_LASTMINED; + prevHUSH_LASTMINED = 0; } while ( sp->Hush_events != 0 && sp->Hush_numeventss > 0 ) { diff --git a/src/hush_gateway.h b/src/hush_gateway.h index d1c245535..1db0cb454 100644 --- a/src/hush_gateway.h +++ b/src/hush_gateway.h @@ -119,7 +119,7 @@ void komodo_paxdelete(struct pax_transaction *pax) void komodo_gateway_deposit(char *coinaddr,uint64_t value,char *symbol,uint64_t fiatoshis,uint8_t *rmd160,uint256 txid,uint16_t vout,uint8_t type,int32_t height,int32_t otherheight,char *source,int32_t approved) // assetchain context { struct pax_transaction *pax; uint8_t buf[35]; int32_t addflag = 0; struct hush_state *sp; char str[HUSH_SMART_CHAIN_MAXLEN],dest[HUSH_SMART_CHAIN_MAXLEN],*s; - //if ( KOMODO_PAX == 0 ) + //if ( HUSH_PAX == 0 ) // return; //if ( strcmp(symbol,SMART_CHAIN_SYMBOL) != 0 ) // return; @@ -211,7 +211,7 @@ int32_t komodo_rwapproval(int32_t rwflag,uint8_t *opretbuf,struct pax_transactio int32_t komodo_issued_opreturn(char *base,uint256 *txids,uint16_t *vouts,int64_t *values,int64_t *srcvalues,int32_t *kmdheights,int32_t *otherheights,int8_t *baseids,uint8_t *rmd160s,uint8_t *opretbuf,int32_t opretlen,int32_t iskomodo) { struct pax_transaction p,*pax; int32_t i,n=0,j,len=0,incr,height,otherheight; uint8_t type,rmd160[20]; uint64_t fiatoshis; char symbol[HUSH_SMART_CHAIN_MAXLEN]; - //if ( KOMODO_PAX == 0 ) + //if ( HUSH_PAX == 0 ) // return(0); incr = 34 + (iskomodo * (2*sizeof(fiatoshis) + 2*sizeof(height) + 20 + 4)); //41e77b91cb68dc2aa02fa88550eae6b6d44db676a7e935337b6d1392d9718f03cb0200305c90660400000000fbcbeb1f000000bde801006201000058e7945ad08ddba1eac9c9b6c8e1e97e8016a2d152 @@ -304,7 +304,7 @@ int32_t komodo_paxcmp(char *symbol,int32_t kmdheight,uint64_t value,uint64_t che uint64_t komodo_paxtotal() { struct pax_transaction *pax,*pax2,*tmp,*tmp2; char symbol[HUSH_SMART_CHAIN_MAXLEN],dest[HUSH_SMART_CHAIN_MAXLEN],*str; int32_t i,ht; int64_t checktoshis; uint64_t seed,total = 0; struct hush_state *basesp; - if ( HUSH_PASSPORT_INITDONE == 0 ) //KOMODO_PAX == 0 || + if ( HUSH_PASSPORT_INITDONE == 0 ) //HUSH_PAX == 0 || return(0); if ( komodo_isrealtime(&ht) == 0 ) return(0); @@ -429,7 +429,7 @@ static int _paxorder(const void *a,const void *b) int32_t komodo_pending_withdraws(char *opretstr) // todo: enforce deterministic order { struct pax_transaction *pax,*pax2,*tmp,*paxes[64]; uint8_t opretbuf[16384*4]; int32_t i,n,ht,len=0; uint64_t total = 0; - if ( KOMODO_PAX == 0 || HUSH_PASSPORT_INITDONE == 0 ) + if ( HUSH_PAX == 0 || HUSH_PASSPORT_INITDONE == 0 ) return(0); if ( komodo_isrealtime(&ht) == 0 || SMART_CHAIN_SYMBOL[0] != 0 ) return(0); @@ -478,7 +478,7 @@ int32_t komodo_pending_withdraws(char *opretstr) // todo: enforce deterministic int32_t komodo_gateway_deposits(CMutableTransaction *txNew,char *base,int32_t tokomodo) { struct pax_transaction *pax,*tmp; char symbol[HUSH_SMART_CHAIN_MAXLEN],dest[HUSH_SMART_CHAIN_MAXLEN]; uint8_t *script,opcode,opret[16384*4],data[16384*4]; int32_t i,baseid,ht,len=0,opretlen=0,numvouts=1; struct hush_state *sp; uint64_t available,deposited,issued,withdrawn,approved,redeemed,mask,sum = 0; - if ( HUSH_PASSPORT_INITDONE == 0 )//KOMODO_PAX == 0 || + if ( HUSH_PASSPORT_INITDONE == 0 )//HUSH_PAX == 0 || return(0); struct hush_state *kmdsp = hush_stateptrget((char *)"KMD"); sp = hush_stateptr(symbol,dest); @@ -849,7 +849,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 komodo_kvupdate(opretbuf,opretlen,value); return("kv"); } - else if ( SMART_CHAIN_SYMBOL[0] == 0 && KOMODO_PAX == 0 ) + else if ( SMART_CHAIN_SYMBOL[0] == 0 && HUSH_PAX == 0 ) return("nopax"); if ( opretbuf[0] == 'D' ) { @@ -1223,7 +1223,7 @@ void hush_stateind_set(struct hush_state *sp,uint32_t *inds,int32_t n,uint8_t *f } else if ( func == 'V' ) { - if ( KOMODO_PAX != 0 && numv > numV-1440 ) + if ( HUSH_PAX != 0 && numv > numV-1440 ) doissue = 1; numv++; } @@ -1524,7 +1524,7 @@ void hush_passport_iteration() RTmask |= (1LL << baseid); memcpy(refsp->RTbufs[baseid+1],buf,sizeof(refsp->RTbufs[baseid+1])); } - else if ( KOMODO_PAX != 0 && (time(NULL)-buf[2]) > 60 && SMART_CHAIN_SYMBOL[0] != 0 ) + else if ( HUSH_PAX != 0 && (time(NULL)-buf[2]) > 60 && SMART_CHAIN_SYMBOL[0] != 0 ) fprintf(stderr,"[%s]: %s not RT %u %u %d\n",SMART_CHAIN_SYMBOL,base,buf[0],buf[1],(int32_t)(time(NULL)-buf[2])); } //else fprintf(stderr,"%s size error RT\n",base); fclose(fp); @@ -1606,7 +1606,7 @@ void komodo_PriceCache_shift() memcpy(PriceCache[0],Mineropret.data(),Mineropret.size()); } -int32_t _komodo_heightpricebits(uint64_t *seedp,uint32_t *heightbits,CBlock *block) +int32_t _hush_heightpricebits(uint64_t *seedp,uint32_t *heightbits,CBlock *block) { CTransaction tx; int32_t numvouts; std::vector vopret; tx = block->vtx[0]; @@ -1622,8 +1622,8 @@ int32_t _komodo_heightpricebits(uint64_t *seedp,uint32_t *heightbits,CBlock *blo return(-1); } -// komodo_heightpricebits() extracts the price data in the coinbase for nHeight -int32_t komodo_heightpricebits(uint64_t *seedp,uint32_t *heightbits,int32_t nHeight) +// hush_heightpricebits() extracts the price data in the coinbase for nHeight +int32_t hush_heightpricebits(uint64_t *seedp,uint32_t *heightbits,int32_t nHeight) { CBlockIndex *pindex; CBlock block; if ( seedp != 0 ) @@ -1632,7 +1632,7 @@ int32_t komodo_heightpricebits(uint64_t *seedp,uint32_t *heightbits,int32_t nHei { if ( komodo_blockload(block,pindex) == 0 ) { - return(_komodo_heightpricebits(seedp,heightbits,&block)); + return(_hush_heightpricebits(seedp,heightbits,&block)); } } fprintf(stderr,"couldnt get pricebits for %d\n",nHeight); @@ -1731,7 +1731,7 @@ CScript komodo_mineropret(int32_t nHeight) sleep(61); } } - if ( komodo_heightpricebits(0,prevbits,nHeight-1) > 0 ) + if ( hush_heightpricebits(0,prevbits,nHeight-1) > 0 ) { memcpy(pricebits,Mineropret.data(),Mineropret.size()); memset(maxflags,0,sizeof(maxflags)); @@ -1813,7 +1813,7 @@ int32_t komodo_opretvalidate(const CBlock *block,CBlockIndex * const previndex,i btcgbp = (double)pricebits[2]/10000; btceur = (double)pricebits[3]/10000; fprintf(stderr,"ht.%d: lag.%d %.4f USD, %.4f GBP, %.4f EUR, GBPUSD %.6f, EURUSD %.6f, EURGBP %.6f [%d]\n",nHeight,lag,btcusd,btcgbp,btceur,btcusd/btcgbp,btcusd/btceur,btcgbp/btceur,lag2); - if ( komodo_heightpricebits(0,prevbits,nHeight-1) > 0 ) + if ( hush_heightpricebits(0,prevbits,nHeight-1) > 0 ) { if ( nHeight < testchain_exemption ) { @@ -2743,7 +2743,7 @@ void komodo_pricesupdate(int32_t height,CBlock *pblock) tmpbuf = (int64_t *)calloc(sizeof(int64_t),2*PRICES_DAYWINDOW); fprintf(stderr,"prices update: numprices.%d %p %p\n",numprices,ptr32,ptr64); } - if ( _komodo_heightpricebits(&seed,rawprices,pblock) == numprices ) + if ( _hush_heightpricebits(&seed,rawprices,pblock) == numprices ) { //for (ind=0; ind KOMODO_PAXMAX ) + if ( basevolume > HUSH_PAXMAX ) { printf("paxcalc overflow %.8f\n",dstr(basevolume)); return(0); @@ -559,7 +559,7 @@ int32_t komodo_kmdbtcusd(int32_t rwflag,uint64_t *kmdbtcp,uint64_t *btcusdp,int3 uint64_t _komodo_paxpriceB(uint64_t seed,int32_t height,char *base,char *rel,uint64_t basevolume) { int32_t i,j,k,ind,zeroes,numvotes,wt,nonz; int64_t delta; uint64_t lastprice,tolerance,den,densum,sum=0,votes[sizeof(Peggy_inds)/sizeof(*Peggy_inds)],btcusds[sizeof(Peggy_inds)/sizeof(*Peggy_inds)],kmdbtcs[sizeof(Peggy_inds)/sizeof(*Peggy_inds)],kmdbtc,btcusd; - if ( basevolume > KOMODO_PAXMAX ) + if ( basevolume > HUSH_PAXMAX ) { printf("komodo_paxprice overflow %.8f\n",dstr(basevolume)); return(0); diff --git a/src/hush_structs.h b/src/hush_structs.h index 64a7689f3..6d872a7d1 100644 --- a/src/hush_structs.h +++ b/src/hush_structs.h @@ -28,7 +28,7 @@ #ifndef HUSH_STRUCTS_H #define HUSH_STRUCTS_H #define GENESIS_NBITS 0x1f00ffff -#define KOMODO_MINRATIFY ((height < 90000) ? 7 : 11) +#define HUSH_MINRATIFY ((height < 90000) ? 7 : 11) #define HUSH_NOTARIES_HARDCODED 180000 // DONT CHANGE #define HUSH_MAXBLOCKS 250000 // DONT CHANGE #define HUSH_EVENT_RATIFY 'P' diff --git a/src/main.cpp b/src/main.cpp index 60fefb404..beab6356a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3247,8 +3247,6 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin } bool fScriptChecks = (!fCheckpointsEnabled || pindex->GetHeight() >= Checkpoints::GetTotalBlocksEstimate(chainparams.Checkpoints())); - //if ( KOMODO_TESTNET_EXPIRATION != 0 && pindex->GetHeight() > KOMODO_TESTNET_EXPIRATION ) // "testnet" - // return(false); // Do not allow blocks that contain transactions which 'overwrite' older transactions, // unless those are already completely spent. BOOST_FOREACH(const CTransaction& tx, block.vtx) { diff --git a/src/miner.cpp b/src/miner.cpp index 80ec249d8..99b90cad9 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -980,7 +980,7 @@ int32_t komodo_baseid(char *origbase); int32_t komodo_eligiblenotary(uint8_t pubkeys[66][33],int32_t *mids,uint32_t *blocktimes,int32_t *nonzpkeysp,int32_t height); arith_uint256 komodo_PoWtarget(int32_t *percPoSp,arith_uint256 target,int32_t height,int32_t goalperc); int32_t FOUND_BLOCK,KOMODO_MAYBEMINED; -extern int32_t KOMODO_LASTMINED,HUSH_INSYNC; +extern int32_t HUSH_LASTMINED,HUSH_INSYNC; int32_t roundrobin_delay; arith_uint256 HASHTarget,HASHTarget_POW; @@ -1248,9 +1248,9 @@ void static BitcoinMiner() if ( mids[j] == notaryid ) break; if ( j == 65 ) - KOMODO_LASTMINED = 0; + HUSH_LASTMINED = 0; } else fprintf(stderr,"no nonz pubkeys\n"); - if ( (Mining_height >= 235300 && Mining_height < 236000) || (j == 65 && Mining_height > KOMODO_MAYBEMINED+1 && Mining_height > KOMODO_LASTMINED+64) ) + if ( (Mining_height >= 235300 && Mining_height < 236000) || (j == 65 && Mining_height > KOMODO_MAYBEMINED+1 && Mining_height > HUSH_LASTMINED+64) ) { HASHTarget = arith_uint256().SetCompact(HUSH_MINDIFF_NBITS); fprintf(stderr,"I am the chosen one for %s ht.%d\n",SMART_CHAIN_SYMBOL,pindexPrev->GetHeight()+1); diff --git a/src/net.h b/src/net.h index 8fa29d8cc..f9da3a9ff 100644 --- a/src/net.h +++ b/src/net.h @@ -42,7 +42,8 @@ #include #include #include -// Enable WolfSSL Support for Hush +// Enable side-channel resistant WolfSSL Support for Hush +#define ECC_TIMING_RESISTANT 420 #include #include diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index 8c3330d9d..5e4d5c024 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -151,7 +151,7 @@ UniValue blockheaderToJSON(const CBlockIndex* blockindex) result.push_back(Pair("bits", strprintf("%08x", blockindex->nBits))); result.push_back(Pair("difficulty", GetDifficulty(blockindex))); result.push_back(Pair("chainwork", blockindex->chainPower.chainWork.GetHex())); - result.push_back(Pair("segid", (int)komodo_segid(0,blockindex->GetHeight()))); + result.push_back(Pair("segid", (int)hush_segid(0,blockindex->GetHeight()))); if (blockindex->pprev) result.push_back(Pair("previousblockhash", blockindex->pprev->GetBlockHash().GetHex())); @@ -178,7 +178,7 @@ UniValue blockToDeltasJSON(const CBlock& block, const CBlockIndex* blockindex) result.push_back(Pair("height", blockindex->GetHeight())); result.push_back(Pair("version", block.nVersion)); result.push_back(Pair("merkleroot", block.hashMerkleRoot.GetHex())); - result.push_back(Pair("segid", (int)komodo_segid(0,blockindex->GetHeight()))); + result.push_back(Pair("segid", (int)hush_segid(0,blockindex->GetHeight()))); UniValue deltas(UniValue::VARR); @@ -299,7 +299,7 @@ UniValue blockToJSON(const CBlock& block, const CBlockIndex* blockindex, bool tx result.push_back(Pair("height", blockindex->GetHeight())); result.push_back(Pair("version", block.nVersion)); result.push_back(Pair("merkleroot", block.hashMerkleRoot.GetHex())); - result.push_back(Pair("segid", (int)komodo_segid(0,blockindex->GetHeight()))); + result.push_back(Pair("segid", (int)hush_segid(0,blockindex->GetHeight()))); result.push_back(Pair("finalsaplingroot", block.hashFinalSaplingRoot.GetHex())); UniValue txs(UniValue::VARR); BOOST_FOREACH(const CTransaction&tx, block.vtx) @@ -1105,12 +1105,12 @@ UniValue paxprice(const UniValue& params, bool fHelp, const CPubKey& mypk) { int32_t height,i,n,width,numpricefeeds = -1; uint64_t seed,ignore,rngval; uint32_t rawprices[1440*6],*ptr; int64_t *tmpbuf; width = numblocks+PRICES_DAYWINDOW*2+PRICES_SMOOTHWIDTH; // need 2*PRICES_DAYWINDOW previous raw price points to calc PRICES_DAYWINDOW correlated points to calc, in turn, smoothed point - komodo_heightpricebits(&seed,rawprices,firstheight + numblocks - 1); + hush_heightpricebits(&seed,rawprices,firstheight + numblocks - 1); if ( firstheight < width ) return(-1); for (i=0; i 0 ) + if ( (n= hush_heightpricebits(0,rawprices,ht)) > 0 ) { if ( n != numpricefeeds ) throw JSONRPCError(RPC_INVALID_PARAMETER, "numprices != first numprices"); diff --git a/src/rpc/misc.cpp b/src/rpc/misc.cpp index 0d6ad53e1..1a65565b7 100644 --- a/src/rpc/misc.cpp +++ b/src/rpc/misc.cpp @@ -62,17 +62,14 @@ int32_t hush_notarized_height(int32_t *prevMoMheightp,uint256 *hashp,uint256 *tx bool komodo_txnotarizedconfirmed(uint256 txid); uint32_t hush_chainactive_timestamp(); int32_t hush_whoami(char *pubkeystr,int32_t height,uint32_t timestamp); -extern int32_t KOMODO_LASTMINED,HUSH_LONGESTCHAIN,IS_HUSH_NOTARY,HUSH_INSYNC; +extern int32_t HUSH_LASTMINED,HUSH_LONGESTCHAIN,IS_HUSH_NOTARY,HUSH_INSYNC; extern char SMART_CHAIN_SYMBOL[HUSH_SMART_CHAIN_MAXLEN]; -uint32_t komodo_segid32(char *coinaddr); +uint32_t hush_segid32(char *coinaddr); int64_t hush_coinsupply(int64_t *zfundsp,int64_t *sproutfundsp,int32_t height); int32_t notarizedtxid_height(char *dest,char *txidstr,int32_t *hushnotarized_heightp); uint64_t komodo_notarypayamount(int32_t nHeight, int64_t notarycount); int32_t hush_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp); -// This is the last version of upstream that was merged in -// We only cherry-pick since then -#define KOMODO_VERSION "0.5.0" extern uint16_t ASSETCHAINS_P2PPORT,ASSETCHAINS_RPCPORT; extern uint32_t ASSETCHAINS_CC; extern uint32_t ASSETCHAINS_MAGIC,ASSETCHAINS_ALGO; @@ -280,8 +277,8 @@ UniValue getinfo(const UniValue& params, bool fHelp, const CPubKey& mypk) char pubkeystr[65]; int32_t notaryid; std::string notaryname; if( (notaryid= hush_whoami(pubkeystr,(int32_t)chainActive.LastTip()->GetHeight(),hush_chainactive_timestamp())) >= 0 ) { obj.push_back(Pair("notaryid", notaryid)); - if ( KOMODO_LASTMINED != 0 ) - obj.push_back(Pair("lastmined", KOMODO_LASTMINED)); + if ( HUSH_LASTMINED != 0 ) + obj.push_back(Pair("lastmined", HUSH_LASTMINED)); } obj.push_back(Pair("pubkey", NOTARY_PUBKEY)); } @@ -496,7 +493,7 @@ UniValue validateaddress(const UniValue& params, bool fHelp, const CPubKey& mypk CScript scriptPubKey = GetScriptForDestination(dest); ret.push_back(Pair("scriptPubKey", HexStr(scriptPubKey.begin(), scriptPubKey.end()))); - ret.push_back(Pair("segid", (int32_t)komodo_segid32((char *)params[0].get_str().c_str()) & 0x3f)); + ret.push_back(Pair("segid", (int32_t)hush_segid32((char *)params[0].get_str().c_str()) & 0x3f)); #ifdef ENABLE_WALLET isminetype mine = pwalletMain ? IsMine(*pwalletMain, dest) : ISMINE_NO; ret.push_back(Pair("ismine", (mine & ISMINE_SPENDABLE) ? true : false)); diff --git a/src/txdb.cpp b/src/txdb.cpp index e3fbe01e5..dc28b0512 100644 --- a/src/txdb.cpp +++ b/src/txdb.cpp @@ -426,7 +426,7 @@ bool CBlockTreeDB::ReadAddressIndex(uint160 addressHash, int type, } bool getAddressFromIndex(const int &type, const uint160 &hash, std::string &address); -uint32_t komodo_segid32(char *coinaddr); +uint32_t hush_segid32(char *coinaddr); #define DECLARE_IGNORELIST std::map ignoredMap = { \ {"RReUxSs5hGE39ELU23DfydX8riUuzdrHAE", 1}, \ @@ -580,7 +580,7 @@ UniValue CBlockTreeDB::Snapshot(int top) char amount[32]; sprintf(amount, "%.8f", (double) it->first / COIN); obj.push_back( make_pair("amount", amount) ); - obj.push_back( make_pair("segid",(int32_t)komodo_segid32((char *)it->second.c_str()) & 0x3f) ); + obj.push_back( make_pair("segid",(int32_t)hush_segid32((char *)it->second.c_str()) & 0x3f) ); addressesSorted.push_back(obj); topN++; // If requested, only show top N addresses in output JSON diff --git a/src/wallet-utility.cpp b/src/wallet-utility.cpp index 79017e645..059a1b84e 100644 --- a/src/wallet-utility.cpp +++ b/src/wallet-utility.cpp @@ -8,8 +8,8 @@ #include "base58.h" #include "wallet/crypter.h" #include - #include "hush_defs.h" + char SMART_CHAIN_SYMBOL[HUSH_SMART_CHAIN_MAXLEN]; int64_t MAX_MONEY = 200000000 * 100000000LL; uint64_t ASSETCHAINS_SUPPLY; @@ -19,12 +19,10 @@ uint32_t ASSETCHAIN_INIT,ASSETCHAINS_CC; uint32_t ASSETCHAINS_MAGIC = 2387029918; uint32_t ASSETCHAINS_EQUIHASH = 0; uint32_t ASSETCHAINS_ALGO = 0; -int32_t ASSETCHAINS_LWMAPOS = 0; -int32_t ASSETCHAINS_OVERWINTER = 227520; -int32_t ASSETCHAINS_SAPLING = 227520; -int32_t HUSH_TESTNODE = 0; -int32_t KOMODO_BLOCK_POSUNITS = 1000; - +int32_t ASSETCHAINS_LWMAPOS = 0; +int32_t ASSETCHAINS_OVERWINTER = 227520; +int32_t ASSETCHAINS_SAPLING = 227520; +int32_t HUSH_TESTNODE = 0; unsigned int MAX_BLOCK_SIGOPS = 20000; void show_help() diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index a8029feaf..a7cb28d4b 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -62,7 +62,7 @@ extern std::string ASSETCHAINS_OVERRIDE_PUBKEY; const std::string ADDR_TYPE_SAPLING = "sapling"; const std::string ADDR_TYPE_AMNESIA = "amnesia"; extern int32_t HUSH_INSYNC; -uint32_t komodo_segid32(char *coinaddr); +uint32_t hush_segid32(char *coinaddr); int32_t hush_dpowconfs(int32_t height,int32_t numconfs); int32_t hush_isnotaryvout(char *coinaddr,uint32_t tiptime); // from ac_private chains only CBlockIndex *komodo_getblockindex(uint256 hash); @@ -569,7 +569,7 @@ UniValue sendtoaddress(const UniValue& params, bool fHelp, const CPubKey& mypk) #define DRAGON_MAXSCRIPTSIZE 10001 uint64_t PAX_fiatdest(uint64_t *seedp,int32_t tokomodo,char *destaddr,uint8_t pubkey37[37],char *coinaddr,int32_t height,char *base,int64_t fiatoshis); int32_t komodo_opreturnscript(uint8_t *script,uint8_t type,uint8_t *opret,int32_t opretlen); -extern int32_t KOMODO_PAX; +extern int32_t HUSH_PAX; int32_t komodo_is_issuer(); int32_t dragon_rwnum(int32_t rwflag,uint8_t *serialized,int32_t len,void *endianedp); int32_t komodo_isrealtime(int32_t *kmdheightp); @@ -728,7 +728,7 @@ UniValue paxdeposit(const UniValue& params, bool fHelp, const CPubKey& mypk) { uint64_t available,deposited,issued,withdrawn,approved,redeemed,seed,komodoshis = 0; int32_t height; char destaddr[64]; uint8_t i,pubkey37[33]; bool fSubtractFeeFromAmount = false; - if ( KOMODO_PAX == 0 ) + if ( HUSH_PAX == 0 ) { throw runtime_error("paxdeposit disabled without -pax"); } @@ -2842,7 +2842,7 @@ UniValue resendwallettransactions(const UniValue& params, bool fHelp, const CPub return result; } -extern uint32_t komodo_segid32(char *coinaddr); +extern uint32_t hush_segid32(char *coinaddr); UniValue listunspent(const UniValue& params, bool fHelp, const CPubKey& mypk) { @@ -2946,7 +2946,7 @@ UniValue listunspent(const UniValue& params, bool fHelp, const CPubKey& mypk) if (fValidAddress) { entry.push_back(Pair("address", EncodeDestination(address))); - entry.push_back(Pair("segid", (int)komodo_segid32((char*)EncodeDestination(address).c_str()) & 0x3f )); + entry.push_back(Pair("segid", (int)hush_segid32((char*)EncodeDestination(address).c_str()) & 0x3f )); if (pwalletMain->mapAddressBook.count(address)) entry.push_back(Pair("account", pwalletMain->mapAddressBook[address].name)); @@ -7756,7 +7756,7 @@ UniValue getbalance64(const UniValue& params, bool fHelp, const CPubKey& mypk) nValue = out.tx->vout[out.i].nValue; if ( ExtractDestination(out.tx->vout[out.i].scriptPubKey, address) ) { - segid = (komodo_segid32((char *)CBitcoinAddress(address).ToString().c_str()) & 0x3f); + segid = (hush_segid32((char *)CBitcoinAddress(address).ToString().c_str()) & 0x3f); if ( out.nDepth < 100 ) nValues2[segid] += nValue, total2 += nValue; else nValues[segid] += nValue, total += nValue;