From 3c41ff9a17ffec36f88fe407ac4a840c820dee6b Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 14 Jun 2019 01:08:07 +0800 Subject: [PATCH 01/49] fix oracles crash? --- src/cc/oracles.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/cc/oracles.cpp b/src/cc/oracles.cpp index 193f66a1a..2a89fe536 100644 --- a/src/cc/oracles.cpp +++ b/src/cc/oracles.cpp @@ -638,11 +638,7 @@ bool OraclesDataValidate(struct CCcontract_info *cp,Eval* eval,const CTransactio int32_t GetLatestTimestamp(int32_t height) { - uint256 blockHash; CBlock block; CBlockIndex* pindex; - - blockHash = chainActive[height]->GetBlockHash(); - pindex = mapBlockIndex[blockHash]; - return(pindex->nTime); + return(komodo_heightstamp(height)); } bool OraclesValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx, uint32_t nIn) From 0d7c2f33fc80edf3419bf89b445483e23416c332 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 14 Jun 2019 01:16:59 +0800 Subject: [PATCH 02/49] try fix for chickenpool --- src/miner.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/miner.cpp b/src/miner.cpp index 9976909fa..312ee0a52 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -225,6 +225,7 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32 CBlockIndex* pindexPrev = 0; { + boost::this_thread::interruption_point(); // exit thread before entering locks. ENTER_CRITICAL_SECTION(cs_main); ENTER_CRITICAL_SECTION(mempool.cs); pindexPrev = chainActive.LastTip(); From f2645aed1ba5f92a121bced412ea5cb22b1260ed Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 14 Jun 2019 01:53:17 +0800 Subject: [PATCH 03/49] better fix --- src/miner.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index 312ee0a52..8ff4e2023 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -222,10 +222,13 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32 boost::optional cheatSpend; uint256 cbHash; - + + boost::this_thread::interruption_point(); // exit thread before entering locks. + CBlockIndex* pindexPrev = 0; { - boost::this_thread::interruption_point(); // exit thread before entering locks. + // this should stop create block ever exiting until it has returned something. + boost::this_thread::disable_interruption(); ENTER_CRITICAL_SECTION(cs_main); ENTER_CRITICAL_SECTION(mempool.cs); pindexPrev = chainActive.LastTip(); From 288074439ae078a991753f966915be0851636c35 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 14 Jun 2019 02:54:14 +0800 Subject: [PATCH 04/49] fix settting IS_KOMODO_NOTARY --- src/komodo_utils.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 94ac60515..6f8b1c59a 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1717,15 +1717,17 @@ void komodo_args(char *argv0) // I think on season change should reccomend notaries to use -notary to avoid needing this. int32_t kmd_season = getacseason(time(NULL)); for (i=0; i<64; i++) - if ( strcmp(NOTARY_PUBKEY.c_str(),notaries_elected[kmd_season][NUM_KMD_NOTARIES][1]) == 0 ) + { + if ( strcmp(NOTARY_PUBKEY.c_str(),notaries_elected[kmd_season-1][i][1]) == 0 ) { IS_KOMODO_NOTARY = 1; KOMODO_MININGTHREADS = 1; mapArgs ["-genproclimit"] = itostr(KOMODO_MININGTHREADS); IS_STAKED_NOTARY = -1; - fprintf(stderr,"running as notary.%d %s\n",i,notaries_elected[kmd_season][NUM_KMD_NOTARIES][0]); + fprintf(stderr,"running as notary.%d %s\n",i,notaries_elected[kmd_season-1][i][0]); break; } + } } } if ( IS_STAKED_NOTARY != -1 && IS_KOMODO_NOTARY == true ) { From b21eb999567115594f7e1f686c80fdea9eb9a16d Mon Sep 17 00:00:00 2001 From: Metaphilibert Date: Fri, 14 Jun 2019 03:12:01 +0200 Subject: [PATCH 05/49] Cosmetics for legacy view --- src/miner.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index 9976909fa..31345cdd7 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -1746,7 +1746,7 @@ void static BitcoinMiner() if ( (Mining_height >= 235300 && Mining_height < 236000) || (Mining_height % KOMODO_ELECTION_GAP) > 64 || (Mining_height % KOMODO_ELECTION_GAP) == 0 || Mining_height > 1000000 ) { int32_t dispflag = 0; - if ( notaryid <= 3 || notaryid == 32 || (notaryid >= 43 && notaryid <= 45) &¬aryid == 51 || notaryid == 52 || notaryid == 56 || notaryid == 57 ) + if ( notaryid <= 3 || notaryid == 32 || (notaryid >= 43 && notaryid <= 45) || notaryid == 51 || notaryid == 52 || notaryid == 56 || notaryid == 57 ) dispflag = 1; komodo_eligiblenotary(pubkeys,mids,blocktimes,&nonzpkeys,pindexPrev->GetHeight()); if ( nonzpkeys > 0 ) @@ -1769,8 +1769,12 @@ void static BitcoinMiner() if ( dispflag != 0 ) { if ( mids[j] >= 0 ) - fprintf(stderr,"%d ",mids[j]); - else fprintf(stderr,"GPU "); + { + if ( mids[j] == notaryid ) + fprintf(stderr,"--<%d>-- ",mids[j]); + else + fprintf(stderr,"%d ",mids[j]); + } else fprintf(stderr,"GPU "); } if ( mids[j] == -1 ) gpucount++; From 40ec8b3bacf19367ae67a4d00ba5ca6d1648b9a6 Mon Sep 17 00:00:00 2001 From: Mihailo Milenkovic Date: Sat, 15 Jun 2019 15:36:04 +0200 Subject: [PATCH 06/49] Add oraclessample rpc to get data for txid. --- src/cc/CCOracles.h | 1 + src/cc/oracles.cpp | 32 ++++++++++++++++++++++++++++++++ src/rpc/server.cpp | 1 + src/rpc/server.h | 1 + src/wallet/rpcwallet.cpp | 14 ++++++++++++++ 5 files changed, 49 insertions(+) diff --git a/src/cc/CCOracles.h b/src/cc/CCOracles.h index 9f6a35966..2f2b702f4 100644 --- a/src/cc/CCOracles.h +++ b/src/cc/CCOracles.h @@ -26,6 +26,7 @@ std::string OracleRegister(int64_t txfee,uint256 oracletxid,int64_t datafee); std::string OracleSubscribe(int64_t txfee,uint256 oracletxid,CPubKey publisher,int64_t amount); std::string OracleData(int64_t txfee,uint256 oracletxid,std::vector data); // CCcustom +UniValue OracleDataSample(uint256 reforacletxid,uint256 txid); UniValue OracleDataSamples(uint256 reforacletxid,char* batonaddr,int32_t num); UniValue OracleInfo(uint256 origtxid); UniValue OraclesList(); diff --git a/src/cc/oracles.cpp b/src/cc/oracles.cpp index 193f66a1a..6e58111fd 100644 --- a/src/cc/oracles.cpp +++ b/src/cc/oracles.cpp @@ -1059,6 +1059,38 @@ UniValue OracleFormat(uint8_t *data,int32_t datalen,char *format,int32_t formatl return(obj); } +UniValue OracleDataSample(uint256 reforacletxid,uint256 txid) +{ + UniValue result(UniValue::VOBJ); CTransaction tx,oracletx; uint256 hashBlock,btxid,oracletxid; std::string error; + CPubKey pk; std::string name,description,format; int32_t numvouts; std::vector data; char str[67], *formatstr = 0; + + result.push_back(Pair("result","success")); + if ( GetTransaction(reforacletxid,oracletx,hashBlock,false) != 0 && (numvouts=oracletx.vout.size()) > 0 ) + { + if ( DecodeOraclesCreateOpRet(oracletx.vout[numvouts-1].scriptPubKey,name,description,format) == 'C' ) + { + if ( GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts=tx.vout.size()) > 0 ) + { + if ( DecodeOraclesData(tx.vout[numvouts-1].scriptPubKey,oracletxid,btxid,pk,data) == 'D' && reforacletxid == oracletxid ) + { + if ( (formatstr= (char *)format.c_str()) == 0 ) + formatstr = (char *)""; + result.push_back(Pair("txid",uint256_str(str,txid))); + result.push_back(Pair("data",OracleFormat((uint8_t *)data.data(),(int32_t)data.size(),formatstr,(int32_t)format.size()))); + return(result); + } + else error="invalid data tx"; + } + else error="cannot find data txid"; + } + else error="invalid oracles txid"; + } + else error="cannot find oracles txid"; + result.push_back(Pair("result","error")); + result.push_back(Pair("error",error)); + return(result); +} + UniValue OracleDataSamples(uint256 reforacletxid,char* batonaddr,int32_t num) { UniValue result(UniValue::VOBJ),b(UniValue::VARR); CTransaction tx,oracletx; uint256 txid,hashBlock,btxid,oracletxid; diff --git a/src/rpc/server.cpp b/src/rpc/server.cpp index 5d7fd6d74..75360fd35 100644 --- a/src/rpc/server.cpp +++ b/src/rpc/server.cpp @@ -460,6 +460,7 @@ static const CRPCCommand vRPCCommands[] = { "oracles", "oraclesregister", &oraclesregister, true }, { "oracles", "oraclessubscribe", &oraclessubscribe, true }, { "oracles", "oraclesdata", &oraclesdata, true }, + { "oracles", "oraclessample", &oraclessample, true }, { "oracles", "oraclessamples", &oraclessamples, true }, // Prices diff --git a/src/rpc/server.h b/src/rpc/server.h index 27e7288cd..d447d2472 100644 --- a/src/rpc/server.h +++ b/src/rpc/server.h @@ -271,6 +271,7 @@ extern UniValue oraclesfund(const UniValue& params, bool fHelp); extern UniValue oraclesregister(const UniValue& params, bool fHelp); extern UniValue oraclessubscribe(const UniValue& params, bool fHelp); extern UniValue oraclesdata(const UniValue& params, bool fHelp); +extern UniValue oraclessample(const UniValue& params, bool fHelp); extern UniValue oraclessamples(const UniValue& params, bool fHelp); extern UniValue pricesaddress(const UniValue& params, bool fHelp); extern UniValue priceslist(const UniValue& params, bool fHelp); diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index bf861662f..949160a9e 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -6830,6 +6830,20 @@ UniValue oraclessubscribe(const UniValue& params, bool fHelp) return(result); } +UniValue oraclessample(const UniValue& params, bool fHelp) +{ + UniValue result(UniValue::VOBJ); uint256 oracletxid,txid; int32_t num; char *batonaddr; + if ( fHelp || params.size() != 2 ) + throw runtime_error("oraclessample oracletxid txid\n"); + if ( ensure_CCrequirements(EVAL_ORACLES) < 0 ) + throw runtime_error("to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet\n"); + const CKeyStore& keystore = *pwalletMain; + LOCK2(cs_main, pwalletMain->cs_wallet); + oracletxid = Parseuint256((char *)params[0].get_str().c_str()); + txid = Parseuint256((char *)params[1].get_str().c_str()); + return(OracleDataSample(oracletxid,txid)); +} + UniValue oraclessamples(const UniValue& params, bool fHelp) { UniValue result(UniValue::VOBJ); uint256 txid; int32_t num; char *batonaddr; From 103bca1ba7cae631d90c803be396dcfbe9d587f8 Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Sun, 16 Jun 2019 12:07:35 +0300 Subject: [PATCH 07/49] LoadBlockIndexDB speed-up for non-LWMAPOS chains (x5 perfomance boost) seems we had CChainPower classes compare here from Verus, it's slow, bcz of hard arith_uint256 math in bool operator<(const CChainPower &p1, const CChainPower &p2), this slows down setBlockIndexCandidates.insert operations in LoadBlockIndexDB(), so, for faster block index db loading we will use check from Verus only for LWMAPOS enabled chains. perfomance test (daemon load time from start): without fix - 3m42sec with fix - 39sec --- src/main.cpp | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 30783e2ab..e01cba61f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -147,10 +147,28 @@ namespace { struct CBlockIndexWorkComparator { - bool operator()(CBlockIndex *pa, CBlockIndex *pb) const { + bool operator()(const CBlockIndex *pa, const CBlockIndex *pb) const { // First sort by most total work, ... - if (pa->chainPower > pb->chainPower) return false; - if (pa->chainPower < pb->chainPower) return true; + + if (ASSETCHAINS_LWMAPOS) { + + /* Decker: + + seems we had CChainPower classes compare here from Verus, it's slow, bcz of hard + arith_uint256 math in bool operator<(const CChainPower &p1, const CChainPower &p2), + this slows down setBlockIndexCandidates.insert operations in LoadBlockIndexDB(), + so, for faster block index db loading we will use check from Verus only for LWMAPOS + enabled chains. + */ + + if (pa->chainPower > pb->chainPower) return false; + if (pa->chainPower < pb->chainPower) return true; + } + else + { + if (pa->chainPower.chainWork > pb->chainPower.chainWork) return false; + if (pa->chainPower.chainWork < pb->chainPower.chainWork) return true; + } // ... then by earliest time received, ... if (pa->nSequenceId < pb->nSequenceId) return false; @@ -173,8 +191,10 @@ namespace { * as good as our current tip or better. Entries may be failed, though, and pruning nodes may be * missing the data for the block. */ + + //set> setBlockIndexCandidates; set setBlockIndexCandidates; - + /** Number of nodes with fSyncStarted. */ int nSyncStarted = 0; From 958376b579dcb969c02e07ab3c01c99e5f874449 Mon Sep 17 00:00:00 2001 From: dimxy Date: Mon, 17 Jun 2019 11:28:01 +0500 Subject: [PATCH 08/49] convert vobj to string in cclib rpc to allow passing json param as vobj --- src/wallet/rpcwallet.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 949160a9e..6a47e71a0 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -5564,6 +5564,8 @@ UniValue cclibinfo(const UniValue& params, bool fHelp) UniValue cclib(const UniValue& params, bool fHelp) { struct CCcontract_info *cp,C; char *method,*jsonstr=0; uint8_t evalcode = EVAL_FIRSTUSER; + std::string vobjJsonSerialized; + if ( fHelp || params.size() > 3 ) throw runtime_error("cclib method [evalcode] [JSON params]\n"); if ( ASSETCHAINS_CCLIB.size() == 0 ) @@ -5583,7 +5585,12 @@ UniValue cclib(const UniValue& params, bool fHelp) } if ( params.size() == 3 ) { - jsonstr = (char *)params[2].get_str().c_str(); + if (params[2].getType() == UniValue::VOBJ) { + vobjJsonSerialized = params[2].write(0, 0); + jsonstr = (char *)vobjJsonSerialized.c_str(); + } + else // VSTR assumed + jsonstr = (char *)params[2].get_str().c_str(); //fprintf(stderr,"params.(%s %s %s)\n",params[0].get_str().c_str(),params[1].get_str().c_str(),jsonstr); } } From ba20fdc252795aa5866de4a694a68876e42884cb Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 18 Jun 2019 21:15:23 +0800 Subject: [PATCH 09/49] fix non determinate acccactivateht bug --- src/komodo_utils.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 6f8b1c59a..09f7fb6a0 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1692,7 +1692,7 @@ int8_t equihash_params_possible(uint64_t n, uint64_t k) void komodo_args(char *argv0) { - std::string name,addn,hexstr,symbol; char *dirname,fname[512],arg0str[64],magicstr[9]; uint8_t magic[4],extrabuf[32756],disablebits[32],*extraptr=0; FILE *fp; uint64_t val; uint16_t port; int32_t i,nonz=0,baseid,len,n,extralen = 0; uint64_t ccenables[256], ccEnablesHeight[512]; + std::string name,addn,hexstr,symbol; char *dirname,fname[512],arg0str[64],magicstr[9]; uint8_t magic[4],extrabuf[32756],disablebits[32],*extraptr=0; FILE *fp; uint64_t val; uint16_t port; int32_t i,nonz=0,baseid,len,n,extralen = 0; uint64_t ccenables[256], ccEnablesHeight[512] = {0}; IS_KOMODO_NOTARY = GetBoolArg("-notary", false); IS_STAKED_NOTARY = GetArg("-stakednotary", -1); memset(ccenables,0,sizeof(ccenables)); @@ -1769,7 +1769,7 @@ void komodo_args(char *argv0) { int32_t ecode = ccEnablesHeight[i]; int32_t ht = ccEnablesHeight[i+1]; - if ( ecode > 256 ) + if ( ecode > 256 || ecode < 0 ) fprintf(stderr, "ac_ccactivateht: invalid evalcode.%i must be between 0 and 256.\n", ecode); else if ( ht > 0 ) { From eca62bb4f39fd697db8d35487e95035a503f1fcd Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 18 Jun 2019 21:49:56 +0800 Subject: [PATCH 10/49] fix crash/lockup on KMD with mining pools when an old utxo makes IsFinalTx fail in TestBlockValidity. --- src/miner.cpp | 3 ++- src/rpc/mining.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index 8ff4e2023..e4e907447 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -819,7 +819,8 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32 LEAVE_CRITICAL_SECTION(cs_main); LEAVE_CRITICAL_SECTION(mempool.cs); } - throw std::runtime_error("CreateNewBlock(): TestBlockValidity failed"); + //throw std::runtime_error("CreateNewBlock(): TestBlockValidity failed"); // crashes the node, moved to GetBlockTemplate and issue return. + return(0); } //fprintf(stderr,"valid\n"); } diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp index 53a744497..4814d34dd 100644 --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -745,7 +745,8 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp) #endif ENTER_CRITICAL_SECTION(cs_main); if (!pblocktemplate) - throw JSONRPCError(RPC_OUT_OF_MEMORY, "Out of memory or no available utxo for staking"); + throw std::runtime_error("CreateNewBlock(): create block failed"); + //throw JSONRPCError(RPC_OUT_OF_MEMORY, "Out of memory or no available utxo for staking"); // Need to update only after we know CreateNewBlockWithKey succeeded pindexPrev = pindexPrevNew; From 42c0630807e34b015e53d806d6cdba2be57e0b4b Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 18 Jun 2019 22:28:45 +0800 Subject: [PATCH 11/49] fix eval code --- src/komodo_utils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 09f7fb6a0..d1a84d53c 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1769,7 +1769,7 @@ void komodo_args(char *argv0) { int32_t ecode = ccEnablesHeight[i]; int32_t ht = ccEnablesHeight[i+1]; - if ( ecode > 256 || ecode < 0 ) + if ( ecode > 255 || ecode < 0 ) fprintf(stderr, "ac_ccactivateht: invalid evalcode.%i must be between 0 and 256.\n", ecode); else if ( ht > 0 ) { From ed9ff35e7ad7deaed617b56fd107cc75c1137c03 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 23 Jun 2019 22:12:56 -1100 Subject: [PATCH 12/49] Misc syntax tweaks --- src/cc/crypto777/OS_portable.h | 12 ++++++------ src/cc/dapps/cJSON.c | 5 ++++- src/cc/dapps/zmigrate.c | 31 +++++++++++++++++-------------- src/cc/includes/curve25519.h | 2 +- 4 files changed, 28 insertions(+), 22 deletions(-) diff --git a/src/cc/crypto777/OS_portable.h b/src/cc/crypto777/OS_portable.h index aeb45bc32..e0b185cbc 100755 --- a/src/cc/crypto777/OS_portable.h +++ b/src/cc/crypto777/OS_portable.h @@ -206,12 +206,12 @@ void OS_nonportable_randombytes(uint8_t *x,long xlen); int32_t OS_nonportable_init(); #endif -void OS_portable_init(); -void OS_init(); +void OS_portable_init(void); +void OS_init(void); int32_t sortds(double *buf,uint32_t num,int32_t size); int32_t revsortds(double *buf,uint32_t num,int32_t size); -double OS_portable_milliseconds(); +double OS_portable_milliseconds(void); void OS_portable_randombytes(uint8_t *x,long xlen); int32_t OS_portable_truncate(char *fname,long filesize); char *OS_portable_path(char *str); @@ -256,7 +256,7 @@ int32_t OS_removefile(char *fname,int32_t scrubflag); void *OS_mapfile(char *fname,long *filesizep,int32_t enablewrite); int32_t OS_releasemap(void *ptr,unsigned long filesize); -double OS_milliseconds(); +double OS_milliseconds(void); void OS_randombytes(uint8_t *x,long xlen); //int32_t OS_syncmap(struct OS_mappedptr *mp,long len); @@ -313,7 +313,7 @@ void sort64s(uint64_t *buf,uint32_t num,int32_t size); void revsort64s(uint64_t *buf,uint32_t num,int32_t size); int decode_base32(uint8_t *token,uint8_t *tokenstr,int32_t len); int init_base32(char *tokenstr,uint8_t *token,int32_t len); -char *OS_mvstr(); +char *OS_mvstr(void); long _stripwhite(char *buf,int accept); int32_t is_DST(int32_t datenum); @@ -381,7 +381,7 @@ double dxblend(double *destp,double val,double decay); uint64_t calc_ipbits(char *ip_port); void expand_ipbits(char *ipaddr,uint64_t ipbits); void escape_code(char *escaped,char *str); -void SaM_PrepareIndices(); +void SaM_PrepareIndices(void); // iguana_serdes.c #ifndef IGUANA_LOG2PACKETSIZE diff --git a/src/cc/dapps/cJSON.c b/src/cc/dapps/cJSON.c index 62f46444c..e1d7801a1 100644 --- a/src/cc/dapps/cJSON.c +++ b/src/cc/dapps/cJSON.c @@ -40,7 +40,10 @@ long stripquotes(char *str) return(0); len = strlen(str); if ( str[0] == '"' && str[len-1] == '"' ) - str[len-1] = 0, offset = 1; + { + str[len-1] = 0; + offset = 1; + } else offset = 0; return(offset); } diff --git a/src/cc/dapps/zmigrate.c b/src/cc/dapps/zmigrate.c index ea8085822..f7d9e3feb 100644 --- a/src/cc/dapps/zmigrate.c +++ b/src/cc/dapps/zmigrate.c @@ -1041,6 +1041,7 @@ int32_t itemvalid(char *refcoin,int64_t *refundedp,int64_t *waitingp,struct clai *refundedp = *waitingp = 0; if ( item->refundvalue < 0 ) return(-1); + // change "kmd" -> %s, tolowerstr(refcoin) sprintf(url,"https://kmd.explorer.dexstats.info/insight-api-komodo/addr/%s",item->destaddr); if ( (retstr= send_curl(url,"/tmp/itemvalid")) != 0 ) { @@ -1061,7 +1062,7 @@ int32_t itemvalid(char *refcoin,int64_t *refundedp,int64_t *waitingp,struct clai } free_json(curljson); } - //printf("%s\n",retstr); + printf("%s\n",retstr); free(retstr); } if ( item->approved != 0 ) @@ -1086,18 +1087,19 @@ void scan_claims(int32_t issueflag,char *refcoin,int32_t batchid) else if ( batchid == 2 ) { batchmin = 1;//777 * SATOSHIDEN; - batchmax = 77777 * SATOSHIDEN; + batchmax = 5000 * SATOSHIDEN; } else if ( batchid == 3 ) { - batchmin = 77777 * SATOSHIDEN; - batchmax = 1000000 * SATOSHIDEN; + batchmin = 1;//117777 * SATOSHIDEN; + batchmax = 10000000 * SATOSHIDEN; } for (i=0; irefundvalue < batchmin || item->refundvalue >= batchmax ) continue; + printf("check.%d %s %.8f vs refund %.8f -> %s\n",batchid,item->oldaddr,dstr(item->total),dstr(item->refundvalue),item->destaddr); if ( itemvalid(refcoin,&refunded,&waiting,item) < 0 ) { if ( refunded != 0 ) @@ -1170,7 +1172,7 @@ int32_t update_claimvalue(int32_t *disputedp,char *addr,int64_t amount,bits256 t item = &CLAIMS[i]; item->refundvalue = amount; if ( bits256_nonz(item->txid) != 0 ) - printf("disputed.%d %s claimed %.8f vs %.8f\n",item->disputed,addr,dstr(item->total),dstr(amount)); + printf("disputed.%d (%s) %s claimed %.8f vs %.8f\n",item->disputed,item->username,addr,dstr(item->total),dstr(amount)); item->txid = txid; if ( item->disputed != 0 ) *disputedp = 1; @@ -1183,6 +1185,7 @@ int32_t update_claimvalue(int32_t *disputedp,char *addr,int64_t amount,bits256 t int64_t update_claimstats(char *username,char *oldaddr,char *destaddr,int64_t amount) { int32_t i; struct claimitem *item; + printf("claim user.(%s) (%s) -> (%s) %.8f\n",username,oldaddr,destaddr,dstr(amount)); for (i=0; idestaddr) != 0 )//|| strcmp(username,item->username) != 0 ) { item->disputed++; - printf("disputed.%d claim.%-4d: (%36s -> %36s %s) vs. (%36s -> %36s %s) \n",item->disputed,i,oldaddr,destaddr,username,item->oldaddr,item->destaddr,item->username); + printf("disputed.%d claim.%-4d: (%36s -> [%36s] %s) vs. (%36s -> [%36s] %s) \n",item->disputed,i,oldaddr,destaddr,username,item->oldaddr,item->destaddr,item->username); } item->numutxos++; item->total += amount; @@ -1258,14 +1261,14 @@ int64_t sum_of_vins(char *refcoin,int32_t *totalvinsp,int32_t *uniqaddrsp,bits25 return(total); } -void reconcile_claims(char *fname) +void reconcile_claims(char *refcoin,char *fname) { FILE *fp; double amount; int32_t i,n,numlines = 0; char buf[1024],fields[16][256],*str; int64_t total = 0; if ( (fp= fopen(fname,"rb")) != 0 ) { while ( fgets(buf,sizeof(buf),fp) > 0 ) { - //printf("%d.(%s)\n",numlines,buf); + printf("%d.(%s)\n",numlines,buf); str = buf; n = i = 0; memset(fields,0,sizeof(fields)); @@ -1277,7 +1280,7 @@ void reconcile_claims(char *fname) i = 0; if ( n > 1 ) { - //printf("(%16s) ",fields[n]); + printf("(%16s) ",fields[n]); } n++; if ( *str == '\n' || *str == '\r' ) @@ -1287,8 +1290,8 @@ void reconcile_claims(char *fname) str++; else fields[n][i++] = *str++; } - //printf("%s\n",fields[0]); - total += update_claimstats(fields[1],fields[3],fields[6],atof(fields[4])*SATOSHIDEN + 0.0000000049); + printf("%s\n",fields[1]); + total += update_claimstats(fields[1],fields[3],fields[5 + (strcmp("KMD",refcoin)==0)],atof(fields[4])*SATOSHIDEN + 0.0000000049); numlines++; } fclose(fp); @@ -1326,7 +1329,7 @@ int32_t main(int32_t argc,char **argv) if ( 1 )//strcmp(coinstr,"KMD") == 0 ) { sprintf(buf,"%s-Claims.csv",coinstr); - reconcile_claims(buf); + reconcile_claims(coinstr,buf); for (i=0; i> 3) * 2 + 1],uint8_t hash[256 >> 3],uint8_t *src,int32_t len); From f357d9eb1c0e4a3e72328ddc8cc538267f636b94 Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Mon, 24 Jun 2019 16:00:34 +0300 Subject: [PATCH 13/49] add convertpassphrase RPC method (convert Agama passphrases to WIF) --- src/wallet/rpcdump.cpp | 59 ++++++++++++++++++++++++++++++++++++++++ src/wallet/rpcwallet.cpp | 2 ++ 2 files changed, 61 insertions(+) diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp index 05552b50b..81ee82473 100644 --- a/src/wallet/rpcdump.cpp +++ b/src/wallet/rpcdump.cpp @@ -89,6 +89,65 @@ std::string DecodeDumpString(const std::string &str) { return ret.str(); } +UniValue convertpassphrase(const UniValue& params, bool fHelp) +{ + if (fHelp || params.size() < 1 || params.size() > 1) + throw runtime_error( + "convertpassphrase \"agamapassphrase\"\n" + "\nConverts Agama passphrase to a private key and WIF (for import with importprivkey).\n" + "\nArguments:\n" + "1. \"agamapassphrase\" (string, required) Agama passphrase\n" + "\nResult:\n" + "\"agamapassphrase\": \"agamapassphrase\", (string) Agama passphrase you entered\n" + "\"address\": \"komodoaddress\", (string) Address corresponding to your passphrase\n" + "\"pubkey\": \"publickeyhex\", (string) The hex value of the raw public key\n" + "\"privkey\": \"privatekeyhex\", (string) The hex value of the raw private key\n" + "\"wif\": \"wif\" (string) The private key in WIF format to use with 'importprivkey'\n" + "\nExamples:\n" + + HelpExampleCli("convertpassphrase", "\"agamapassphrase\"") + + HelpExampleRpc("convertpassphrase", "\"agamapassphrase\"") + ); + + bool fCompressed = true; + string strAgamaPassphrase = params[0].get_str(); + + UniValue ret(UniValue::VOBJ); + ret.push_back(Pair("agamapassphrase", strAgamaPassphrase)); + + CKey tempkey = DecodeSecret(strAgamaPassphrase); + /* first we should check if user pass wif to method, instead of passphrase */ + if (!tempkey.IsValid()) { + /* it's a passphrase, not wif */ + uint256 sha256; + CSHA256().Write((const unsigned char *)strAgamaPassphrase.c_str(), strAgamaPassphrase.length()).Finalize(sha256.begin()); + std::vector privkey(sha256.begin(), sha256.begin() + sha256.size()); + privkey.front() &= 0xf8; + privkey.back() &= 0x7f; + privkey.back() |= 0x40; + CKey key; + key.Set(privkey.begin(),privkey.end(), fCompressed); + CPubKey pubkey = key.GetPubKey(); + assert(key.VerifyPubKey(pubkey)); + CKeyID vchAddress = pubkey.GetID(); + + ret.push_back(Pair("address", EncodeDestination(vchAddress))); + ret.push_back(Pair("pubkey", HexStr(pubkey))); + ret.push_back(Pair("privkey", HexStr(privkey))); + ret.push_back(Pair("wif", EncodeSecret(key))); + } else { + /* seems it's a wif */ + CPubKey pubkey = tempkey.GetPubKey(); + assert(tempkey.VerifyPubKey(pubkey)); + CKeyID vchAddress = pubkey.GetID(); + ret.push_back(Pair("address", EncodeDestination(vchAddress))); + ret.push_back(Pair("pubkey", HexStr(pubkey))); + ret.push_back(Pair("privkey", HexStr(tempkey))); + ret.push_back(Pair("wif", strAgamaPassphrase)); + } + + return ret; +} + UniValue importprivkey(const UniValue& params, bool fHelp) { if (!EnsureWalletIsAvailable(fHelp)) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 6a47e71a0..ce377d094 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -7977,6 +7977,7 @@ UniValue heirlist(const UniValue& params, bool fHelp) extern UniValue dumpprivkey(const UniValue& params, bool fHelp); // in rpcdump.cpp +extern UniValue convertpassphrase(const UniValue& params, bool fHelp); extern UniValue importprivkey(const UniValue& params, bool fHelp); extern UniValue importaddress(const UniValue& params, bool fHelp); extern UniValue dumpwallet(const UniValue& params, bool fHelp); @@ -8012,6 +8013,7 @@ static const CRPCCommand commands[] = { "wallet", "gettransaction", &gettransaction, false }, { "wallet", "getunconfirmedbalance", &getunconfirmedbalance, false }, { "wallet", "getwalletinfo", &getwalletinfo, false }, + { "wallet", "convertpassphrase", &convertpassphrase, true }, { "wallet", "importprivkey", &importprivkey, true }, { "wallet", "importwallet", &importwallet, true }, { "wallet", "importaddress", &importaddress, true }, From 896b6fee53fe52eac6bc5cb9d65f1886d44dbed9 Mon Sep 17 00:00:00 2001 From: Alrighttt Date: Sun, 30 Jun 2019 15:38:27 +0200 Subject: [PATCH 14/49] fix createrawtransaction curl example --- src/rpc/rawtransaction.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index 578c2f9ad..7d490dff2 100644 --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -757,7 +757,7 @@ UniValue createrawtransaction(const UniValue& params, bool fHelp) "\nExamples\n" + HelpExampleCli("createrawtransaction", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\" \"{\\\"address\\\":0.01}\"") - + HelpExampleRpc("createrawtransaction", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\", \"{\\\"address\\\":0.01}\"") + + HelpExampleRpc("createrawtransaction", "[{\"txid\":\"myid\",\"vout\":0}], {\"address\":0.01}") ); LOCK(cs_main); From 5e6737fc389db5aec0ebedb99230478b4a49dc09 Mon Sep 17 00:00:00 2001 From: Alrighttt Date: Mon, 1 Jul 2019 19:03:52 +0200 Subject: [PATCH 15/49] add additional param to importprivkey for other WIF formats --- src/key_io.cpp | 16 ++++++++++++++++ src/key_io.h | 1 + src/rpc/client.cpp | 1 + src/wallet/rpcdump.cpp | 12 ++++++++++-- 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/key_io.cpp b/src/key_io.cpp index 014159d65..dd4176fee 100644 --- a/src/key_io.cpp +++ b/src/key_io.cpp @@ -207,6 +207,22 @@ CKey DecodeSecret(const std::string& str) return key; } +CKey DecodeCustomSecret(const std::string& str, uint8_t secret_key) +{ + CKey key; + std::vector data; + if (DecodeBase58Check(str, data)) { + const std::vector& privkey_prefix = std::vector(1, secret_key); + if ((data.size() == 32 + privkey_prefix.size() || (data.size() == 33 + privkey_prefix.size() && data.back() == 1)) && + std::equal(privkey_prefix.begin(), privkey_prefix.end(), data.begin())) { + bool compressed = data.size() == 33 + privkey_prefix.size(); + key.Set(data.begin() + privkey_prefix.size(), data.begin() + privkey_prefix.size() + 32, compressed); + } + } + memory_cleanse(data.data(), data.size()); + return key; +} + std::string EncodeSecret(const CKey& key) { assert(key.IsValid()); diff --git a/src/key_io.h b/src/key_io.h index 72823d57e..013469ab6 100644 --- a/src/key_io.h +++ b/src/key_io.h @@ -17,6 +17,7 @@ #include CKey DecodeSecret(const std::string& str); +CKey DecodeCustomSecret(const std::string& str, uint8_t secret_key); std::string EncodeSecret(const CKey& key); std::string EncodeCustomSecret(const CKey& key,uint8_t secret_key); diff --git a/src/rpc/client.cpp b/src/rpc/client.cpp index 3f0f9dea8..665887b3b 100644 --- a/src/rpc/client.cpp +++ b/src/rpc/client.cpp @@ -109,6 +109,7 @@ static const CRPCConvertParam vRPCConvertParams[] = { "lockunspent", 1 }, { "importprivkey", 2 }, { "importprivkey", 3 }, + { "importprivkey", 4 }, { "importaddress", 2 }, { "verifychain", 0 }, { "verifychain", 1 }, diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp index 05552b50b..10048c79e 100644 --- a/src/wallet/rpcdump.cpp +++ b/src/wallet/rpcdump.cpp @@ -94,7 +94,7 @@ UniValue importprivkey(const UniValue& params, bool fHelp) if (!EnsureWalletIsAvailable(fHelp)) return NullUniValue; - if (fHelp || params.size() < 1 || params.size() > 4) + if (fHelp || params.size() < 1 || params.size() > 5) throw runtime_error( "importprivkey \"komodoprivkey\" ( \"label\" rescan height)\n" "\nAdds a private key (as returned by dumpprivkey) to your wallet.\n" @@ -126,6 +126,7 @@ UniValue importprivkey(const UniValue& params, bool fHelp) string strSecret = params[0].get_str(); string strLabel = ""; int32_t height = 0; + uint8_t secret_key = 0; if (params.size() > 1) strLabel = params[1].get_str(); @@ -136,10 +137,17 @@ UniValue importprivkey(const UniValue& params, bool fHelp) if ( fRescan && params.size() == 4 ) height = params[3].get_int(); + CKey key = DecodeSecret(strSecret); + + if (params.size() > 4) + { + secret_key = params[4].get_int(); + CKey key = DecodeCustomSecret(strSecret, secret_key); + } + if ( height < 0 || height > chainActive.Height() ) throw JSONRPCError(RPC_WALLET_ERROR, "Rescan height is out of range."); - CKey key = DecodeSecret(strSecret); if (!key.IsValid()) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid private key encoding"); CPubKey pubkey = key.GetPubKey(); From 89874a01ce6a8fab42538275f8965b4e6f032830 Mon Sep 17 00:00:00 2001 From: Alrighttt Date: Mon, 1 Jul 2019 21:06:36 +0200 Subject: [PATCH 16/49] fix CKey declaration --- src/wallet/rpcdump.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp index 10048c79e..3bd54aff5 100644 --- a/src/wallet/rpcdump.cpp +++ b/src/wallet/rpcdump.cpp @@ -127,6 +127,7 @@ UniValue importprivkey(const UniValue& params, bool fHelp) string strLabel = ""; int32_t height = 0; uint8_t secret_key = 0; + CKey key; if (params.size() > 1) strLabel = params[1].get_str(); @@ -137,12 +138,13 @@ UniValue importprivkey(const UniValue& params, bool fHelp) if ( fRescan && params.size() == 4 ) height = params[3].get_int(); - CKey key = DecodeSecret(strSecret); if (params.size() > 4) { - secret_key = params[4].get_int(); - CKey key = DecodeCustomSecret(strSecret, secret_key); + auto secret_key = AmountFromValue(params[4])/100000000; + key = DecodeCustomSecret(strSecret, secret_key); + } else { + key = DecodeSecret(strSecret); } if ( height < 0 || height > chainActive.Height() ) From 8a958a275e7efd4215e09a75793f3e8a3940a75b Mon Sep 17 00:00:00 2001 From: Alrighttt Date: Mon, 1 Jul 2019 21:21:46 +0200 Subject: [PATCH 17/49] fix importprivkey help message --- src/wallet/rpcdump.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp index 3bd54aff5..b4a413f6d 100644 --- a/src/wallet/rpcdump.cpp +++ b/src/wallet/rpcdump.cpp @@ -96,13 +96,14 @@ UniValue importprivkey(const UniValue& params, bool fHelp) if (fHelp || params.size() < 1 || params.size() > 5) throw runtime_error( - "importprivkey \"komodoprivkey\" ( \"label\" rescan height)\n" + "importprivkey \"komodoprivkey\" ( \"label\" rescan height secret_key)\n" "\nAdds a private key (as returned by dumpprivkey) to your wallet.\n" "\nArguments:\n" "1. \"komodoprivkey\" (string, required) The private key (see dumpprivkey)\n" "2. \"label\" (string, optional, default=\"\") An optional label\n" "3. rescan (boolean, optional, default=true) Rescan the wallet for transactions\n" "4. height (integer, optional, default=0) start at block height?\n" + "5. secret_key (interger, optional, default=188) used to import WIFs of other coins\n" "\nNote: This call can take minutes to complete if rescan is true.\n" "\nExamples:\n" "\nDump a private key\n" @@ -115,6 +116,10 @@ UniValue importprivkey(const UniValue& params, bool fHelp) + HelpExampleRpc("importprivkey", "\"mykey\", \"testing\", false") + "\nImport with rescan from a block height\n" + HelpExampleCli("importprivkey", "\"mykey\" \"testing\" true 1000") + + "\nImport a BTC WIF with rescan\n" + + HelpExampleCli("importprivkey", "\"BTCWIF\" \"testing\" true 0 128") + + "\nImport a BTC WIF without rescan\n" + + HelpExampleCli("importprivkey", "\"BTCWIF\" \"testing\" false 0 128") + "\nAs a JSON-RPC call\n" + HelpExampleRpc("importprivkey", "\"mykey\", \"testing\", true, 1000") ); From abc90c501b4ec4914bb72afaff4317a9c16bdbd1 Mon Sep 17 00:00:00 2001 From: Alrighttt Date: Mon, 1 Jul 2019 21:41:53 +0200 Subject: [PATCH 18/49] typo, sorry --- src/wallet/rpcdump.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp index b4a413f6d..563fc875c 100644 --- a/src/wallet/rpcdump.cpp +++ b/src/wallet/rpcdump.cpp @@ -103,7 +103,7 @@ UniValue importprivkey(const UniValue& params, bool fHelp) "2. \"label\" (string, optional, default=\"\") An optional label\n" "3. rescan (boolean, optional, default=true) Rescan the wallet for transactions\n" "4. height (integer, optional, default=0) start at block height?\n" - "5. secret_key (interger, optional, default=188) used to import WIFs of other coins\n" + "5. secret_key (integer, optional, default=188) used to import WIFs of other coins\n" "\nNote: This call can take minutes to complete if rescan is true.\n" "\nExamples:\n" "\nDump a private key\n" From f4a001d2a2c63895ac1d02eec9c905234d27bf84 Mon Sep 17 00:00:00 2001 From: Mihail Fedorov Date: Tue, 2 Jul 2019 08:26:22 +0300 Subject: [PATCH 19/49] ip --- src/assetchains.old | 52 ++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/src/assetchains.old b/src/assetchains.old index 4cf427c4d..1784bf2e1 100755 --- a/src/assetchains.old +++ b/src/assetchains.old @@ -4,37 +4,37 @@ delay=60 source pubkey.txt echo $pubkey -./komodod -pubkey=$pubkey -ac_name=REVS -ac_supply=1300000 -addnode=78.47.196.146 $1 & -./komodod -pubkey=$pubkey -ac_name=SUPERNET -ac_supply=816061 -addnode=78.47.196.146 $1 & -./komodod -pubkey=$pubkey -ac_name=DEX -ac_supply=999999 -addnode=78.47.196.146 $1 & -./komodod -pubkey=$pubkey -ac_name=PANGEA -ac_supply=999999 -addnode=78.47.196.146 $1 & -./komodod -pubkey=$pubkey -ac_name=JUMBLR -ac_supply=999999 -addnode=78.47.196.146 $1 & -./komodod -pubkey=$pubkey -ac_name=BET -ac_supply=999999 -addnode=78.47.196.146 $1 & -./komodod -pubkey=$pubkey -ac_name=CRYPTO -ac_supply=999999 -addnode=78.47.196.146 $1 & -./komodod -pubkey=$pubkey -ac_name=HODL -ac_supply=9999999 -addnode=78.47.196.146 $1 & -./komodod -pubkey=$pubkey -ac_name=MSHARK -ac_supply=1400000 -addnode=78.47.196.146 $1 & -./komodod -pubkey=$pubkey -ac_name=BOTS -ac_supply=999999 -addnode=78.47.196.146 $1 & -./komodod -pubkey=$pubkey -ac_name=MGW -ac_supply=999999 -addnode=78.47.196.146 $1 & -./komodod -pubkey=$pubkey -ac_name=COQUI -ac_supply=72000000 -ac_ccactivate=200000 -addnode=78.47.196.146 $1 & -./komodod -pubkey=$pubkey -ac_name=WLC -ac_supply=210000000 -addnode=148.251.190.89 $1 & -./komodod -pubkey=$pubkey -ac_name=KV -ac_supply=1000000 -addnode=78.47.196.146 $1 & -./komodod -pubkey=$pubkey -ac_name=CEAL -ac_supply=366666666 -addnode=78.47.196.146 $1 & -./komodod -pubkey=$pubkey -ac_name=MESH -ac_supply=1000007 -addnode=78.47.196.146 $1 & -./komodod -pubkey=$pubkey -ac_name=AXO -ac_supply=200000000 -ac_ccactivate=130000 -addnode=78.47.196.146 & -./komodod -pubkey=$pubkey -ac_name=ETOMIC -ac_supply=100000000 -addnode=78.47.196.146 & -./komodod -pubkey=$pubkey -ac_name=BTCH -ac_supply=20998641 -addnode=78.47.196.146 & -./komodod -pubkey=$pubkey -ac_name=BEER -ac_supply=100000000 -addnode=78.47.196.146 & -./komodod -pubkey=$pubkey -ac_name=PIZZA -ac_supply=100000000 -addnode=78.47.196.146 & -./komodod -pubkey=$pubkey -ac_name=NINJA -ac_supply=100000000 -addnode=78.47.196.146 & -./komodod -pubkey=$pubkey -ac_name=OOT -ac_supply=216000000 -ac_sapling=5000000 -addnode=174.138.107.226 & -./komodod -pubkey=$pubkey -ac_name=BNTN -ac_supply=500000000 -addnode=94.130.169.205 & -./komodod -pubkey=$pubkey -ac_name=CHAIN -ac_supply=999999 -addnode=78.47.146.222 & +./komodod -pubkey=$pubkey -ac_name=REVS -ac_supply=1300000 -addnode=95.213.238.98 $1 & +./komodod -pubkey=$pubkey -ac_name=SUPERNET -ac_supply=816061 -addnode=95.213.238.98 $1 & +./komodod -pubkey=$pubkey -ac_name=DEX -ac_supply=999999 -addnode=95.213.238.98 $1 & +./komodod -pubkey=$pubkey -ac_name=PANGEA -ac_supply=999999 -addnode=95.213.238.98 $1 & +./komodod -pubkey=$pubkey -ac_name=JUMBLR -ac_supply=999999 -addnode=95.213.238.98 $1 & +./komodod -pubkey=$pubkey -ac_name=BET -ac_supply=999999 -addnode=95.213.238.98 $1 & +./komodod -pubkey=$pubkey -ac_name=CRYPTO -ac_supply=999999 -addnode=95.213.238.98 $1 & +./komodod -pubkey=$pubkey -ac_name=HODL -ac_supply=9999999 -addnode=95.213.238.98 $1 & +./komodod -pubkey=$pubkey -ac_name=MSHARK -ac_supply=1400000 -addnode=95.213.238.98 $1 & +./komodod -pubkey=$pubkey -ac_name=BOTS -ac_supply=999999 -addnode=95.213.238.98 $1 & +./komodod -pubkey=$pubkey -ac_name=MGW -ac_supply=999999 -addnode=95.213.238.98 $1 & +./komodod -pubkey=$pubkey -ac_name=COQUI -ac_supply=72000000 -ac_ccactivate=200000 -addnode=95.213.238.98 $1 & +./komodod -pubkey=$pubkey -ac_name=WLC -ac_supply=210000000 -addnode=95.213.238.98 $1 & +./komodod -pubkey=$pubkey -ac_name=KV -ac_supply=1000000 -addnode=95.213.238.98 $1 & +./komodod -pubkey=$pubkey -ac_name=CEAL -ac_supply=366666666 -addnode=95.213.238.98 $1 & +./komodod -pubkey=$pubkey -ac_name=MESH -ac_supply=1000007 -addnode=95.213.238.98 $1 & +./komodod -pubkey=$pubkey -ac_name=AXO -ac_supply=200000000 -ac_ccactivate=130000 -addnode=95.213.238.98 & +./komodod -pubkey=$pubkey -ac_name=ETOMIC -ac_supply=100000000 -addnode=95.213.238.98 & +./komodod -pubkey=$pubkey -ac_name=BTCH -ac_supply=20998641 -addnode=95.213.238.98 & +./komodod -pubkey=$pubkey -ac_name=BEER -ac_supply=100000000 -addnode=95.213.238.98 & +./komodod -pubkey=$pubkey -ac_name=PIZZA -ac_supply=100000000 -addnode=95.213.238.98 & +./komodod -pubkey=$pubkey -ac_name=NINJA -ac_supply=100000000 -addnode=95.213.238.98 & +./komodod -pubkey=$pubkey -ac_name=OOT -ac_supply=216000000 -ac_sapling=5000000 -addnode=95.213.238.98 & +./komodod -pubkey=$pubkey -ac_name=BNTN -ac_supply=500000000 -addnode=95.213.238.98 & +./komodod -pubkey=$pubkey -ac_name=CHAIN -ac_supply=999999 -addnode=95.213.238.98 & ./komodod -pubkey=$pubkey -ac_name=PRLPAY -ac_supply=500000000 -addnode=13.250.226.125 & ./komodod -pubkey=$pubkey -ac_name=DSEC -ac_supply=7000000 -addnode=185.148.147.30 & ./komodod -pubkey=$pubkey -ac_name=GLXT -ac_supply=10000000000 -addnode=13.230.224.15 & ./komodod -pubkey=$pubkey -ac_name=EQL -ac_supply=500000000 -ac_ccactivate=205000 -addnode=46.101.124.153 & ./komodod -pubkey=$pubkey -ac_name=ZILLA -ac_supply=11000000 -ac_sapling=5000000 -addnode=51.68.215.104 & -./komodod -pubkey=$pubkey -ac_name=RFOX -ac_supply=1000000000 -ac_reward=100000000 -addnode=78.47.196.146 & +./komodod -pubkey=$pubkey -ac_name=RFOX -ac_supply=1000000000 -ac_reward=100000000 -addnode=95.213.238.98 & ~/VerusCoin/src/komodod -pubkey=$pubkey -ac_name=VRSC -ac_algo=verushash -ac_cc=1 -ac_veruspos=50 -ac_supply=0 -ac_eras=3 -ac_reward=0,38400000000,2400000000 -ac_halving=1,43200,1051920 -ac_decay=100000000,0,0 -ac_end=10080,226080,0 -ac_timelockgte=19200000000 -ac_timeunlockfrom=129600 -ac_timeunlockto=1180800 -addnode=185.25.48.236 -addnode=185.64.105.111 & ./komodod -pubkey=$pubkey -ac_name=SEC -ac_cc=333 -ac_supply=1000000000 -addnode=185.148.145.43 & ./komodod -pubkey=$pubkey -ac_name=CCL -ac_supply=200000000 -ac_end=1 -ac_cc=2 -addressindex=1 -spentindex=1 -addnode=142.93.136.89 -addnode=195.201.22.89 & From 73626347e2515aae9106511bdc4ea666a778fc6e Mon Sep 17 00:00:00 2001 From: Alrighttt Date: Tue, 2 Jul 2019 20:05:29 +0200 Subject: [PATCH 20/49] change max ac_eras to 7 --- src/komodo_defs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_defs.h b/src/komodo_defs.h index 7be46f613..5074b4303 100644 --- a/src/komodo_defs.h +++ b/src/komodo_defs.h @@ -18,7 +18,7 @@ #include "komodo_nk.h" #define ASSETCHAINS_MINHEIGHT 128 -#define ASSETCHAINS_MAX_ERAS 3 +#define ASSETCHAINS_MAX_ERAS 7 #define KOMODO_ELECTION_GAP 2000 #define ROUNDROBIN_DELAY 61 #define KOMODO_ASSETCHAIN_MAXLEN 65 From 0238f38686d73f504c16c15b46a06a14f99bc64b Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 2 Jul 2019 00:36:06 -1100 Subject: [PATCH 21/49] txid --- src/komodo_gateway.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 9a80e5e24..1006a9ada 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -652,6 +652,7 @@ const char *banned_txids[] = //"01d8c839463bda2f2f6400ede4611357913684927a767422a8560ead1b22557c", //"6e4980a9e1bd669f4df04732dc6f11b7773b6de88d1abcf89a6b9007d72ef9ac", //"6cc1d0495170bc0e11fd3925297623562e529ea1336b66ea61f8a1159041aed2", + //"250875424cece9bcd98cb226b09da7671625633d6958589e3a462bad89ad87cc", // missed }; int32_t komodo_checkvout(int32_t vout,int32_t k,int32_t indallvouts) From 04710fdf01dedacce9a0cf293454e8b558b705f8 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 11 Jul 2019 13:55:33 -1100 Subject: [PATCH 22/49] -const in CBlockIndexWorkComparator https://github.com/jl777/komodo/issues/1606 --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index e01cba61f..a8f333aa8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -147,7 +147,7 @@ namespace { struct CBlockIndexWorkComparator { - bool operator()(const CBlockIndex *pa, const CBlockIndex *pb) const { + bool operator()(CBlockIndex *pa, const CBlockIndex *pb) const { // First sort by most total work, ... if (ASSETCHAINS_LWMAPOS) { From 3f3f80723c4618f8c50321e7005f0ef81b0827a8 Mon Sep 17 00:00:00 2001 From: Alrighttt Date: Sat, 6 Jul 2019 19:16:53 +0200 Subject: [PATCH 23/49] jokers payments fix --- src/cc/payments.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/cc/payments.cpp b/src/cc/payments.cpp index b6e85480c..be4d63271 100644 --- a/src/cc/payments.cpp +++ b/src/cc/payments.cpp @@ -314,6 +314,8 @@ bool PaymentsValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction & fIsMerge = true; else if ( DecodePaymentsReleaseOpRet(ccopret,createtxid,amountReleased) != 'R' ) return(eval->Invalid("could not decode ccopret")); + if ( tx.vout.back().scriptPubKey.IsOpReturn() ) + fHasOpret = true; mpz_set_si(mpzCheckamount,amountReleased); } else return(eval->Invalid("could not decode ccopret")); From bb6d8b7b99697bc4240f05cc7a575b396fb5e957 Mon Sep 17 00:00:00 2001 From: Alrighttt Date: Tue, 9 Jul 2019 22:17:00 +0200 Subject: [PATCH 24/49] fix ac_cbmaturity magic without other params --- src/komodo_utils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 1bf8dfbeb..e06b42b69 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -2040,7 +2040,7 @@ void komodo_args(char *argv0) 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 ) + 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) { 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()); extraptr = extrabuf; From 51c44114466602f6cea7f2733d5f354fbdb0fdaf Mon Sep 17 00:00:00 2001 From: Alrighttt Date: Fri, 5 Jul 2019 23:02:18 +0200 Subject: [PATCH 25/49] add ac_cbmaturity --- src/komodo_globals.h | 2 +- src/komodo_utils.h | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/komodo_globals.h b/src/komodo_globals.h index d8e292431..9ffa147ea 100644 --- a/src/komodo_globals.h +++ b/src/komodo_globals.h @@ -46,7 +46,7 @@ struct komodo_state KOMODO_STATES[34]; int COINBASE_MATURITY = _COINBASE_MATURITY;//100; unsigned int WITNESS_CACHE_SIZE = _COINBASE_MATURITY+10; uint256 KOMODO_EARLYTXID; -int32_t KOMODO_MININGTHREADS = -1,IS_KOMODO_NOTARY,IS_STAKED_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAINS_SEED,KOMODO_ON_DEMAND,KOMODO_EXTERNAL_NOTARIES,KOMODO_PASSPORT_INITDONE,KOMODO_PAX,KOMODO_EXCHANGEWALLET,KOMODO_REWIND,STAKED_ERA,KOMODO_CONNECTING = -1,KOMODO_DEALERNODE,KOMODO_EXTRASATOSHI,ASSETCHAINS_FOUNDERS; +int32_t KOMODO_MININGTHREADS = -1,IS_KOMODO_NOTARY,IS_STAKED_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAINS_SEED,KOMODO_ON_DEMAND,KOMODO_EXTERNAL_NOTARIES,KOMODO_PASSPORT_INITDONE,KOMODO_PAX,KOMODO_EXCHANGEWALLET,KOMODO_REWIND,STAKED_ERA,KOMODO_CONNECTING = -1,KOMODO_DEALERNODE,KOMODO_EXTRASATOSHI,ASSETCHAINS_FOUNDERS,ASSETCHAINS_CBMATURITY; int32_t KOMODO_INSYNC,KOMODO_LASTMINED,prevKOMODO_LASTMINED,KOMODO_CCACTIVATE,JUMBLR_PAUSE = 1; std::string NOTARY_PUBKEY,ASSETCHAINS_NOTARIES,ASSETCHAINS_OVERRIDE_PUBKEY,DONATION_PUBKEY,ASSETCHAINS_SCRIPTPUB,NOTARY_ADDRESS,ASSETCHAINS_SELFIMPORT,ASSETCHAINS_CCLIB; uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEYHASH[20],ASSETCHAINS_PUBLIC,ASSETCHAINS_PRIVATE,ASSETCHAINS_TXPOW,ASSETCHAINS_MARMARA; diff --git a/src/komodo_utils.h b/src/komodo_utils.h index e06b42b69..76ca5c7ae 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1839,6 +1839,7 @@ void komodo_args(char *argv0) Split(GetArg("-ac_decay",""), ASSETCHAINS_DECAY, 0); Split(GetArg("-ac_notarypay",""), ASSETCHAINS_NOTARY_PAY, 0); + for ( int i = 0; i < ASSETCHAINS_MAX_ERAS; i++ ) { if ( ASSETCHAINS_DECAY[i] == 100000000 && ASSETCHAINS_ENDSUBSIDY == 0 ) @@ -1872,6 +1873,7 @@ void komodo_args(char *argv0) ASSETCHAINS_CODAPORT = GetArg("-ac_coda",0); ASSETCHAINS_MARMARA = GetArg("-ac_marmara",0); ASSETCHAINS_CBOPRET = GetArg("-ac_cbopret",0); + ASSETCHAINS_CBMATURITY = GetArg("-ac_cbmaturity",100); //fprintf(stderr,"ASSETCHAINS_CBOPRET.%llx\n",(long long)ASSETCHAINS_CBOPRET); if ( ASSETCHAINS_CBOPRET != 0 ) { @@ -2184,6 +2186,10 @@ void komodo_args(char *argv0) { extralen += iguana_rwnum(1,&extraptr[extralen],sizeof(ASSETCHAINS_EARLYTXIDCONTRACT),(void *)&ASSETCHAINS_EARLYTXIDCONTRACT); } + if ( ASSETCHAINS_CBMATURITY != 100 ) + { + extralen += iguana_rwnum(1,&extraptr[extralen],sizeof(ASSETCHAINS_CBMATURITY),(void *)&ASSETCHAINS_CBMATURITY); + } } addn = GetArg("-seednode",""); @@ -2234,8 +2240,15 @@ void komodo_args(char *argv0) } if ( (port= komodo_userpass(ASSETCHAINS_USERPASS,ASSETCHAINS_SYMBOL)) != 0 ) ASSETCHAINS_RPCPORT = port; - else komodo_configfile(ASSETCHAINS_SYMBOL,ASSETCHAINS_P2PPORT + 1); - if (ASSETCHAINS_LASTERA == 0 || is_STAKED(ASSETCHAINS_SYMBOL) != 0) + else komodo_configfile(ASSETCHAINS_SYMBOL,ASSETCHAINS_P2PPORT + 1);\ + if (ASSETCHAINS_CBMATURITY < 1) + { + fprintf(stderr,"ac_cbmaturity must be >0\n"); + StartShutdown(); + } + if (ASSETCHAINS_CBMATURITY != 100) + COINBASE_MATURITY = ASSETCHAINS_CBMATURITY; + else if (ASSETCHAINS_LASTERA == 0 || is_STAKED(ASSETCHAINS_SYMBOL) != 0) COINBASE_MATURITY = 1; //fprintf(stderr,"ASSETCHAINS_RPCPORT (%s) %u\n",ASSETCHAINS_SYMBOL,ASSETCHAINS_RPCPORT); } From c7ecffc934af7715c6d6b2c367e84c904e418efe Mon Sep 17 00:00:00 2001 From: Alrighttt Date: Fri, 5 Jul 2019 23:13:15 +0200 Subject: [PATCH 26/49] syntax, remove misplaced \ --- src/komodo_utils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 76ca5c7ae..f72d11762 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -2240,7 +2240,7 @@ void komodo_args(char *argv0) } if ( (port= komodo_userpass(ASSETCHAINS_USERPASS,ASSETCHAINS_SYMBOL)) != 0 ) ASSETCHAINS_RPCPORT = port; - else komodo_configfile(ASSETCHAINS_SYMBOL,ASSETCHAINS_P2PPORT + 1);\ + else komodo_configfile(ASSETCHAINS_SYMBOL,ASSETCHAINS_P2PPORT + 1); if (ASSETCHAINS_CBMATURITY < 1) { fprintf(stderr,"ac_cbmaturity must be >0\n"); From a273e8fdedc78c50a4d310eb18fa8c5fdd8fa89e Mon Sep 17 00:00:00 2001 From: Alrighttt Date: Fri, 5 Jul 2019 23:14:37 +0200 Subject: [PATCH 27/49] remove extra whitespace --- src/komodo_utils.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index f72d11762..08c28a2fd 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1839,7 +1839,6 @@ void komodo_args(char *argv0) Split(GetArg("-ac_decay",""), ASSETCHAINS_DECAY, 0); Split(GetArg("-ac_notarypay",""), ASSETCHAINS_NOTARY_PAY, 0); - for ( int i = 0; i < ASSETCHAINS_MAX_ERAS; i++ ) { if ( ASSETCHAINS_DECAY[i] == 100000000 && ASSETCHAINS_ENDSUBSIDY == 0 ) From 5b7afedaecf1799ba3620740c37e803cafea49a3 Mon Sep 17 00:00:00 2001 From: Alrighttt Date: Fri, 5 Jul 2019 23:39:32 +0200 Subject: [PATCH 28/49] fix ac_cbmaturity=100 case --- src/komodo_utils.h | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 08c28a2fd..57d652309 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1872,7 +1872,7 @@ void komodo_args(char *argv0) ASSETCHAINS_CODAPORT = GetArg("-ac_coda",0); ASSETCHAINS_MARMARA = GetArg("-ac_marmara",0); ASSETCHAINS_CBOPRET = GetArg("-ac_cbopret",0); - ASSETCHAINS_CBMATURITY = GetArg("-ac_cbmaturity",100); + ASSETCHAINS_CBMATURITY = GetArg("-ac_cbmaturity",0); //fprintf(stderr,"ASSETCHAINS_CBOPRET.%llx\n",(long long)ASSETCHAINS_CBOPRET); if ( ASSETCHAINS_CBOPRET != 0 ) { @@ -2185,7 +2185,7 @@ void komodo_args(char *argv0) { extralen += iguana_rwnum(1,&extraptr[extralen],sizeof(ASSETCHAINS_EARLYTXIDCONTRACT),(void *)&ASSETCHAINS_EARLYTXIDCONTRACT); } - if ( ASSETCHAINS_CBMATURITY != 100 ) + if ( ASSETCHAINS_CBMATURITY != 0 ) { extralen += iguana_rwnum(1,&extraptr[extralen],sizeof(ASSETCHAINS_CBMATURITY),(void *)&ASSETCHAINS_CBMATURITY); } @@ -2240,15 +2240,16 @@ void komodo_args(char *argv0) if ( (port= komodo_userpass(ASSETCHAINS_USERPASS,ASSETCHAINS_SYMBOL)) != 0 ) ASSETCHAINS_RPCPORT = port; else komodo_configfile(ASSETCHAINS_SYMBOL,ASSETCHAINS_P2PPORT + 1); - if (ASSETCHAINS_CBMATURITY < 1) - { - fprintf(stderr,"ac_cbmaturity must be >0\n"); - StartShutdown(); - } - if (ASSETCHAINS_CBMATURITY != 100) + + if (ASSETCHAINS_CBMATURITY != 0) COINBASE_MATURITY = ASSETCHAINS_CBMATURITY; else if (ASSETCHAINS_LASTERA == 0 || is_STAKED(ASSETCHAINS_SYMBOL) != 0) COINBASE_MATURITY = 1; + if (COINBASE_MATURITY < 1) + { + fprintf(stderr,"ac_cbmaturity must be >0, shutting down\n"); + StartShutdown(); + } //fprintf(stderr,"ASSETCHAINS_RPCPORT (%s) %u\n",ASSETCHAINS_SYMBOL,ASSETCHAINS_RPCPORT); } if ( ASSETCHAINS_RPCPORT == 0 ) From eb1bc0cc0ce2da863ce51917200fc9b3ed5b612a Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 12 Jul 2019 05:21:05 -1100 Subject: [PATCH 29/49] Test ASSETCHAINS_MAX_ERAS+1 --- src/komodo_defs.h | 2 +- src/komodo_globals.h | 2 +- src/main.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/komodo_defs.h b/src/komodo_defs.h index 5074b4303..748f9ee7a 100644 --- a/src/komodo_defs.h +++ b/src/komodo_defs.h @@ -274,7 +274,7 @@ extern uint32_t ASSETCHAINS_ALGO, ASSETCHAINS_VERUSHASH,ASSETCHAINS_EQUIHASH,KOM extern int32_t KOMODO_MININGTHREADS,KOMODO_LONGESTCHAIN,ASSETCHAINS_SEED,IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,KOMODO_ON_DEMAND,KOMODO_PASSPORT_INITDONE,ASSETCHAINS_STAKED; extern uint64_t ASSETCHAINS_COMMISSION, ASSETCHAINS_LASTERA,ASSETCHAINS_CBOPRET; extern bool VERUS_MINTBLOCKS; -extern uint64_t ASSETCHAINS_REWARD[ASSETCHAINS_MAX_ERAS], ASSETCHAINS_NOTARY_PAY[ASSETCHAINS_MAX_ERAS], ASSETCHAINS_TIMELOCKGTE, ASSETCHAINS_NONCEMASK[],ASSETCHAINS_NK[2]; +extern uint64_t ASSETCHAINS_REWARD[ASSETCHAINS_MAX_ERAS+1], ASSETCHAINS_NOTARY_PAY[ASSETCHAINS_MAX_ERAS+1], ASSETCHAINS_TIMELOCKGTE, ASSETCHAINS_NONCEMASK[],ASSETCHAINS_NK[2]; extern const char *ASSETCHAINS_ALGORITHMS[]; extern int32_t VERUS_MIN_STAKEAGE; extern uint32_t ASSETCHAINS_VERUSHASH, ASSETCHAINS_VERUSHASHV1_1, ASSETCHAINS_NONCESHIFT[], ASSETCHAINS_HASHESPERROUND[]; diff --git a/src/komodo_globals.h b/src/komodo_globals.h index 9ffa147ea..c350020b6 100644 --- a/src/komodo_globals.h +++ b/src/komodo_globals.h @@ -74,7 +74,7 @@ uint64_t ASSETCHAINS_TIMELOCKGTE = _ASSETCHAINS_TIMELOCKOFF; uint64_t ASSETCHAINS_TIMEUNLOCKFROM = 0, ASSETCHAINS_TIMEUNLOCKTO = 0,ASSETCHAINS_CBOPRET=0; uint64_t ASSETCHAINS_LASTERA = 1; -uint64_t ASSETCHAINS_ENDSUBSIDY[ASSETCHAINS_MAX_ERAS],ASSETCHAINS_REWARD[ASSETCHAINS_MAX_ERAS],ASSETCHAINS_HALVING[ASSETCHAINS_MAX_ERAS],ASSETCHAINS_DECAY[ASSETCHAINS_MAX_ERAS],ASSETCHAINS_NOTARY_PAY[ASSETCHAINS_MAX_ERAS]; +uint64_t ASSETCHAINS_ENDSUBSIDY[ASSETCHAINS_MAX_ERAS+1],ASSETCHAINS_REWARD[ASSETCHAINS_MAX_ERAS+1],ASSETCHAINS_HALVING[ASSETCHAINS_MAX_ERAS+1],ASSETCHAINS_DECAY[ASSETCHAINS_MAX_ERAS+1],ASSETCHAINS_NOTARY_PAY[ASSETCHAINS_MAX_ERAS+1]; uint8_t ASSETCHAINS_CCDISABLES[256]; std::vector ASSETCHAINS_PRICES,ASSETCHAINS_STOCKS; diff --git a/src/main.cpp b/src/main.cpp index a8f333aa8..34708bef7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2407,7 +2407,7 @@ bool ReadBlockFromDisk(CBlock& block, const CBlockIndex* pindex,bool checkPOW) //uint64_t komodo_moneysupply(int32_t height); extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN]; -extern uint64_t ASSETCHAINS_ENDSUBSIDY[ASSETCHAINS_MAX_ERAS], ASSETCHAINS_REWARD[ASSETCHAINS_MAX_ERAS], ASSETCHAINS_HALVING[ASSETCHAINS_MAX_ERAS]; +extern uint64_t ASSETCHAINS_ENDSUBSIDY[ASSETCHAINS_MAX_ERAS+1], ASSETCHAINS_REWARD[ASSETCHAINS_MAX_ERAS+1], ASSETCHAINS_HALVING[ASSETCHAINS_MAX_ERAS+1]; extern uint32_t ASSETCHAINS_MAGIC; extern uint64_t ASSETCHAINS_LINEAR,ASSETCHAINS_COMMISSION,ASSETCHAINS_SUPPLY; extern uint8_t ASSETCHAINS_PUBLIC,ASSETCHAINS_PRIVATE; From 6024c775ac435c194e86c17c9d4d23e55f83f4b3 Mon Sep 17 00:00:00 2001 From: "Jonathan \"Duke\" Leto" Date: Thu, 11 Jul 2019 11:42:52 -0700 Subject: [PATCH 30/49] Initial port of Hush supply curve to KMD --- src/komodo_bitcoind.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 48962b015..9882ef33c 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1266,6 +1266,37 @@ uint64_t komodo_commission(const CBlock *pblock,int32_t height) nSubsidy = GetBlockSubsidy(height,Params().GetConsensus()); //fprintf(stderr,"ht.%d nSubsidy %.8f prod %llu\n",height,(double)nSubsidy/COIN,(long long)(nSubsidy * ASSETCHAINS_COMMISSION)); commission = ((nSubsidy * ASSETCHAINS_COMMISSION) / COIN); + + if ((strncmp(ASSETCHAINS_SYMBOL, "HUSH3",5) != 0)) { + int32_t starting_commission = 125000000, HALVING1 = 340000, INTERVAL = 840000, TRANSITION = 129, BR_END = 5422111; + // HUSH supply curve cannot be exactly represented via KMD AC CLI args, so we do it ourselves. + // You specify the BR, and the FR % gets added so 10% of 12.5 is 1.25 + // but to tell the AC params, I need to say "11% of 11.25" is 1.25 + // 11% ie. 1/9th cannot be exactly represented and so the FR has tiny amounts of error unless done manually + // Transition period of 128 blocks has BR=FR=0 + if (height < TRANSITION) { + commission = 0; + } else if (height < HALVING1) { + commission = starting_commission; + } else if (height < HALVING1+1*INTERVAL) { + commission = starting_commission / 2; + } else if (height < HALVING1+2*INTERVAL) { + commission = starting_commission / 4; + } else if (height < HALVING1+3*INTERVAL) { + commission = starting_commission / 8; + } else if (height < HALVING1+4*INTERVAL) { + commission = starting_commission / 16; + } else if (height < HALVING1+5*INTERVAL) { + commission = starting_commission / 32; + } else if (height < HALVING1+6*INTERVAL) { // Block 5380000 + // Block reward will go to zero between 7th+8th halvings, ac_end may need adjusting + commission = starting_commission / 64; + } else if (height < HALVING1+7*INTERVAL) { + // Block reward will be zero before this is ever reached + commission = starting_commission / 128; // Block 6220000 + } + } + if ( ASSETCHAINS_FOUNDERS > 1 ) { if ( (height % ASSETCHAINS_FOUNDERS) == 0 ) From 7d8928c5e9234af6102d291faf1a4b3c62574f4d Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Fri, 12 Jul 2019 05:43:49 -0400 Subject: [PATCH 31/49] Use strncmp correctly --- src/komodo_bitcoind.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 9882ef33c..312e2eda1 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1267,7 +1267,7 @@ uint64_t komodo_commission(const CBlock *pblock,int32_t height) //fprintf(stderr,"ht.%d nSubsidy %.8f prod %llu\n",height,(double)nSubsidy/COIN,(long long)(nSubsidy * ASSETCHAINS_COMMISSION)); commission = ((nSubsidy * ASSETCHAINS_COMMISSION) / COIN); - if ((strncmp(ASSETCHAINS_SYMBOL, "HUSH3",5) != 0)) { + if ((strncmp(ASSETCHAINS_SYMBOL, "HUSH3",5) == 0)) { int32_t starting_commission = 125000000, HALVING1 = 340000, INTERVAL = 840000, TRANSITION = 129, BR_END = 5422111; // HUSH supply curve cannot be exactly represented via KMD AC CLI args, so we do it ourselves. // You specify the BR, and the FR % gets added so 10% of 12.5 is 1.25 From 38064092949b722a0629653973a5576809335bee Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Fri, 12 Jul 2019 11:37:01 -0400 Subject: [PATCH 32/49] Optimize check for HUSH3 in komodo_commission --- src/komodo_bitcoind.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 312e2eda1..20e0f3b90 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1256,10 +1256,16 @@ CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams); uint64_t komodo_commission(const CBlock *pblock,int32_t height) { + static bool didinit = false,ishush3 = false; // LABS fungible chains, cannot have any block reward! if ( is_STAKED(ASSETCHAINS_SYMBOL) == 2 ) return(0); + if (!didinit) { + ishush3 = strncmp(ASSETCHAINS_SYMBOL, "HUSH3",5) == 0 ? true : false; + didinit = true; + } + int32_t i,j,n=0,txn_count; int64_t nSubsidy; uint64_t commission,total = 0; if ( ASSETCHAINS_FOUNDERS != 0 ) { @@ -1267,7 +1273,7 @@ uint64_t komodo_commission(const CBlock *pblock,int32_t height) //fprintf(stderr,"ht.%d nSubsidy %.8f prod %llu\n",height,(double)nSubsidy/COIN,(long long)(nSubsidy * ASSETCHAINS_COMMISSION)); commission = ((nSubsidy * ASSETCHAINS_COMMISSION) / COIN); - if ((strncmp(ASSETCHAINS_SYMBOL, "HUSH3",5) == 0)) { + if (ishush3) { int32_t starting_commission = 125000000, HALVING1 = 340000, INTERVAL = 840000, TRANSITION = 129, BR_END = 5422111; // HUSH supply curve cannot be exactly represented via KMD AC CLI args, so we do it ourselves. // You specify the BR, and the FR % gets added so 10% of 12.5 is 1.25 From f0398720dd51b271286226d5f73b59b81a321870 Mon Sep 17 00:00:00 2001 From: "Jonathan \"Duke\" Leto" Date: Fri, 12 Jul 2019 10:28:01 -0700 Subject: [PATCH 33/49] Add hush convenience scripts --- src/hush-cli | 11 +++++++++++ src/hushd | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100755 src/hush-cli create mode 100755 src/hushd diff --git a/src/hush-cli b/src/hush-cli new file mode 100755 index 000000000..efa1840a6 --- /dev/null +++ b/src/hush-cli @@ -0,0 +1,11 @@ +#!/bin/bash +# Copyright (c) 2019 Hush developers + +# set working directory to the location of this script +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +cd $DIR + +NAME=HUSH3 + +CLI=${KOMODOCLI:-./komodo-cli} +$CLI -ac_name=$NAME "$@" diff --git a/src/hushd b/src/hushd new file mode 100755 index 000000000..949779a90 --- /dev/null +++ b/src/hushd @@ -0,0 +1,52 @@ +#!/bin/bash +# Copyright (c) 2019 Hush developers + +# set working directory to the location of this script +DIR="$( cd "$( dirname "$( readlink -f "${BASH_SOURCE[0]}" )" )" && pwd )" +cd $DIR + +NAME=HUSH3 +# this corresponds to FR address RHushEyeDm7XwtaTWtyCbjGQumYyV8vMjn +SCRIPT=76a9145eb10cf64f2bab1b457f1f25e658526155928fac88ac + +# Chain parameters +ERAS=3 +BLOCKTIME=150 +# 6250000 - (sprout pool at block 500,000) +SUPPLY=6178674 +FOUNDERS=1 +REWARD=0,1125000000,562500000 +PERC=11111111 +HALVING=129,340000,840000 +# NOTE: keep in sync with komodo_bitcoind.h +END=128,340000,5422111 +CLIENTNAME=GoldenSandtrout +SEEDNODE1=188.165.212.101 +SEEDNODE2=136.243.227.142 +SEEDNODE3=5.9.224.250 +CCLIB=hush3 + +# CryptoConditions/Custom Consensus params +FAUCET=228 +HEIR=234 +CHANNEL=235 +ORACLE=236 +GATEWAY=241 +CCENABLE=$FAUCET,$HEIR,$CHANNEL,$ORACLE,$GATEWAY + +KMD=${KOMODOD:-./komodod} +$KMD -ac_name=$NAME -ac_sapling=1 \ + -ac_reward=$REWARD \ + -ac_halving=$HALVING \ + -ac_end=$END \ + -ac_eras=$ERAS \ + -ac_blocktime=$BLOCKTIME \ + -ac_cc=2 -ac_ccenable=$CCENABLE \ + -ac_founders=$FOUNDERS -ac_supply=$SUPPLY \ + -ac_perc=$PERC \ + -clientname=$CLIENTNAME \ + -addnode=$SEEDNODE1 \ + -addnode=$SEEDNODE2 \ + -addnode=$SEEDNODE3 \ + -ac_cclib=$CCLIB \ + -ac_script=$SCRIPT "$@" From 9b474d444756e2a84b958b3f4b0f29b9e9b0c320 Mon Sep 17 00:00:00 2001 From: "Jonathan \"Duke\" Leto" Date: Fri, 12 Jul 2019 10:38:27 -0700 Subject: [PATCH 34/49] Add HUSH3 to assetchains.(old|json) --- src/assetchains.json | 22 ++++++++++++++++++++++ src/assetchains.old | 1 + 2 files changed, 23 insertions(+) diff --git a/src/assetchains.json b/src/assetchains.json index 86dc77565..910f19dd3 100644 --- a/src/assetchains.json +++ b/src/assetchains.json @@ -268,5 +268,27 @@ "ac_supply": "64000777", "ac_staked": "10", "addnode": ["18.197.20.21"] + }, + { + "ac_name": "HUSH3", + "ac_founders": "1", + "ac_reward": "0,1125000000,562500000" + "ac_end": "128,340000,5422111", + "ac_blocktime": "150", + "ac_supply": "6178674", + "ac_halving": "129,340000,840000", + "ac_cc": "2", + "ac_cclib": "hush3", + "ac_ccenable": "228,234,235,236,241", + "ac_supply": "100000000", + "ac_eras": "3", + "ac_script": "76a9145eb10cf64f2bab1b457f1f25e658526155928fac88ac", + "ac_sapling": "1", + "clientname": "GoldenSandtrout", + "addnode": [ + "188.165.212.101", + "136.243.227.142", + "5.9.224.250" + ] } ] diff --git a/src/assetchains.old b/src/assetchains.old index 1784bf2e1..8ee0b7daa 100755 --- a/src/assetchains.old +++ b/src/assetchains.old @@ -52,3 +52,4 @@ echo $pubkey ./komodod -pubkey=$pubkey -ac_name=KOIN -ac_supply=125000000 -addnode=3.0.32.10 & ./komodod -pubkey=$pubkey -ac_name=ZEXO -ac_supply=100000000 -ac_reward=1478310502 -ac_halving=525600 -ac_cc=42 -ac_ccenable=236 -ac_perc=77700 -ac_staked=93 -ac_pubkey=02713bd85e054db923694b6b7a85306264edf4d6bd6d331814f2b40af444b3ebbc -ac_public=1 -addnode=80.240.17.222 & ./komodod -pubkey=$pubkey -ac_name=K64 -ac_supply=64000777 -ac_reward=0 -ac_staked=10 -addnode=18.197.20.211 & +./komodod -pubkey=$pubkey -ac_name=HUSH3 -ac_sapling=1 -ac_reward=0,1125000000,562500000 -ac_halving=129,340000,840000 -ac_end=128,340000,5422111 -ac_eras=3 -ac_blocktime=150 -ac_cc=2 -ac_ccenable=228,234,235,236,241 -ac_founders=1 -ac_supply=6178674 -ac_perc=11111111 -clientname=GoldenSandtrout -addnode=188.165.212.101 -addnode=136.243.227.142 -addnode=5.9.224.250 -ac_cclib=hush3 -ac_script=76a9145eb10cf64f2bab1b457f1f25e658526155928fac88ac & From 8f5cbc8af21d0e1b8c04ad8405088d3fa8953ff5 Mon Sep 17 00:00:00 2001 From: "Jonathan \"Duke\" Leto" Date: Fri, 12 Jul 2019 10:55:31 -0700 Subject: [PATCH 35/49] Missing comma --- src/assetchains.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/assetchains.json b/src/assetchains.json index 910f19dd3..0b4b1644e 100644 --- a/src/assetchains.json +++ b/src/assetchains.json @@ -272,7 +272,7 @@ { "ac_name": "HUSH3", "ac_founders": "1", - "ac_reward": "0,1125000000,562500000" + "ac_reward": "0,1125000000,562500000", "ac_end": "128,340000,5422111", "ac_blocktime": "150", "ac_supply": "6178674", From 7d5af489141d79879710d65715137bdefe4f6eca Mon Sep 17 00:00:00 2001 From: "Jonathan \"Duke\" Leto" Date: Fri, 12 Jul 2019 10:59:36 -0700 Subject: [PATCH 36/49] Remove duplicate ac_supply and add ac_perc --- src/assetchains.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/assetchains.json b/src/assetchains.json index 0b4b1644e..20dd04ee2 100644 --- a/src/assetchains.json +++ b/src/assetchains.json @@ -271,6 +271,7 @@ }, { "ac_name": "HUSH3", + "ac_sapling": "1", "ac_founders": "1", "ac_reward": "0,1125000000,562500000", "ac_end": "128,340000,5422111", @@ -280,10 +281,9 @@ "ac_cc": "2", "ac_cclib": "hush3", "ac_ccenable": "228,234,235,236,241", - "ac_supply": "100000000", + "ac_perc": "11111111", "ac_eras": "3", "ac_script": "76a9145eb10cf64f2bab1b457f1f25e658526155928fac88ac", - "ac_sapling": "1", "clientname": "GoldenSandtrout", "addnode": [ "188.165.212.101", From d9617c68fd51617d3cb005d94f6b2ea49c8fbdd9 Mon Sep 17 00:00:00 2001 From: "Jonathan \"Duke\" Leto" Date: Fri, 12 Jul 2019 11:05:56 -0700 Subject: [PATCH 37/49] Add fiat script --- src/fiat/hush | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100755 src/fiat/hush diff --git a/src/fiat/hush b/src/fiat/hush new file mode 100755 index 000000000..3d7a3425d --- /dev/null +++ b/src/fiat/hush @@ -0,0 +1,7 @@ +#!/bin/bash + +#set working directory to the location of this script +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +cd $DIR + +../komodo-cli -ac_name=HUSH3 "$@" From 152c86ce849b349b3e905a4e4e1832c80ca7a66f Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 12 Jul 2019 16:39:33 -1100 Subject: [PATCH 38/49] Fix MAXERAS crash (split array overflow) --- src/komodo_defs.h | 2 +- src/komodo_globals.h | 2 +- src/komodo_utils.h | 16 ++++++++-------- src/main.cpp | 2 +- src/util.cpp | 4 ++-- src/util.h | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/komodo_defs.h b/src/komodo_defs.h index 748f9ee7a..5074b4303 100644 --- a/src/komodo_defs.h +++ b/src/komodo_defs.h @@ -274,7 +274,7 @@ extern uint32_t ASSETCHAINS_ALGO, ASSETCHAINS_VERUSHASH,ASSETCHAINS_EQUIHASH,KOM extern int32_t KOMODO_MININGTHREADS,KOMODO_LONGESTCHAIN,ASSETCHAINS_SEED,IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,KOMODO_ON_DEMAND,KOMODO_PASSPORT_INITDONE,ASSETCHAINS_STAKED; extern uint64_t ASSETCHAINS_COMMISSION, ASSETCHAINS_LASTERA,ASSETCHAINS_CBOPRET; extern bool VERUS_MINTBLOCKS; -extern uint64_t ASSETCHAINS_REWARD[ASSETCHAINS_MAX_ERAS+1], ASSETCHAINS_NOTARY_PAY[ASSETCHAINS_MAX_ERAS+1], ASSETCHAINS_TIMELOCKGTE, ASSETCHAINS_NONCEMASK[],ASSETCHAINS_NK[2]; +extern uint64_t ASSETCHAINS_REWARD[ASSETCHAINS_MAX_ERAS], ASSETCHAINS_NOTARY_PAY[ASSETCHAINS_MAX_ERAS], ASSETCHAINS_TIMELOCKGTE, ASSETCHAINS_NONCEMASK[],ASSETCHAINS_NK[2]; extern const char *ASSETCHAINS_ALGORITHMS[]; extern int32_t VERUS_MIN_STAKEAGE; extern uint32_t ASSETCHAINS_VERUSHASH, ASSETCHAINS_VERUSHASHV1_1, ASSETCHAINS_NONCESHIFT[], ASSETCHAINS_HASHESPERROUND[]; diff --git a/src/komodo_globals.h b/src/komodo_globals.h index c350020b6..9ffa147ea 100644 --- a/src/komodo_globals.h +++ b/src/komodo_globals.h @@ -74,7 +74,7 @@ uint64_t ASSETCHAINS_TIMELOCKGTE = _ASSETCHAINS_TIMELOCKOFF; uint64_t ASSETCHAINS_TIMEUNLOCKFROM = 0, ASSETCHAINS_TIMEUNLOCKTO = 0,ASSETCHAINS_CBOPRET=0; uint64_t ASSETCHAINS_LASTERA = 1; -uint64_t ASSETCHAINS_ENDSUBSIDY[ASSETCHAINS_MAX_ERAS+1],ASSETCHAINS_REWARD[ASSETCHAINS_MAX_ERAS+1],ASSETCHAINS_HALVING[ASSETCHAINS_MAX_ERAS+1],ASSETCHAINS_DECAY[ASSETCHAINS_MAX_ERAS+1],ASSETCHAINS_NOTARY_PAY[ASSETCHAINS_MAX_ERAS+1]; +uint64_t ASSETCHAINS_ENDSUBSIDY[ASSETCHAINS_MAX_ERAS],ASSETCHAINS_REWARD[ASSETCHAINS_MAX_ERAS],ASSETCHAINS_HALVING[ASSETCHAINS_MAX_ERAS],ASSETCHAINS_DECAY[ASSETCHAINS_MAX_ERAS],ASSETCHAINS_NOTARY_PAY[ASSETCHAINS_MAX_ERAS]; uint8_t ASSETCHAINS_CCDISABLES[256]; std::vector ASSETCHAINS_PRICES,ASSETCHAINS_STOCKS; diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 57d652309..ab58326af 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1758,10 +1758,10 @@ void komodo_args(char *argv0) ASSETCHAINS_PUBLIC = GetArg("-ac_public",0); ASSETCHAINS_PRIVATE = GetArg("-ac_private",0); KOMODO_SNAPSHOT_INTERVAL = GetArg("-ac_snapshot",0); - Split(GetArg("-ac_nk",""), ASSETCHAINS_NK, 0); + Split(GetArg("-ac_nk",""), sizeof(ASSETCHAINS_NK)/sizeof(*ASSETCHAINS_NK), ASSETCHAINS_NK, 0); // -ac_ccactivateht=evalcode,height,evalcode,height,evalcode,height.... - Split(GetArg("-ac_ccactivateht",""), ccEnablesHeight, 0); + Split(GetArg("-ac_ccactivateht",""), sizeof(ccEnablesHeight)/sizeof(*ccEnablesHeight), ccEnablesHeight, 0); // fill map with all eval codes and activation height of 0. for ( int i = 0; i < 256; i++ ) mapHeightEvalActivate[i] = 0; @@ -1833,11 +1833,11 @@ void komodo_args(char *argv0) ASSETCHAINS_TIMEUNLOCKFROM = ASSETCHAINS_TIMEUNLOCKTO = 0; } - Split(GetArg("-ac_end",""), ASSETCHAINS_ENDSUBSIDY, 0); - Split(GetArg("-ac_reward",""), ASSETCHAINS_REWARD, 0); - Split(GetArg("-ac_halving",""), ASSETCHAINS_HALVING, 0); - Split(GetArg("-ac_decay",""), ASSETCHAINS_DECAY, 0); - Split(GetArg("-ac_notarypay",""), ASSETCHAINS_NOTARY_PAY, 0); + Split(GetArg("-ac_end",""), sizeof(ASSETCHAINS_ENDSUBSIDY)/sizeof(*ASSETCHAINS_ENDSUBSIDY), ASSETCHAINS_ENDSUBSIDY, 0); + Split(GetArg("-ac_reward",""), sizeof(ASSETCHAINS_REWARD)/sizeof(*ASSETCHAINS_REWARD), ASSETCHAINS_REWARD, 0); + Split(GetArg("-ac_halving",""), sizeof(ASSETCHAINS_HALVING)/sizeof(*ASSETCHAINS_HALVING), ASSETCHAINS_HALVING, 0); + Split(GetArg("-ac_decay",""), sizeof(ASSETCHAINS_DECAY)/sizeof(*ASSETCHAINS_DECAY), ASSETCHAINS_DECAY, 0); + Split(GetArg("-ac_notarypay",""), sizeof(ASSETCHAINS_NOTARY_PAY)/sizeof(*ASSETCHAINS_NOTARY_PAY), ASSETCHAINS_NOTARY_PAY, 0); for ( int i = 0; i < ASSETCHAINS_MAX_ERAS; i++ ) { @@ -1906,7 +1906,7 @@ void komodo_args(char *argv0) if ( ASSETCHAINS_CC != 0 ) { ASSETCHAINS_CCLIB = GetArg("-ac_cclib",""); - Split(GetArg("-ac_ccenable",""), ccenables, 0); + Split(GetArg("-ac_ccenable",""), sizeof(ccenables)/sizeof(*ccenables), ccenables, 0); for (i=nonz=0; i<0x100; i++) { if ( ccenables[i] != 0 ) diff --git a/src/main.cpp b/src/main.cpp index 34708bef7..a8f333aa8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2407,7 +2407,7 @@ bool ReadBlockFromDisk(CBlock& block, const CBlockIndex* pindex,bool checkPOW) //uint64_t komodo_moneysupply(int32_t height); extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN]; -extern uint64_t ASSETCHAINS_ENDSUBSIDY[ASSETCHAINS_MAX_ERAS+1], ASSETCHAINS_REWARD[ASSETCHAINS_MAX_ERAS+1], ASSETCHAINS_HALVING[ASSETCHAINS_MAX_ERAS+1]; +extern uint64_t ASSETCHAINS_ENDSUBSIDY[ASSETCHAINS_MAX_ERAS], ASSETCHAINS_REWARD[ASSETCHAINS_MAX_ERAS], ASSETCHAINS_HALVING[ASSETCHAINS_MAX_ERAS]; extern uint32_t ASSETCHAINS_MAGIC; extern uint64_t ASSETCHAINS_LINEAR,ASSETCHAINS_COMMISSION,ASSETCHAINS_SUPPLY; extern uint8_t ASSETCHAINS_PUBLIC,ASSETCHAINS_PRIVATE; diff --git a/src/util.cpp b/src/util.cpp index 1aa079085..9daecb63e 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -414,7 +414,7 @@ void SplitStr(const std::string& strVal, std::vector &outVals) } } -void Split(const std::string& strVal, uint64_t *outVals, const uint64_t nDefault) +void Split(const std::string& strVal, int32_t outsize, uint64_t *outVals, const uint64_t nDefault) { stringstream ss(strVal); vector vec; @@ -442,7 +442,7 @@ void Split(const std::string& strVal, uint64_t *outVals, const uint64_t nDefault else nLast = nDefault; - for ( i = numVals; i < ASSETCHAINS_MAX_ERAS; i++ ) + for ( i = numVals; i < outsize; i++ ) { outVals[i] = nLast; } diff --git a/src/util.h b/src/util.h index 617faaf36..17bf19952 100644 --- a/src/util.h +++ b/src/util.h @@ -185,7 +185,7 @@ inline bool IsSwitchChar(char c) * else if the string has fewer than _MAX_ERAS entries, then the last * entry fills remaining entries */ -void Split(const std::string& strVal, uint64_t *outVals, uint64_t nDefault); +void Split(const std::string& strVal, int32_t outsize, uint64_t *outVals, uint64_t nDefault); /** * Return string argument or default value From bb2a16729cbb72d33359cd35f7b860dc1f80c412 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 13 Jul 2019 03:29:54 -1100 Subject: [PATCH 39/49] Revert to coquicash magic, fix disable bits setting --- src/komodo_utils.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index ab58326af..a9a06c80f 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1905,13 +1905,15 @@ void komodo_args(char *argv0) } if ( ASSETCHAINS_CC != 0 ) { + uint8_t prevCCi = 0; ASSETCHAINS_CCLIB = GetArg("-ac_cclib",""); Split(GetArg("-ac_ccenable",""), sizeof(ccenables)/sizeof(*ccenables), ccenables, 0); for (i=nonz=0; i<0x100; i++) { - if ( ccenables[i] != 0 ) + if ( ccenables[i] != prevCCi && ccenables[i] != 0 ) { nonz++; + prevCCi = ccenables[i]; fprintf(stderr,"%d ",(uint8_t)(ccenables[i] & 0xff)); } } @@ -1923,11 +1925,12 @@ void komodo_args(char *argv0) ASSETCHAINS_CCDISABLES[i] = 1; SETBIT(disablebits,i); } - for (i=0; i<256; i++) + for (i=0; i 0 ) { From 3661d19dffe5b7db43aa46dc63dcb72aeb7d3850 Mon Sep 17 00:00:00 2001 From: smk762 <35845239+smk762@users.noreply.github.com> Date: Sun, 14 Jul 2019 01:22:13 +0800 Subject: [PATCH 40/49] Create ac.json alternative to assetchains.json with ac_name as unique key --- src/ac.json | 340 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 340 insertions(+) create mode 100644 src/ac.json diff --git a/src/ac.json b/src/ac.json new file mode 100644 index 000000000..5d0052730 --- /dev/null +++ b/src/ac.json @@ -0,0 +1,340 @@ +[{ + "REVS": { + "ac_supply": "1300000" + } + }, + { + "SUPERNET": { + "ac_supply": "816061" + } + }, + { + "DEX": { + "ac_supply": "999999" + } + }, + { + "PANGEA": { + "ac_supply": "999999" + } + }, + { + "JUMBLR": { + "ac_supply": "999999" + } + }, + { + "BET": { + "ac_supply": "999999" + } + }, + { + "CRYPTO": { + "ac_supply": "999999" + } + }, + { + "HODL": { + "ac_supply": "9999999" + } + }, + { + "MSHARK": { + "ac_supply": "1400000" + } + }, + { + "BOTS": { + "ac_supply": "999999" + } + }, + { + "MGW": { + "ac_supply": "999999" + } + }, + { + "COQUI": { + "ac_supply": "72000000", + "ac_ccactivate": "200000" + } + }, + { + "WLC": { + "ac_supply": "210000000" + } + }, + { + "KV": { + "ac_supply": "1000000" + } + }, + { + "CEAL": { + "ac_supply": "366666666" + } + }, + { + "MESH": { + "ac_supply": "1000007" + } + }, + { + "AXO": { + "ac_supply": "200000000", + "ac_ccactivate": "130000" + } + }, + { + "ETOMIC": { + "ac_supply": "100000000" + } + }, + { + "BTCH": { + "ac_supply": "20998641" + } + }, + { + "PIZZA": { + "ac_supply": "100000000" + } + }, + { + "BEER": { + "ac_supply": "100000000" + } + }, + { + "NINJA": { + "ac_supply": "100000000" + } + }, + { + "OOT": { + "ac_supply": "216000000", + "ac_sapling": "5000000" + } + }, + { + "BNTN": { + "ac_supply": "500000000" + } + }, + { + "CHAIN": { + "ac_supply": "999999" + } + }, + { + "PRLPAY": { + "ac_supply": "500000000" + } + }, + { + "DSEC": { + "ac_supply": "7000000" + } + }, + { + "GLXT": { + "ac_supply": "10000000000" + } + }, + { + "EQL": { + "ac_supply": "500000000", + "ac_ccactivate": "205000" + } + }, + { + "ZILLA": { + "ac_supply": "11000000", + "ac_sapling": "5000000", + "addnode": [ + "51.68.215.104" + ] + } + }, + { + "RFOX": { + "ac_supply": "1000000000", + "ac_reward": "100000000" + } + }, + { + "SEC": { + "ac_supply": "1000000000", + "ac_cc": "333" + } + }, + { + "CCL": { + "ac_supply": "200000000", + "ac_end": "1", + "ac_cc": "2", + "addressindex": "1", + "spentindex": "1", + "addnode": [ + "142.93.136.89", + "195.201.22.89" + ] + } + }, + { + "PIRATE": { + "ac_supply": "0", + "ac_reward": "25600000000", + "ac_halving": "77777", + "ac_private": "1", + "addnode": [ + "136.243.102.225" + ] + } + }, + { + "PGT": { + "ac_supply": "10000000", + "ac_end": "1", + "addnode": [ + "190.114.254.104" + ] + } + }, + { + "DION": { + "ac_supply": "3900000000", + "ac_reward": "22260000000", + "ac_staked": "100", + "ac_cc": "1", + "ac_end": "4300000000", + "addnode": [ + "51.75.124.34" + ] + } + }, + { + "KMDICE": { + "ac_supply": "10500000", + "ac_reward": "2500000000", + "ac_halving": "210000", + "ac_cc": "2", + "addressindex": "1", + "spentindex": "1", + "addnode": [ + "144.76.217.232" + ] + } + }, + { + "KSB": { + "ac_supply": "1000000000", + "ac_end": "1", + "ac_public": "1", + "addnode": [ + "37.187.225.231" + ] + } + }, + { + "OUR": { + "ac_reward": "1478310502", + "ac_halving": "525600", + "ac_cc": "42", + "ac_supply": "100000000", + "ac_perc": "77700", + "ac_staked": "93", + "ac_pubkey": "02652a3f3e00b3a1875a918314f0bac838d6dd189a346fa623f5efe9541ac0b98c", + "ac_public": "1", + "addnode": [ + "51.255.195.65", + "217.182.129.38", + "37.187.225.231" + ] + } + }, + { + "ILN": { + "ac_supply": "10000000000", + "ac_cc": "2", + "addnode": ["51.75.122.83"] + } + }, + { + "RICK": { + "ac_supply": "90000000000", + "ac_reward": "100000000", + "ac_cc": "3", + "addnode": ["138.201.136.145"] + } + }, + { + "MORTY": { + "ac_supply": "90000000000", + "ac_reward": "100000000", + "ac_cc": "3", + "addnode": ["138.201.136.145"] + } + }, + { + "VOTE2019": { + "ac_supply": "123651638", + "ac_public": "1", + "addnode": ["95.213.238.98"] + } + }, + { + "KOIN": { + "ac_supply": "125000000", + "addnode": ["3.0.32.10"] + } + }, + { + "ZEXO": { + "ac_reward": "1478310502", + "ac_halving": "525600", + "ac_cc": "42", + "ac_ccenable": "236", + "ac_supply": "100000000", + "ac_perc": "77700", + "ac_staked": "93", + "ac_pubkey": "02713bd85e054db923694b6b7a85306264edf4d6bd6d331814f2b40af444b3ebbc", + "ac_public": "1", + "addnode": [ + "195.201.20.230", + "80.240.17.222" + ] + } + }, + { + "K64": { + "ac_reward": "0", + "ac_supply": "64000777", + "ac_staked": "10", + "addnode": ["18.197.20.21"] + } + }, + { + "HUSH3": { + "ac_sapling": "1", + "ac_founders": "1", + "ac_reward": "0,1125000000,562500000", + "ac_end": "128,340000,5422111", + "ac_blocktime": "150", + "ac_supply": "6178674", + "ac_halving": "129,340000,840000", + "ac_cc": "2", + "ac_cclib": "hush3", + "ac_ccenable": "228,234,235,236,241", + "ac_perc": "11111111", + "ac_eras": "3", + "ac_script": "76a9145eb10cf64f2bab1b457f1f25e658526155928fac88ac", + "clientname": "GoldenSandtrout", + "addnode": [ + "188.165.212.101", + "136.243.227.142", + "5.9.224.250" + ] + } + } +] From 2ed03590afec86ac57b278a9bc9604a37ce8ca7f Mon Sep 17 00:00:00 2001 From: smk762 <35845239+smk762@users.noreply.github.com> Date: Sun, 14 Jul 2019 01:25:17 +0800 Subject: [PATCH 41/49] Update ac.json removed outer array --- src/ac.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ac.json b/src/ac.json index 5d0052730..d57dbb8b7 100644 --- a/src/ac.json +++ b/src/ac.json @@ -1,4 +1,4 @@ -[{ +{ "REVS": { "ac_supply": "1300000" } @@ -337,4 +337,3 @@ ] } } -] From 8a20e3a9e7e790f92e0f626fc1dd1ac65f7d3cec Mon Sep 17 00:00:00 2001 From: Dwy ! Date: Sat, 13 Jul 2019 20:15:38 +0200 Subject: [PATCH 42/49] fixed ac.json --- src/ac.json | 186 ++++++++++++++++++++++++++-------------------------- 1 file changed, 93 insertions(+), 93 deletions(-) diff --git a/src/ac.json b/src/ac.json index d57dbb8b7..4f75d2f8c 100644 --- a/src/ac.json +++ b/src/ac.json @@ -2,152 +2,152 @@ "REVS": { "ac_supply": "1300000" } - }, - { + , + "SUPERNET": { "ac_supply": "816061" } - }, - { + , + "DEX": { "ac_supply": "999999" } - }, - { + , + "PANGEA": { "ac_supply": "999999" } - }, - { + + , "JUMBLR": { "ac_supply": "999999" } - }, - { + , + "BET": { "ac_supply": "999999" } - }, - { + , + "CRYPTO": { "ac_supply": "999999" } - }, - { + , + "HODL": { "ac_supply": "9999999" } - }, - { + , + "MSHARK": { "ac_supply": "1400000" } - }, - { + , + "BOTS": { "ac_supply": "999999" } - }, - { + , + "MGW": { "ac_supply": "999999" } - }, - { + , + "COQUI": { "ac_supply": "72000000", "ac_ccactivate": "200000" } - }, - { + , + "WLC": { "ac_supply": "210000000" } - }, - { + , + "KV": { "ac_supply": "1000000" } - }, - { + , + "CEAL": { "ac_supply": "366666666" } - }, - { + , + "MESH": { "ac_supply": "1000007" } - }, - { + , + "AXO": { "ac_supply": "200000000", "ac_ccactivate": "130000" } - }, - { + , + "ETOMIC": { "ac_supply": "100000000" } - }, - { + , + "BTCH": { "ac_supply": "20998641" } - }, - { + , + "PIZZA": { "ac_supply": "100000000" } - }, - { + , + "BEER": { "ac_supply": "100000000" } - }, - { + , + "NINJA": { "ac_supply": "100000000" } - }, - { + , + "OOT": { "ac_supply": "216000000", "ac_sapling": "5000000" } - }, - { + , + "BNTN": { "ac_supply": "500000000" } - }, - { + , + "CHAIN": { "ac_supply": "999999" } - }, - { + , + "PRLPAY": { "ac_supply": "500000000" } - }, - { + , + "DSEC": { "ac_supply": "7000000" } - }, - { + , + "GLXT": { "ac_supply": "10000000000" } - }, - { + , + "EQL": { "ac_supply": "500000000", "ac_ccactivate": "205000" } - }, - { + , + "ZILLA": { "ac_supply": "11000000", "ac_sapling": "5000000", @@ -155,20 +155,20 @@ "51.68.215.104" ] } - }, - { + , + "RFOX": { "ac_supply": "1000000000", "ac_reward": "100000000" } - }, - { + , + "SEC": { "ac_supply": "1000000000", "ac_cc": "333" } - }, - { + , + "CCL": { "ac_supply": "200000000", "ac_end": "1", @@ -180,8 +180,8 @@ "195.201.22.89" ] } - }, - { + , + "PIRATE": { "ac_supply": "0", "ac_reward": "25600000000", @@ -191,8 +191,8 @@ "136.243.102.225" ] } - }, - { + , + "PGT": { "ac_supply": "10000000", "ac_end": "1", @@ -200,8 +200,8 @@ "190.114.254.104" ] } - }, - { + , + "DION": { "ac_supply": "3900000000", "ac_reward": "22260000000", @@ -212,8 +212,8 @@ "51.75.124.34" ] } - }, - { + , + "KMDICE": { "ac_supply": "10500000", "ac_reward": "2500000000", @@ -225,8 +225,8 @@ "144.76.217.232" ] } - }, - { + , + "KSB": { "ac_supply": "1000000000", "ac_end": "1", @@ -235,8 +235,8 @@ "37.187.225.231" ] } - }, - { + , + "OUR": { "ac_reward": "1478310502", "ac_halving": "525600", @@ -252,44 +252,44 @@ "37.187.225.231" ] } - }, - { + , + "ILN": { "ac_supply": "10000000000", "ac_cc": "2", "addnode": ["51.75.122.83"] } - }, - { + , + "RICK": { "ac_supply": "90000000000", "ac_reward": "100000000", "ac_cc": "3", "addnode": ["138.201.136.145"] } - }, - { + , + "MORTY": { "ac_supply": "90000000000", "ac_reward": "100000000", "ac_cc": "3", "addnode": ["138.201.136.145"] } - }, - { + , + "VOTE2019": { "ac_supply": "123651638", "ac_public": "1", "addnode": ["95.213.238.98"] } - }, - { + , + "KOIN": { "ac_supply": "125000000", "addnode": ["3.0.32.10"] } - }, - { + , + "ZEXO": { "ac_reward": "1478310502", "ac_halving": "525600", @@ -305,16 +305,16 @@ "80.240.17.222" ] } - }, - { + , + "K64": { "ac_reward": "0", "ac_supply": "64000777", "ac_staked": "10", "addnode": ["18.197.20.21"] } - }, - { + , + "HUSH3": { "ac_sapling": "1", "ac_founders": "1", @@ -336,4 +336,4 @@ "5.9.224.250" ] } - } +} \ No newline at end of file From f186490cdcbce945ea5aa6790f2a967786fd32a3 Mon Sep 17 00:00:00 2001 From: smk762 <35845239+smk762@users.noreply.github.com> Date: Sun, 14 Jul 2019 15:36:52 +0800 Subject: [PATCH 43/49] update to COQUICASH, remove VOTE2019 --- src/ac.json | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/ac.json b/src/ac.json index 4f75d2f8c..7f3f7ba03 100644 --- a/src/ac.json +++ b/src/ac.json @@ -53,13 +53,19 @@ "ac_supply": "999999" } , - - "COQUI": { + "COQUICASH": { "ac_supply": "72000000", - "ac_ccactivate": "200000" + "ac_reward": "7200000000", + "ac_staked": "50", + "ac_halving": "420000", + "ac_cc": "2", + "ac_ccenable": "227,235,236,241", + "addnode": [ + "78.47.108.168" + ] } - , - + , + "WLC": { "ac_supply": "210000000" } @@ -277,13 +283,6 @@ } , - "VOTE2019": { - "ac_supply": "123651638", - "ac_public": "1", - "addnode": ["95.213.238.98"] - } - , - "KOIN": { "ac_supply": "125000000", "addnode": ["3.0.32.10"] @@ -336,4 +335,4 @@ "5.9.224.250" ] } -} \ No newline at end of file +} From b1d53487734bc4256f51514fce039af1e80a7484 Mon Sep 17 00:00:00 2001 From: smk762 <35845239+smk762@users.noreply.github.com> Date: Sun, 14 Jul 2019 15:38:31 +0800 Subject: [PATCH 44/49] update to COQUICASH, remove VOTE2019 --- src/assetchains.json | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/assetchains.json b/src/assetchains.json index 20dd04ee2..e68872d6b 100644 --- a/src/assetchains.json +++ b/src/assetchains.json @@ -44,9 +44,16 @@ "ac_supply": "999999" }, { - "ac_name": "COQUI", + "ac_name": "COQUICASH", "ac_supply": "72000000", - "ac_ccactivate": "200000" + "ac_reward": "7200000000", + "ac_staked": "50", + "ac_halving": "420000", + "ac_cc": "2", + "ac_ccenable": "227,235,236,241", + "addnode": [ + "78.47.108.168" + ] }, { "ac_name": "WLC", @@ -235,12 +242,6 @@ "ac_cc": "3", "addnode": ["138.201.136.145"] }, - { - "ac_name": "VOTE2019", - "ac_supply": "123651638", - "ac_public": "1", - "addnode": ["95.213.238.98"] - }, { "ac_name": "KOIN", "ac_supply": "125000000", From bf40254a7e3738adface1578625725c238e7446d Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 18 Jul 2019 03:04:20 -1100 Subject: [PATCH 45/49] Fix spurious prints of deactivate --- src/komodo_utils.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index a9a06c80f..65601e655 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1769,6 +1769,8 @@ void komodo_args(char *argv0) { int32_t ecode = ccEnablesHeight[i]; int32_t ht = ccEnablesHeight[i+1]; + if ( i > 1 && ccEnablesHeight[i-2] == ecode ) + break; if ( ecode > 255 || ecode < 0 ) fprintf(stderr, "ac_ccactivateht: invalid evalcode.%i must be between 0 and 256.\n", ecode); else if ( ht > 0 ) From 49b564f18fcbdb706ed5ec90b09860f2c59de414 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 18 Jul 2019 05:11:06 -1100 Subject: [PATCH 46/49] Autoset cc for ccEnableHeights[0] !=0 --- src/komodo_utils.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 65601e655..bd625cdc2 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -2277,10 +2277,18 @@ void komodo_args(char *argv0) //printf("created (%s)\n",fname); } else printf("error creating (%s)\n",fname); #endif - if ( KOMODO_CCACTIVATE != 0 && ASSETCHAINS_CC < 2 ) + if ( ASSETCHAINS_CC < 2 ) { - ASSETCHAINS_CC = 2; - fprintf(stderr,"smart utxo CC contracts will activate at height.%d\n",KOMODO_CCACTIVATE); + if ( KOMODO_CCACTIVATE != 0 ) + { + ASSETCHAINS_CC = 2; + fprintf(stderr,"smart utxo CC contracts will activate at height.%d\n",KOMODO_CCACTIVATE); + } + else if ( ccEnableHeights[0] != 0 ) + { + ASSETCHAINS_CC = 2; + fprintf(stderr,"smart utxo CC contract %d will activate at height.%d\n",ccEnableHeights[0],ccEnableHeights[1]); + } } } else From efb2b798ad9bb52e11ab92969ca8599f13ac7648 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 18 Jul 2019 05:24:49 -1100 Subject: [PATCH 47/49] S --- src/komodo_utils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index bd625cdc2..cee024be3 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -2284,7 +2284,7 @@ void komodo_args(char *argv0) ASSETCHAINS_CC = 2; fprintf(stderr,"smart utxo CC contracts will activate at height.%d\n",KOMODO_CCACTIVATE); } - else if ( ccEnableHeights[0] != 0 ) + else if ( ccEnablesHeights[0] != 0 ) { ASSETCHAINS_CC = 2; fprintf(stderr,"smart utxo CC contract %d will activate at height.%d\n",ccEnableHeights[0],ccEnableHeights[1]); From 6a98239840fc1b30a49278503e523af7b9ac9d45 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 18 Jul 2019 05:28:47 -1100 Subject: [PATCH 48/49] Syntax --- src/komodo_utils.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index cee024be3..11d5e87c4 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -2284,10 +2284,10 @@ void komodo_args(char *argv0) ASSETCHAINS_CC = 2; fprintf(stderr,"smart utxo CC contracts will activate at height.%d\n",KOMODO_CCACTIVATE); } - else if ( ccEnablesHeights[0] != 0 ) + else if ( ccEnablesHeight[0] != 0 ) { ASSETCHAINS_CC = 2; - fprintf(stderr,"smart utxo CC contract %d will activate at height.%d\n",ccEnableHeights[0],ccEnableHeights[1]); + fprintf(stderr,"smart utxo CC contract %d will activate at height.%d\n",ccEnablesHeight[0],ccEnablesHeight[1]); } } } From 3207059e3d35c6301b74ac81125d2ef5b026cee7 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 18 Jul 2019 05:29:27 -1100 Subject: [PATCH 49/49] Clear ccEnablesHeight --- src/komodo_utils.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 11d5e87c4..d069733c1 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1697,6 +1697,7 @@ void komodo_args(char *argv0) IS_STAKED_NOTARY = GetArg("-stakednotary", -1); memset(ccenables,0,sizeof(ccenables)); memset(disablebits,0,sizeof(disablebits)); + memset(ccEnablesHeight,0,sizeof(ccEnablesHeight)); if ( GetBoolArg("-gen", false) != 0 ) { KOMODO_MININGTHREADS = GetArg("-genproclimit",-1);