From 6cbc508c7acc7c40784e53dc3ffda625240c015f Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 28 Oct 2016 16:40:56 -0300 Subject: [PATCH 01/67] test --- src/miner.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index 822d36a05..910d9fc04 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -495,7 +495,7 @@ void static BitcoinMiner(CWallet *pwallet) { // Busy-wait for the network to come online so we don't waste time mining // on an obsolete chain. In regtest mode we expect to fly solo. - fprintf(stderr,"Wait for peers...\n"); + //fprintf(stderr,"Wait for peers...\n"); do { bool fvNodesEmpty; { @@ -506,7 +506,7 @@ void static BitcoinMiner(CWallet *pwallet) break; MilliSleep(1000); } while (true); - fprintf(stderr,"Found peers\n"); + //fprintf(stderr,"Found peers\n"); } //fprintf(stderr,"create new block\n"); // From b9a4a70e22a825bb406579dd9578140b4580694a Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 28 Oct 2016 16:58:53 -0300 Subject: [PATCH 02/67] test --- src/wallet/db.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/wallet/db.cpp b/src/wallet/db.cpp index 7fe2c9b87..cd30934a6 100644 --- a/src/wallet/db.cpp +++ b/src/wallet/db.cpp @@ -83,6 +83,7 @@ bool CDBEnv::Open(const boost::filesystem::path& pathIn) TryCreateDirectory(pathLogDir); boost::filesystem::path pathErrorFile = pathIn / "db.log"; LogPrintf("CDBEnv::Open: LogDir=%s ErrorFile=%s\n", pathLogDir.string(), pathErrorFile.string()); + fprintf(stderr,"strPath.(%s)\n",strPath.c_str()); unsigned int nEnvFlags = 0; if (GetBoolArg("-privdb", true)) From 561ff778b634da8762c436946e60f5c6f19256c9 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 08:03:14 -0300 Subject: [PATCH 03/67] test --- src/bitcoind.cpp | 12 ++- src/komodo.h | 10 ++- src/komodo_utils.h | 194 ++++++++++++++++++++++++++------------------- src/wallet/db.cpp | 2 +- 4 files changed, 132 insertions(+), 86 deletions(-) diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp index 285c747cc..27611ab3b 100644 --- a/src/bitcoind.cpp +++ b/src/bitcoind.cpp @@ -92,6 +92,8 @@ bool AppInit(int argc, char* argv[]) try { + void komodo_args(); + komodo_args(); if (!boost::filesystem::is_directory(GetDataDir(false))) { fprintf(stderr, "Error: Specified data directory \"%s\" does not exist.\n", mapArgs["-datadir"].c_str()); @@ -114,7 +116,15 @@ bool AppInit(int argc, char* argv[]) if ( strlen(NOTARY_PUBKEY.c_str()) == 66 ) USE_EXTERNAL_PUBKEY = 1; fprintf(stderr,"IS_KOMODO_NOTARY %d %s\n",IS_KOMODO_NOTARY,NOTARY_PUBKEY.c_str()); - + char *dirname; + while ( (dirname= (char *)GetDataDir(false).string().c_str()) == 0 || dirname[0] == 0 ) + { + fprintf(stderr,"waiting for datadir\n"); + sleep(3); + } + fprintf(stderr,"Got datadir.(%s)\n",dirname); + komodo_configfile(ASSETCHAINS_SYMBOL,ASSETCHAINS_PORT + 1); + // Command-line RPC bool fCommandLine = false; for (int i = 1; i < argc; i++) diff --git a/src/komodo.h b/src/komodo.h index b348f70e0..e642f02f4 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -28,7 +28,15 @@ void komodo_init(); int32_t komodo_notarizeddata(int32_t nHeight,uint256 *notarized_hashp,uint256 *notarized_desttxidp); char *komodo_issuemethod(char *method,char *params,uint16_t port); -int32_t ASSETCHAINS_SHORTFLAG,NOTARIZED_HEIGHT,Num_nutxos,KMDHEIGHT = 43000; +int32_t ASSETCHAINS_SHORTFLAG; +char ASSETCHAINS_SYMBOL[16]; +uint16_t ASSETCHAINS_PORT = 8777; +uint32_t ASSETCHAIN_INIT = 0; +uint32_t ASSETCHAINS_MAGIC = 2387029918; +uint32_t ASSETCHAINS_TIMESTAMP = 1475772963; +uint64_t ASSETCHAINS_SUPPLY = 1000000; + +int32_t NOTARIZED_HEIGHT,Num_nutxos,KMDHEIGHT = 43000; uint256 NOTARIZED_HASH,NOTARIZED_DESTTXID; pthread_mutex_t komodo_mutex; uint32_t KOMODO_INITDONE; diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 36c5a166c..1331b57c4 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1086,89 +1086,6 @@ void OS_randombytes(unsigned char *x,long xlen) } } -void komodo_userpass(char *username,char *password,FILE *fp) -{ - char *rpcuser,*rpcpassword,*str,line[8192]; - rpcuser = rpcpassword = 0; - username[0] = password[0] = 0; - while ( fgets(line,sizeof(line),fp) != 0 ) - { - if ( line[0] == '#' ) - continue; - //printf("line.(%s) %p %p\n",line,strstr(line,(char *)"rpcuser"),strstr(line,(char *)"rpcpassword")); - if ( (str= strstr(line,(char *)"rpcuser")) != 0 ) - rpcuser = parse_conf_line(str,(char *)"rpcuser"); - else if ( (str= strstr(line,(char *)"rpcpassword")) != 0 ) - rpcpassword = parse_conf_line(str,(char *)"rpcpassword"); - } - if ( rpcuser != 0 && rpcpassword != 0 ) - { - strcpy(username,rpcuser); - strcpy(password,rpcpassword); - } - //printf("rpcuser.(%s) rpcpassword.(%s) KMDUSERPASS.(%s) %u\n",rpcuser,rpcpassword,KMDUSERPASS,port); - if ( rpcuser != 0 ) - free(rpcuser); - if ( rpcpassword != 0 ) - free(rpcpassword); -} - -void komodo_configfile(char *symbol,uint16_t port) -{ - static char myusername[512],mypassword[8192]; - FILE *fp; uint8_t buf2[512]; char fname[512],buf[128],username[512],password[8192]; uint32_t crc,r,r2,i; - r = (uint32_t)time(NULL); - r2 = OS_milliseconds(); - memcpy(buf,&r,sizeof(r)); - memcpy(&buf[sizeof(r)],&r2,sizeof(r2)); - memcpy(&buf[sizeof(r)+sizeof(r2)],symbol,strlen(symbol)); - crc = calc_crc32(0,(uint8_t *)buf,(int32_t)(sizeof(r)+sizeof(r2)+strlen(symbol))); - OS_randombytes(buf2,sizeof(buf2)); - for (i=0; iinitflag == 0 ) @@ -1282,3 +1199,114 @@ void iguana_initQ(queue_t *Q,char *name) if ( (item= queue_dequeue(Q)) != 0 ) free(item); } + +void komodo_userpass(char *username,char *password,FILE *fp) +{ + char *rpcuser,*rpcpassword,*str,line[8192]; + rpcuser = rpcpassword = 0; + username[0] = password[0] = 0; + while ( fgets(line,sizeof(line),fp) != 0 ) + { + if ( line[0] == '#' ) + continue; + //printf("line.(%s) %p %p\n",line,strstr(line,(char *)"rpcuser"),strstr(line,(char *)"rpcpassword")); + if ( (str= strstr(line,(char *)"rpcuser")) != 0 ) + rpcuser = parse_conf_line(str,(char *)"rpcuser"); + else if ( (str= strstr(line,(char *)"rpcpassword")) != 0 ) + rpcpassword = parse_conf_line(str,(char *)"rpcpassword"); + } + if ( rpcuser != 0 && rpcpassword != 0 ) + { + strcpy(username,rpcuser); + strcpy(password,rpcpassword); + } + //printf("rpcuser.(%s) rpcpassword.(%s) KMDUSERPASS.(%s) %u\n",rpcuser,rpcpassword,KMDUSERPASS,port); + if ( rpcuser != 0 ) + free(rpcuser); + if ( rpcpassword != 0 ) + free(rpcpassword); +} + +void komodo_configfile(char *symbol,uint16_t port) +{ + static char myusername[512],mypassword[8192]; + FILE *fp; uint8_t buf2[512]; char fname[512],buf[128],username[512],password[8192]; uint32_t crc,r,r2,i; + r = (uint32_t)time(NULL); + r2 = OS_milliseconds(); + memcpy(buf,&r,sizeof(r)); + memcpy(&buf[sizeof(r)],&r2,sizeof(r2)); + memcpy(&buf[sizeof(r)+sizeof(r2)],symbol,strlen(symbol)); + crc = calc_crc32(0,(uint8_t *)buf,(int32_t)(sizeof(r)+sizeof(r2)+strlen(symbol))); + OS_randombytes(buf2,sizeof(buf2)); + for (i=0; i Date: Sat, 29 Oct 2016 08:17:52 -0300 Subject: [PATCH 04/67] test --- src/chainparams.cpp | 64 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index f73cfc82d..155ea3a06 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -29,6 +29,7 @@ using namespace std; * timestamp before) * + Contains no strange transactions */ +void *chainparams_commandline(void *ptr); const arith_uint256 maxUint = UintToArith256(uint256S("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")); @@ -153,10 +154,73 @@ public: // (the tx=... number in the SetBestChain debug.log lines) 0 // * estimated number of transactions per day after checkpoint }; + if ( ASSETCHAINS_SYMBOL[0] != 0 ) + { + if ( pthread_create((pthread_t *)malloc(sizeof(pthread_t)),NULL,chainparams_commandline,(void *)&consensus) != 0 ) + { + + } + } } }; static CMainParams mainParams; +void *chainparams_commandline(void *ptr) +{ + //CChainParams *consensus = (CChainParams *)ptr; + static CBlock genesis; + uint32_t nonce; bool fNegative,fOverflow; arith_uint256 bnTarget; uint256 tmp,hash,powlimit; + powlimit = uint256S("000fffff00000000000000000000000000000000000000000000000000000000"); + //fprintf(stderr,"POWLIMIT.%s\n",powlimit.ToString().c_str()); + while ( ASSETCHAINS_PORT == 0 ) + { + sleep(1); + //fprintf(stderr,"port.%u\n",ASSETCHAINS_PORT); + } + mainParams.SetDefaultPort(ASSETCHAINS_PORT); + mainParams.pchMessageStart[0] = ASSETCHAINS_MAGIC & 0xff; + mainParams.pchMessageStart[1] = (ASSETCHAINS_MAGIC >> 8) & 0xff; + mainParams.pchMessageStart[2] = (ASSETCHAINS_MAGIC >> 16) & 0xff; + mainParams.pchMessageStart[3] = (ASSETCHAINS_MAGIC >> 24) & 0xff; + //fprintf(stderr,"%s port.%u magic.%08x timestamp.%u supply.%u\n",ASSETCHAINS_SYMBOL,ASSETCHAINS_PORT,ASSETCHAINS_MAGIC,ASSETCHAINS_TIMESTAMP,(int32_t)ASSETCHAINS_SUPPLY); + for (nonce=ASSETCHAINS_SUPPLY; nonce UintToArith256(powlimit) ) + { + fprintf(stderr,"%d %d target > powlimit\n",fNegative,fOverflow); + continue; + } + hash = genesis.GetHash(); + if ( UintToArith256(hash) > bnTarget ) + { + tmp = ArithToUint256(bnTarget); + //fprintf(stderr,"%u: hash %s > target %s\n",nonce,hash.ToString().c_str(),tmp.ToString().c_str()); + continue; + } + break; + } + if ( nonce == ASSETCHAINS_SUPPLY+1000000 ) + { + fprintf(stderr,"couldnt find nonce, abort\n"); + exit(-1); + } + mainParams.setnonce(nonce); + mainParams.settimestamp(ASSETCHAINS_TIMESTAMP); + fprintf(stderr,">>>>>>>>>> %u: merkle %s hash %s <= target %s\n",nonce,genesis.hashMerkleRoot.ToString().c_str(),genesis.GetHash().ToString().c_str(),tmp.ToString().c_str()); + mainParams.consensus.hashGenesisBlock = genesis.GetHash(); + mainParams.recalc_genesis(nonce); + fprintf(stderr,">>>>>>>>>> %u: hash %s merkle %s timestamp.%u\n",mainParams.GenesisBlock().nNonce,mainParams.GenesisBlock().GetHash().ToString().c_str(),mainParams.GenesisBlock().hashMerkleRoot.ToString().c_str(),mainParams.GenesisBlock().nTime); + + //set_genesis_tip(hash); + SelectBaseParams("main"); + //BaseParams().nRPCPort = ASSETCHAINS_PORT + 1; + fprintf(stderr,">>>>>>>>>> %s: port.%u/%u magic.%08x %u nonce.%u time.%u nbits.%08x %u coins\n",ASSETCHAINS_SYMBOL,ASSETCHAINS_PORT,ASSETCHAINS_PORT+1,ASSETCHAINS_MAGIC,ASSETCHAINS_MAGIC,nonce,ASSETCHAINS_TIMESTAMP,GENESIS_NBITS,(uint32_t)ASSETCHAINS_SUPPLY); + ASSETCHAIN_INIT = 1; + return(0); +} + /** * Testnet (v3) */ From 0c365446d041e1f013a7e83d9829079457900622 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 08:32:56 -0300 Subject: [PATCH 05/67] test --- src/bitcoind.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp index 27611ab3b..e5d2c7401 100644 --- a/src/bitcoind.cpp +++ b/src/bitcoind.cpp @@ -93,6 +93,7 @@ bool AppInit(int argc, char* argv[]) try { void komodo_args(); + fprintf(stderr,"call komodo_args\n"); komodo_args(); if (!boost::filesystem::is_directory(GetDataDir(false))) { From 0e1af8a8f846f0d76c0f25038b3e1d140c30cd88 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 08:36:43 -0300 Subject: [PATCH 06/67] test --- src/bitcoind.cpp | 13 ------------ src/komodo_utils.h | 51 ++++++++++++++++++++++++++++++---------------- 2 files changed, 33 insertions(+), 31 deletions(-) diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp index e5d2c7401..90e890ebd 100644 --- a/src/bitcoind.cpp +++ b/src/bitcoind.cpp @@ -112,19 +112,6 @@ bool AppInit(int argc, char* argv[]) fprintf(stderr, "Error: Invalid combination of -regtest and -testnet.\n"); return false; } - IS_KOMODO_NOTARY = GetBoolArg("-notary", false); - NOTARY_PUBKEY = GetArg("-pubkey", ""); - if ( strlen(NOTARY_PUBKEY.c_str()) == 66 ) - USE_EXTERNAL_PUBKEY = 1; - fprintf(stderr,"IS_KOMODO_NOTARY %d %s\n",IS_KOMODO_NOTARY,NOTARY_PUBKEY.c_str()); - char *dirname; - while ( (dirname= (char *)GetDataDir(false).string().c_str()) == 0 || dirname[0] == 0 ) - { - fprintf(stderr,"waiting for datadir\n"); - sleep(3); - } - fprintf(stderr,"Got datadir.(%s)\n",dirname); - komodo_configfile(ASSETCHAINS_SYMBOL,ASSETCHAINS_PORT + 1); // Command-line RPC bool fCommandLine = false; diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 1331b57c4..608646e2b 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1285,25 +1285,40 @@ void komodo_configfile(char *symbol,uint16_t port) void komodo_args() { - std::string name; - ASSETCHAINS_TIMESTAMP = GetArg("-ac_timestamp",ASSETCHAINS_TIMESTAMP); - ASSETCHAINS_SUPPLY = GetArg("-ac_supply",10); - name = GetArg("-ac_name","REVS"); - strncpy(ASSETCHAINS_SYMBOL,name.c_str(),sizeof(ASSETCHAINS_SYMBOL)-1); - uint8_t buf[512]; int32_t i,len; - len = iguana_rwnum(1,buf,sizeof(ASSETCHAINS_TIMESTAMP),(void *)&ASSETCHAINS_TIMESTAMP); - len += iguana_rwnum(1,&buf[len],sizeof(ASSETCHAINS_SUPPLY),(void *)&ASSETCHAINS_SUPPLY); - strcpy((char *)&buf[len],ASSETCHAINS_SYMBOL); - len += strlen(ASSETCHAINS_SYMBOL); - ASSETCHAINS_MAGIC = calc_crc32(0,buf,len); - ASSETCHAINS_PORT = GetArg("-ac_port",8000 + (ASSETCHAINS_MAGIC % 7777)); - if ( ASSETCHAINS_SYMBOL[0] == '-' ) + std::string name; char *dirname; uint8_t buf[512]; int32_t i,len; + IS_KOMODO_NOTARY = GetBoolArg("-notary", false); + NOTARY_PUBKEY = GetArg("-pubkey", ""); + if ( strlen(NOTARY_PUBKEY.c_str()) == 66 ) + USE_EXTERNAL_PUBKEY = 1; + fprintf(stderr,"IS_KOMODO_NOTARY %d %s\n",IS_KOMODO_NOTARY,NOTARY_PUBKEY.c_str()); + name = GetArg("-ac_name",""); + if ( name.c_str()[0] != 0 ) { - ASSETCHAINS_SHORTFLAG = 1; - for (i=0; ASSETCHAINS_SYMBOL[i+1]!=0; i++) - ASSETCHAINS_SYMBOL[i] = ASSETCHAINS_SYMBOL[i+1]; - } - fprintf(stderr,"after args: %c%s port.%u magic.%08x timestamp.%u supply.%u\n",ASSETCHAINS_SHORTFLAG!=0?'-':'+',ASSETCHAINS_SYMBOL,ASSETCHAINS_PORT,ASSETCHAINS_MAGIC,ASSETCHAINS_TIMESTAMP,(int32_t)ASSETCHAINS_SUPPLY); + ASSETCHAINS_TIMESTAMP = GetArg("-ac_timestamp",ASSETCHAINS_TIMESTAMP); + ASSETCHAINS_SUPPLY = GetArg("-ac_supply",10); + strncpy(ASSETCHAINS_SYMBOL,name.c_str(),sizeof(ASSETCHAINS_SYMBOL)-1); + len = iguana_rwnum(1,buf,sizeof(ASSETCHAINS_TIMESTAMP),(void *)&ASSETCHAINS_TIMESTAMP); + len += iguana_rwnum(1,&buf[len],sizeof(ASSETCHAINS_SUPPLY),(void *)&ASSETCHAINS_SUPPLY); + strcpy((char *)&buf[len],ASSETCHAINS_SYMBOL); + len += strlen(ASSETCHAINS_SYMBOL); + ASSETCHAINS_MAGIC = calc_crc32(0,buf,len); + ASSETCHAINS_PORT = GetArg("-ac_port",8000 + (ASSETCHAINS_MAGIC % 7777)); + if ( ASSETCHAINS_SYMBOL[0] == '-' ) + { + ASSETCHAINS_SHORTFLAG = 1; + for (i=0; ASSETCHAINS_SYMBOL[i+1]!=0; i++) + ASSETCHAINS_SYMBOL[i] = ASSETCHAINS_SYMBOL[i+1]; + } + fprintf(stderr,"after args: %c%s port.%u magic.%08x timestamp.%u supply.%u\n",ASSETCHAINS_SHORTFLAG!=0?'-':'+',ASSETCHAINS_SYMBOL,ASSETCHAINS_PORT,ASSETCHAINS_MAGIC,ASSETCHAINS_TIMESTAMP,(int32_t)ASSETCHAINS_SUPPLY); + while ( (dirname= (char *)GetDataDir(false).string().c_str()) == 0 || dirname[0] == 0 ) + { + fprintf(stderr,"waiting for datadir\n"); + sleep(3); + } + fprintf(stderr,"Got datadir.(%s)\n",dirname); + if ( ASSETCHAINS_SYMBOL[0] != 0 ) + komodo_configfile(ASSETCHAINS_SYMBOL,ASSETCHAINS_PORT + 1); + } while ( 0 && ASSETCHAIN_INIT == 0 ) { sleep(1); From 080f5fe661c19087ce6397446f3aed641362dca2 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 08:40:47 -0300 Subject: [PATCH 07/67] test --- src/chainparams.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 155ea3a06..e2b90ee50 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -30,6 +30,12 @@ using namespace std; * + Contains no strange transactions */ void *chainparams_commandline(void *ptr); +extern char ASSETCHAINS_SYMBOL[16]; +extern uint16_t ASSETCHAINS_PORT = 8777; +extern uint32_t ASSETCHAIN_INIT = 0; +extern uint32_t ASSETCHAINS_MAGIC = 2387029918; +extern uint32_t ASSETCHAINS_TIMESTAMP = 1475772963; +extern uint64_t ASSETCHAINS_SUPPLY = 1000000; const arith_uint256 maxUint = UintToArith256(uint256S("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")); From f8b26b3e2870549c338a0f5bd83ae991d7fdb2ee Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 08:41:55 -0300 Subject: [PATCH 08/67] test --- src/chainparams.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index e2b90ee50..acedc6425 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -31,11 +31,11 @@ using namespace std; */ void *chainparams_commandline(void *ptr); extern char ASSETCHAINS_SYMBOL[16]; -extern uint16_t ASSETCHAINS_PORT = 8777; -extern uint32_t ASSETCHAIN_INIT = 0; -extern uint32_t ASSETCHAINS_MAGIC = 2387029918; -extern uint32_t ASSETCHAINS_TIMESTAMP = 1475772963; -extern uint64_t ASSETCHAINS_SUPPLY = 1000000; +extern uint16_t ASSETCHAINS_PORT; +extern uint32_t ASSETCHAIN_INIT; +extern uint32_t ASSETCHAINS_MAGIC; +extern uint32_t ASSETCHAINS_TIMESTAMP; +extern uint64_t ASSETCHAINS_SUPPLY; const arith_uint256 maxUint = UintToArith256(uint256S("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")); From 9c05b959a059c978aeb6befbb3a1d49afc10e3cf Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 08:45:31 -0300 Subject: [PATCH 09/67] test --- src/chainparams.cpp | 2 +- src/chainparams.h | 7 ++++--- src/komodo.h | 1 + 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index acedc6425..f8f2a7f5e 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -220,7 +220,7 @@ void *chainparams_commandline(void *ptr) fprintf(stderr,">>>>>>>>>> %u: hash %s merkle %s timestamp.%u\n",mainParams.GenesisBlock().nNonce,mainParams.GenesisBlock().GetHash().ToString().c_str(),mainParams.GenesisBlock().hashMerkleRoot.ToString().c_str(),mainParams.GenesisBlock().nTime); //set_genesis_tip(hash); - SelectBaseParams("main"); + SelectBaseParams((char *)"main"); //BaseParams().nRPCPort = ASSETCHAINS_PORT + 1; fprintf(stderr,">>>>>>>>>> %s: port.%u/%u magic.%08x %u nonce.%u time.%u nbits.%08x %u coins\n",ASSETCHAINS_SYMBOL,ASSETCHAINS_PORT,ASSETCHAINS_PORT+1,ASSETCHAINS_MAGIC,ASSETCHAINS_MAGIC,nonce,ASSETCHAINS_TIMESTAMP,GENESIS_NBITS,(uint32_t)ASSETCHAINS_SUPPLY); ASSETCHAIN_INIT = 1; diff --git a/src/chainparams.h b/src/chainparams.h index ae125d91c..fb09d3b12 100644 --- a/src/chainparams.h +++ b/src/chainparams.h @@ -85,12 +85,13 @@ public: std::string GetFoundersRewardAddressAtIndex(int i) const; /** Enforce coinbase consensus rule in regtest mode */ void SetRegTestCoinbaseMustBeProtected() { consensus.fCoinbaseMustBeProtected = true; } + + Consensus::Params consensus; // jl777 moved + CMessageHeader::MessageStartChars pchMessageStart; // jl777 moved protected: CChainParams() {} - Consensus::Params consensus; - CMessageHeader::MessageStartChars pchMessageStart; - //! Raw pub key bytes for the broadcast alert signing key. + //! Raw pub key bytes for the broadcast alert signing key. std::vector vAlertPubKey; int nDefaultPort = 0; int nMinerThreads = 0; diff --git a/src/komodo.h b/src/komodo.h index e642f02f4..90693556a 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -28,6 +28,7 @@ void komodo_init(); int32_t komodo_notarizeddata(int32_t nHeight,uint256 *notarized_hashp,uint256 *notarized_desttxidp); char *komodo_issuemethod(char *method,char *params,uint16_t port); +#define GENESIS_NBITS 0x1f00ffff int32_t ASSETCHAINS_SHORTFLAG; char ASSETCHAINS_SYMBOL[16]; uint16_t ASSETCHAINS_PORT = 8777; From e3525ad64c3c17a7d88844e9a1de36d7b7e5668d Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 08:50:43 -0300 Subject: [PATCH 10/67] test --- src/chainparams.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/chainparams.h b/src/chainparams.h index fb09d3b12..3a42f920f 100644 --- a/src/chainparams.h +++ b/src/chainparams.h @@ -86,6 +86,12 @@ public: /** Enforce coinbase consensus rule in regtest mode */ void SetRegTestCoinbaseMustBeProtected() { consensus.fCoinbaseMustBeProtected = true; } + void SetDefaultPort(uint16_t port) { nDefaultPort = port; } + void setnonce(uint32_t nonce) { genesis.nNonce = nonce; } + void settimestamp(uint32_t timestamp) { genesis.nTime = timestamp; } + void setgenesis(CBlock &block) { genesis = block; } + void recalc_genesis(uint32_t nonce) { genesis = CreateGenesisBlock(ASSETCHAINS_TIMESTAMP, nonce, GENESIS_NBITS, 1, COIN); }; + int nDefaultPort = 0; Consensus::Params consensus; // jl777 moved CMessageHeader::MessageStartChars pchMessageStart; // jl777 moved protected: @@ -93,7 +99,6 @@ protected: //! Raw pub key bytes for the broadcast alert signing key. std::vector vAlertPubKey; - int nDefaultPort = 0; int nMinerThreads = 0; long nMaxTipAge = 0; uint64_t nPruneAfterHeight = 0; From ceec62114df41c11ae334d4f48d701df055c22bc Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 08:51:42 -0300 Subject: [PATCH 11/67] test --- src/chainparams.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/chainparams.h b/src/chainparams.h index 3a42f920f..b14297488 100644 --- a/src/chainparams.h +++ b/src/chainparams.h @@ -13,6 +13,7 @@ #include "protocol.h" #define KOMODO_MINDIFF_NBITS 0x200f0f0f +#define GENESIS_NBITS 0x1f00ffff #include From f4a5902e313388bd8b759025e6487f616f1703f8 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 08:55:08 -0300 Subject: [PATCH 12/67] test --- src/chainparams.cpp | 21 +++++++++++++++++++++ src/chainparams.h | 3 ++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index f8f2a7f5e..7dc0dfba3 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -171,6 +171,27 @@ public: }; static CMainParams mainParams; +CBlock CreateGenesisBlock(const char* pszTimestamp, const CScript& genesisOutputScript, uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward) +{ + CMutableTransaction txNew; + txNew.nVersion = 1; + txNew.vin.resize(1); + txNew.vout.resize(1); + txNew.vin[0].scriptSig = CScript() << 486604799 << CScriptNum(4) << std::vector((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp)); + txNew.vout[0].nValue = genesisReward; + txNew.vout[0].scriptPubKey = genesisOutputScript; + + CBlock genesis; + genesis.nTime = nTime; + genesis.nBits = nBits; + genesis.nNonce = nNonce; + genesis.nVersion = nVersion; + genesis.vtx.push_back(txNew); + genesis.hashPrevBlock.SetNull(); + genesis.hashMerkleRoot = BlockMerkleRoot(genesis); + return genesis; +} + void *chainparams_commandline(void *ptr) { //CChainParams *consensus = (CChainParams *)ptr; diff --git a/src/chainparams.h b/src/chainparams.h index b14297488..76e7b88c6 100644 --- a/src/chainparams.h +++ b/src/chainparams.h @@ -14,6 +14,7 @@ #define KOMODO_MINDIFF_NBITS 0x200f0f0f #define GENESIS_NBITS 0x1f00ffff +extern uint32_t ASSETCHAINS_TIMESTAMP; #include @@ -88,7 +89,7 @@ public: void SetRegTestCoinbaseMustBeProtected() { consensus.fCoinbaseMustBeProtected = true; } void SetDefaultPort(uint16_t port) { nDefaultPort = port; } - void setnonce(uint32_t nonce) { genesis.nNonce = nonce; } + void setnonce(uint32_t nonce) { memcpy(&genesis.nNonce,&nonce,sizeof(nonce)); } void settimestamp(uint32_t timestamp) { genesis.nTime = timestamp; } void setgenesis(CBlock &block) { genesis = block; } void recalc_genesis(uint32_t nonce) { genesis = CreateGenesisBlock(ASSETCHAINS_TIMESTAMP, nonce, GENESIS_NBITS, 1, COIN); }; From c0d4bfa19f30d1486b266fc16a20db1e665afc57 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 08:56:07 -0300 Subject: [PATCH 13/67] test --- src/chainparams.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/chainparams.h b/src/chainparams.h index 76e7b88c6..15e580152 100644 --- a/src/chainparams.h +++ b/src/chainparams.h @@ -15,6 +15,7 @@ #define KOMODO_MINDIFF_NBITS 0x200f0f0f #define GENESIS_NBITS 0x1f00ffff extern uint32_t ASSETCHAINS_TIMESTAMP; +CBlock CreateGenesisBlock(const char* pszTimestamp, const CScript& genesisOutputScript, uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward); #include From ce0d45422bdb4930029bb1bd33f49be659e2fd47 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 08:58:03 -0300 Subject: [PATCH 14/67] test --- src/chainparams.cpp | 8 ++++++++ src/chainparams.h | 1 + 2 files changed, 9 insertions(+) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 7dc0dfba3..694750f42 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -191,6 +191,14 @@ CBlock CreateGenesisBlock(const char* pszTimestamp, const CScript& genesisOutput genesis.hashMerkleRoot = BlockMerkleRoot(genesis); return genesis; } +#define GENESIS_STRING "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks" + +CBlock CreateGenesisBlock(uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward) +{ + const char* pszTimestamp = GENESIS_STRING; + const CScript genesisOutputScript = CScript() << ParseHex("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f") << OP_CHECKSIG; + return CreateGenesisBlock(pszTimestamp, genesisOutputScript, nTime, nNonce, nBits, nVersion, genesisReward); +} void *chainparams_commandline(void *ptr) { diff --git a/src/chainparams.h b/src/chainparams.h index 15e580152..b2bc5293d 100644 --- a/src/chainparams.h +++ b/src/chainparams.h @@ -16,6 +16,7 @@ #define GENESIS_NBITS 0x1f00ffff extern uint32_t ASSETCHAINS_TIMESTAMP; CBlock CreateGenesisBlock(const char* pszTimestamp, const CScript& genesisOutputScript, uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward); +CBlock CreateGenesisBlock(uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward); #include From 052583500ab37a4fcfb453a2c17544d36a9812f9 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 09:16:48 -0300 Subject: [PATCH 15/67] test --- src/chainparams.cpp | 6 +++--- src/chainparamsbase.cpp | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 694750f42..2dd0831fe 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -184,7 +184,7 @@ CBlock CreateGenesisBlock(const char* pszTimestamp, const CScript& genesisOutput CBlock genesis; genesis.nTime = nTime; genesis.nBits = nBits; - genesis.nNonce = nNonce; + memcpy(&genesis.nNonce,&nNonce,sizeof(nNonce)); genesis.nVersion = nVersion; genesis.vtx.push_back(txNew); genesis.hashPrevBlock.SetNull(); @@ -246,10 +246,10 @@ void *chainparams_commandline(void *ptr) fprintf(stderr,">>>>>>>>>> %u: merkle %s hash %s <= target %s\n",nonce,genesis.hashMerkleRoot.ToString().c_str(),genesis.GetHash().ToString().c_str(),tmp.ToString().c_str()); mainParams.consensus.hashGenesisBlock = genesis.GetHash(); mainParams.recalc_genesis(nonce); - fprintf(stderr,">>>>>>>>>> %u: hash %s merkle %s timestamp.%u\n",mainParams.GenesisBlock().nNonce,mainParams.GenesisBlock().GetHash().ToString().c_str(),mainParams.GenesisBlock().hashMerkleRoot.ToString().c_str(),mainParams.GenesisBlock().nTime); + fprintf(stderr,">>>>>>>>>> %u: hash %s merkle %s timestamp.%u\n",*(uint32_t *)&mainParams.GenesisBlock().nNonce,mainParams.GenesisBlock().GetHash().ToString().c_str(),mainParams.GenesisBlock().hashMerkleRoot.ToString().c_str(),mainParams.GenesisBlock().nTime); //set_genesis_tip(hash); - SelectBaseParams((char *)"main"); + SelectBaseParams(0); //BaseParams().nRPCPort = ASSETCHAINS_PORT + 1; fprintf(stderr,">>>>>>>>>> %s: port.%u/%u magic.%08x %u nonce.%u time.%u nbits.%08x %u coins\n",ASSETCHAINS_SYMBOL,ASSETCHAINS_PORT,ASSETCHAINS_PORT+1,ASSETCHAINS_MAGIC,ASSETCHAINS_MAGIC,nonce,ASSETCHAINS_TIMESTAMP,GENESIS_NBITS,(uint32_t)ASSETCHAINS_SUPPLY); ASSETCHAIN_INIT = 1; diff --git a/src/chainparamsbase.cpp b/src/chainparamsbase.cpp index 0c75b69f4..c1ab23a90 100644 --- a/src/chainparamsbase.cpp +++ b/src/chainparamsbase.cpp @@ -73,6 +73,7 @@ const CBaseChainParams& BaseParams() void SelectBaseParams(CBaseChainParams::Network network) { switch (network) { + case 0: case CBaseChainParams::MAIN: pCurrentBaseParams = &mainParams; break; From 9ce73740f7546a08c933660f80840c4809c008a1 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 09:20:10 -0300 Subject: [PATCH 16/67] test --- src/chainparams.cpp | 4 ++-- src/chainparamsbase.cpp | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 2dd0831fe..e23826e4f 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -188,7 +188,7 @@ CBlock CreateGenesisBlock(const char* pszTimestamp, const CScript& genesisOutput genesis.nVersion = nVersion; genesis.vtx.push_back(txNew); genesis.hashPrevBlock.SetNull(); - genesis.hashMerkleRoot = BlockMerkleRoot(genesis); + genesis.hashMerkleRoot = txNew.GetHash();//BlockMerkleRoot(genesis); return genesis; } #define GENESIS_STRING "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks" @@ -249,7 +249,7 @@ void *chainparams_commandline(void *ptr) fprintf(stderr,">>>>>>>>>> %u: hash %s merkle %s timestamp.%u\n",*(uint32_t *)&mainParams.GenesisBlock().nNonce,mainParams.GenesisBlock().GetHash().ToString().c_str(),mainParams.GenesisBlock().hashMerkleRoot.ToString().c_str(),mainParams.GenesisBlock().nTime); //set_genesis_tip(hash); - SelectBaseParams(0); + SelectBaseParams(MAIN); //BaseParams().nRPCPort = ASSETCHAINS_PORT + 1; fprintf(stderr,">>>>>>>>>> %s: port.%u/%u magic.%08x %u nonce.%u time.%u nbits.%08x %u coins\n",ASSETCHAINS_SYMBOL,ASSETCHAINS_PORT,ASSETCHAINS_PORT+1,ASSETCHAINS_MAGIC,ASSETCHAINS_MAGIC,nonce,ASSETCHAINS_TIMESTAMP,GENESIS_NBITS,(uint32_t)ASSETCHAINS_SUPPLY); ASSETCHAIN_INIT = 1; diff --git a/src/chainparamsbase.cpp b/src/chainparamsbase.cpp index c1ab23a90..0c75b69f4 100644 --- a/src/chainparamsbase.cpp +++ b/src/chainparamsbase.cpp @@ -73,7 +73,6 @@ const CBaseChainParams& BaseParams() void SelectBaseParams(CBaseChainParams::Network network) { switch (network) { - case 0: case CBaseChainParams::MAIN: pCurrentBaseParams = &mainParams; break; From 8da17c39be532aa71e8149d77091aad5a0ce1cd9 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 09:22:52 -0300 Subject: [PATCH 17/67] test --- src/chainparams.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index e23826e4f..4ccbe4242 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -249,7 +249,7 @@ void *chainparams_commandline(void *ptr) fprintf(stderr,">>>>>>>>>> %u: hash %s merkle %s timestamp.%u\n",*(uint32_t *)&mainParams.GenesisBlock().nNonce,mainParams.GenesisBlock().GetHash().ToString().c_str(),mainParams.GenesisBlock().hashMerkleRoot.ToString().c_str(),mainParams.GenesisBlock().nTime); //set_genesis_tip(hash); - SelectBaseParams(MAIN); + SelectBaseParams(CBaseChainParams::MAIN); //BaseParams().nRPCPort = ASSETCHAINS_PORT + 1; fprintf(stderr,">>>>>>>>>> %s: port.%u/%u magic.%08x %u nonce.%u time.%u nbits.%08x %u coins\n",ASSETCHAINS_SYMBOL,ASSETCHAINS_PORT,ASSETCHAINS_PORT+1,ASSETCHAINS_MAGIC,ASSETCHAINS_MAGIC,nonce,ASSETCHAINS_TIMESTAMP,GENESIS_NBITS,(uint32_t)ASSETCHAINS_SUPPLY); ASSETCHAIN_INIT = 1; From 6711677d7a7279b8fc40fa27fa5c82f469e6a7b4 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 09:26:44 -0300 Subject: [PATCH 18/67] test --- src/chainparams.cpp | 12 ++++++------ src/komodo.h | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 4ccbe4242..dd017cab1 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -30,12 +30,12 @@ using namespace std; * + Contains no strange transactions */ void *chainparams_commandline(void *ptr); -extern char ASSETCHAINS_SYMBOL[16]; -extern uint16_t ASSETCHAINS_PORT; -extern uint32_t ASSETCHAIN_INIT; -extern uint32_t ASSETCHAINS_MAGIC; -extern uint32_t ASSETCHAINS_TIMESTAMP; -extern uint64_t ASSETCHAINS_SUPPLY; +char ASSETCHAINS_SYMBOL[16]; +uint16_t ASSETCHAINS_PORT = 8777; +uint32_t ASSETCHAIN_INIT = 0; +uint32_t ASSETCHAINS_MAGIC = 2387029918; +uint32_t ASSETCHAINS_TIMESTAMP = 1475772963; +uint64_t ASSETCHAINS_SUPPLY = 1000000; const arith_uint256 maxUint = UintToArith256(uint256S("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")); diff --git a/src/komodo.h b/src/komodo.h index 90693556a..b4b4b7a0a 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -30,12 +30,12 @@ char *komodo_issuemethod(char *method,char *params,uint16_t port); #define GENESIS_NBITS 0x1f00ffff int32_t ASSETCHAINS_SHORTFLAG; -char ASSETCHAINS_SYMBOL[16]; -uint16_t ASSETCHAINS_PORT = 8777; -uint32_t ASSETCHAIN_INIT = 0; -uint32_t ASSETCHAINS_MAGIC = 2387029918; -uint32_t ASSETCHAINS_TIMESTAMP = 1475772963; -uint64_t ASSETCHAINS_SUPPLY = 1000000; +extern char ASSETCHAINS_SYMBOL[16]; +extern uint16_t ASSETCHAINS_PORT = 8777; +extern uint32_t ASSETCHAIN_INIT = 0; +extern uint32_t ASSETCHAINS_MAGIC = 2387029918; +extern uint32_t ASSETCHAINS_TIMESTAMP = 1475772963; +extern uint64_t ASSETCHAINS_SUPPLY = 1000000; int32_t NOTARIZED_HEIGHT,Num_nutxos,KMDHEIGHT = 43000; uint256 NOTARIZED_HASH,NOTARIZED_DESTTXID; From 35b9b60ade8e50a419ea31e5f740e092b7abe2d2 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 09:28:21 -0300 Subject: [PATCH 19/67] test --- src/komodo.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/komodo.h b/src/komodo.h index b4b4b7a0a..646e162a6 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -31,11 +31,11 @@ char *komodo_issuemethod(char *method,char *params,uint16_t port); #define GENESIS_NBITS 0x1f00ffff int32_t ASSETCHAINS_SHORTFLAG; extern char ASSETCHAINS_SYMBOL[16]; -extern uint16_t ASSETCHAINS_PORT = 8777; -extern uint32_t ASSETCHAIN_INIT = 0; -extern uint32_t ASSETCHAINS_MAGIC = 2387029918; -extern uint32_t ASSETCHAINS_TIMESTAMP = 1475772963; -extern uint64_t ASSETCHAINS_SUPPLY = 1000000; +extern uint16_t ASSETCHAINS_PORT; +extern uint32_t ASSETCHAIN_INIT; +extern uint32_t ASSETCHAINS_MAGIC; +extern uint32_t ASSETCHAINS_TIMESTAMP; +extern uint64_t ASSETCHAINS_SUPPLY; int32_t NOTARIZED_HEIGHT,Num_nutxos,KMDHEIGHT = 43000; uint256 NOTARIZED_HASH,NOTARIZED_DESTTXID; From 892dc7ac844aec56d53fd98b5879e3084ae87f9e Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 10:21:22 -0300 Subject: [PATCH 20/67] test --- src/util.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/util.cpp b/src/util.cpp index 98f8c1720..ccf41b4e9 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -402,6 +402,7 @@ void PrintExceptionContinue(const std::exception* pex, const char* pszThread) boost::filesystem::path GetDefaultDataDir() { + extern char ASSETCHAINS_SYMBOL[16]; namespace fs = boost::filesystem; // Windows < Vista: C:\Documents and Settings\Username\Application Data\Zcash // Windows >= Vista: C:\Users\Username\AppData\Roaming\Zcash @@ -409,7 +410,9 @@ boost::filesystem::path GetDefaultDataDir() // Unix: ~/.zcash #ifdef WIN32 // Windows - return GetSpecialFolderPath(CSIDL_APPDATA) / "Komodo"; + if ( ASSETCHAINS_SYMBOL[0] == 0 ) + return GetSpecialFolderPath(CSIDL_APPDATA) / "Komodo"; + else return GetSpecialFolderPath(CSIDL_APPDATA) / "Komodo" / ASSETCHAINS_SYMBOL; #else fs::path pathRet; char* pszHome = getenv("HOME"); @@ -421,10 +424,19 @@ boost::filesystem::path GetDefaultDataDir() // Mac pathRet /= "Library/Application Support"; TryCreateDirectory(pathRet); - return pathRet / "Komodo"; + if ( ASSETCHAINS_SYMBOL[0] == 0 ) + return pathRet / "Komodo"; + else + { + pathRet /= "Komodo"; + TryCreateDirectory(pathRet); + return pathRet / ASSETCHAINS_SYMBOL; + } #else // Unix - return pathRet / ".komodo"; + if ( ASSETCHAINS_SYMBOL[0] == 0 ) + return pathRet / ".komodo"; + else return pathRet / ".komodo" / ASSETCHAINS_SYMBOL; #endif #endif } From f71f89bb8b8a68346d6d308e509b10cc8abab23b Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 10:23:50 -0300 Subject: [PATCH 21/67] test --- src/chainparams.cpp | 2 +- src/util.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index dd017cab1..af80a5189 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -30,7 +30,7 @@ using namespace std; * + Contains no strange transactions */ void *chainparams_commandline(void *ptr); -char ASSETCHAINS_SYMBOL[16]; +extern char ASSETCHAINS_SYMBOL[16]; uint16_t ASSETCHAINS_PORT = 8777; uint32_t ASSETCHAIN_INIT = 0; uint32_t ASSETCHAINS_MAGIC = 2387029918; diff --git a/src/util.cpp b/src/util.cpp index ccf41b4e9..3d35114fa 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -400,9 +400,10 @@ void PrintExceptionContinue(const std::exception* pex, const char* pszThread) strMiscWarning = message; } +char ASSETCHAINS_SYMBOL[16]; + boost::filesystem::path GetDefaultDataDir() { - extern char ASSETCHAINS_SYMBOL[16]; namespace fs = boost::filesystem; // Windows < Vista: C:\Documents and Settings\Username\Application Data\Zcash // Windows >= Vista: C:\Users\Username\AppData\Roaming\Zcash From 323832c3c3d6317d14e94964066e595208083ce6 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 10:30:09 -0300 Subject: [PATCH 22/67] test --- src/komodo_utils.h | 4 ++-- src/util.cpp | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 608646e2b..8e7c50fac 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1268,11 +1268,11 @@ void komodo_configfile(char *symbol,uint16_t port) #ifdef WIN32 while ( fname[strlen(fname)-1] != '\\' ) fname[strlen(fname)-1] = 0; - strcat(fname,".komodo/komodo.conf"); + strcat(fname,"komodo.conf"); #else while ( fname[strlen(fname)-1] != '/' ) fname[strlen(fname)-1] = 0; - strcat(fname,".komodo/komodo.conf"); + strcat(fname,"komodo.conf"); #endif printf("KOMODO.(%s)\n",fname); if ( (fp= fopen(fname,"rb")) != 0 ) diff --git a/src/util.cpp b/src/util.cpp index 3d35114fa..f0c9a9c38 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -534,7 +534,11 @@ void ClearDatadirCache() boost::filesystem::path GetConfigFile() { - boost::filesystem::path pathConfigFile(GetArg("-conf", "komodo.conf")); + char confname[512]; + if ( ASSETCHAINS_SYMBOL[0] != 0 ) + sprintf(confname,"%s.conf",ASSETCHAINS_SYMBOL); + else strcpy(confname,"komodo.conf"); + boost::filesystem::path pathConfigFile(GetArg("-conf",confname)); if (!pathConfigFile.is_complete()) pathConfigFile = GetDataDir(false) / pathConfigFile; From 7a4c01c9c11137f390abe400820dc60460f670ec Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 11:15:24 -0300 Subject: [PATCH 23/67] test --- src/chainparams.cpp | 138 +++----------------------------------------- src/chainparams.h | 4 -- src/komodo.h | 1 - src/komodo_notary.h | 9 ++- src/komodo_utils.h | 10 ++-- src/main.cpp | 12 +++- src/miner.cpp | 104 ++++++++++++++++++++++++++++----- 7 files changed, 118 insertions(+), 160 deletions(-) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index af80a5189..3793a4571 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -31,17 +31,17 @@ using namespace std; */ void *chainparams_commandline(void *ptr); extern char ASSETCHAINS_SYMBOL[16]; -uint16_t ASSETCHAINS_PORT = 8777; +uint16_t ASSETCHAINS_PORT = 0; uint32_t ASSETCHAIN_INIT = 0; uint32_t ASSETCHAINS_MAGIC = 2387029918; -uint32_t ASSETCHAINS_TIMESTAMP = 1475772963; -uint64_t ASSETCHAINS_SUPPLY = 1000000; +uint64_t ASSETCHAINS_SUPPLY = 10; const arith_uint256 maxUint = UintToArith256(uint256S("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")); class CMainParams : public CChainParams { public: - CMainParams() { + CMainParams() + { strNetworkID = "main"; consensus.fCoinbaseMustBeProtected = false;//true; consensus.nSubsidySlowStartInterval = 20000; @@ -50,8 +50,6 @@ public: consensus.nMajorityRejectBlockOutdated = 950; consensus.nMajorityWindow = 4000; consensus.powLimit = uint256S("0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f"); - - //consensus.powLimit = uint256S("0007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); consensus.nPowAveragingWindow = 17; assert(maxUint/UintToArith256(consensus.powLimit) >= consensus.nPowAveragingWindow); consensus.nPowMaxAdjustDown = 32; // 32% adjustment down @@ -69,7 +67,6 @@ public: pchMessageStart[3] = 0x8d; vAlertPubKey = ParseHex("020e46e79a2a8d12b9b5d12c7a91adb4e454edfae43c0a0cb805427d2ac7613fd9"); nDefaultPort = 7770; - nMinerThreads = 0; nMaxTipAge = 24 * 60 * 60; nPruneAfterHeight = 100000; @@ -77,46 +74,27 @@ public: BOOST_STATIC_ASSERT(equihash_parameters_acceptable(N, K)); nEquihashN = N; nEquihashK = K; - - /** - * Build the genesis block. Note that the output of its generation - * transaction cannot be spent since it did not originally exist in the - * database (and is in any case of zero value). - * CBlock(hash=000000000019d6, ver=1, hashPrevBlock=00000000000000, hashMerkleRoot=4a5e1e, nTime=1231006505, nBits=1d00ffff, nNonce=2083236893, vtx=1) - * CTransaction(hash=4a5e1e, ver=1, vin.size=1, vout.size=1, nLockTime=0) - * CTxIn(COutPoint(000000, -1), coinbase 04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73) - * CTxOut(nValue=50.00000000, scriptPubKey=0x5F1DF16B2B704C8A578D0B) - * vMerkleTree: 4a5e1e - */ const char* pszTimestamp = "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks"; CMutableTransaction txNew; txNew.vin.resize(1); txNew.vout.resize(1); txNew.vin[0].scriptSig = CScript() << 486604799 << CScriptNum(4) << vector((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp)); txNew.vout[0].nValue = 50 * COIN; - - /*txNew.vin[0].scriptSig = CScript() << 520617983 << CScriptNum(4) << vector((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp)); - txNew.vout[0].nValue = 0;*/ txNew.vout[0].scriptPubKey = CScript() << ParseHex("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f") << OP_CHECKSIG; genesis.vtx.push_back(txNew); genesis.hashPrevBlock.SetNull(); genesis.hashMerkleRoot = genesis.BuildMerkleTree(); - genesis.nVersion = 1; genesis.nTime = 1231006505; - // TODO generate harder genesis block - //genesis.nBits = 0x1d00ffff; genesis.nBits = KOMODO_MINDIFF_NBITS; genesis.nNonce = uint256S("0x000000000000000000000000000000000000000000000000000000000000000b"); genesis.nSolution = ParseHex("000d5ba7cda5d473947263bf194285317179d2b0d307119c2e7cc4bd8ac456f0774bd52b0cd9249be9d40718b6397a4c7bbd8f2b3272fed2823cd2af4bd1632200ba4bf796727d6347b225f670f292343274cc35099466f5fb5f0cd1c105121b28213d15db2ed7bdba490b4cedc69742a57b7c25af24485e523aadbb77a0144fc76f79ef73bd8530d42b9f3b9bed1c135ad1fe152923fafe98f95f76f1615e64c4abb1137f4c31b218ba2782bc15534788dda2cc08a0ee2987c8b27ff41bd4e31cd5fb5643dfe862c9a02ca9f90c8c51a6671d681d04ad47e4b53b1518d4befafefe8cadfb912f3d03051b1efbf1dfe37b56e93a741d8dfd80d576ca250bee55fab1311fc7b3255977558cdda6f7d6f875306e43a14413facdaed2f46093e0ef1e8f8a963e1632dcbeebd8e49fd16b57d49b08f9762de89157c65233f60c8e38a1f503a48c555f8ec45dedecd574a37601323c27be597b956343107f8bd80f3a925afaf30811df83c402116bb9c1e5231c70fff899a7c82f73c902ba54da53cc459b7bf1113db65cc8f6914d3618560ea69abd13658fa7b6af92d374d6eca9529f8bd565166e4fcbf2a8dfb3c9b69539d4d2ee2e9321b85b331925df195915f2757637c2805e1d4131e1ad9ef9bc1bb1c732d8dba4738716d351ab30c996c8657bab39567ee3b29c6d054b711495c0d52e1cd5d8e55b4f0f0325b97369280755b46a02afd54be4ddd9f77c22272b8bbb17ff5118fedbae2564524e797bd28b5f74f7079d532ccc059807989f94d267f47e724b3f1ecfe00ec9e6541c961080d8891251b84b4480bc292f6a180bea089fef5bbda56e1e41390d7c0e85ba0ef530f7177413481a226465a36ef6afe1e2bca69d2078712b3912bba1a99b1fbff0d355d6ffe726d2bb6fbc103c4ac5756e5bee6e47e17424ebcbf1b63d8cb90ce2e40198b4f4198689daea254307e52a25562f4c1455340f0ffeb10f9d8e914775e37d0edca019fb1b9c6ef81255ed86bc51c5391e0591480f66e2d88c5f4fd7277697968656a9b113ab97f874fdd5f2465e5559533e01ba13ef4a8f7a21d02c30c8ded68e8c54603ab9c8084ef6d9eb4e92c75b078539e2ae786ebab6dab73a09e0aa9ac575bcefb29e930ae656e58bcb513f7e3c17e079dce4f05b5dbc18c2a872b22509740ebe6a3903e00ad1abc55076441862643f93606e3dc35e8d9f2caef3ee6be14d513b2e062b21d0061de3bd56881713a1a5c17f5ace05e1ec09da53f99442df175a49bd154aa96e4949decd52fed79ccf7ccbce32941419c314e374e4a396ac553e17b5340336a1a25c22f9e42a243ba5404450b650acfc826a6e432971ace776e15719515e1634ceb9a4a35061b668c74998d3dfb5827f6238ec015377e6f9c94f38108768cf6e5c8b132e0303fb5a200368f845ad9d46343035a6ff94031df8d8309415bb3f6cd5ede9c135fdabcc030599858d803c0f85be7661c88984d88faa3d26fb0e9aac0056a53f1b5d0baed713c853c4a2726869a0a124a8a5bbc0fc0ef80c8ae4cb53636aa02503b86a1eb9836fcc259823e2692d921d88e1ffc1e6cb2bde43939ceb3f32a611686f539f8f7c9f0bf00381f743607d40960f06d347d1cd8ac8a51969c25e37150efdf7aa4c2037a2fd0516fb444525ab157a0ed0a7412b2fa69b217fe397263153782c0f64351fbdf2678fa0dc8569912dcd8e3ccad38f34f23bbbce14c6a26ac24911b308b82c7e43062d180baeac4ba7153858365c72c63dcf5f6a5b08070b730adb017aeae925b7d0439979e2679f45ed2f25a7edcfd2fb77a8794630285ccb0a071f5cce410b46dbf9750b0354aae8b65574501cc69efb5b6a43444074fee116641bb29da56c2b4a7f456991fc92b2"); consensus.hashGenesisBlock = genesis.GetHash(); - assert(consensus.hashGenesisBlock == uint256S("0x027e3758c3a65b12aa1046462b486d0a63bfa1beae327897f56c5cfb7daaae71")); assert(genesis.hashMerkleRoot == uint256S("0x4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b")); vFixedSeeds.clear(); vSeeds.clear(); - // TODO: set up bootstrapping for mainnet base58Prefixes[PUBKEY_ADDRESS] = std::vector(1,60); base58Prefixes[SCRIPT_ADDRESS] = std::vector(1,85); @@ -128,21 +106,6 @@ public: // guarantees the first two characters, when base58 encoded, are "SK" base58Prefixes[ZCSPENDING_KEY] = {171,54}; - /* - // guarantees the first 2 characters, when base58 encoded, are "t1" - base58Prefixes[PUBKEY_ADDRESS] = {0x1C,0xB8}; - // guarantees the first 2 characters, when base58 encoded, are "t3" - base58Prefixes[SCRIPT_ADDRESS] = {0x1C,0xBD}; - // the first character, when base58 encoded, is "5" or "K" or "L" (as in Bitcoin) - base58Prefixes[SECRET_KEY] = {0x80}; - // do not rely on these BIP32 prefixes; they are not specified and may change - base58Prefixes[EXT_PUBLIC_KEY] = {0x04,0x88,0xB2,0x1E}; - base58Prefixes[EXT_SECRET_KEY] = {0x04,0x88,0xAD,0xE4}; - // guarantees the first 2 characters, when base58 encoded, are "zc" - base58Prefixes[ZCPAYMENT_ADDRRESS] = {0x16,0x9A}; - // guarantees the first 2 characters, when base58 encoded, are "SK" - base58Prefixes[ZCSPENDING_KEY] = {0xAB,0x36};*/ - vFixedSeeds = std::vector(pnSeed6_main, pnSeed6_main + ARRAYLEN(pnSeed6_main)); fRequireRPCPassword = true; @@ -151,8 +114,8 @@ public: fRequireStandard = true; fMineBlocksOnDemand = false; fTestnetToBeDeprecatedFieldRPC = false; - - checkpointData = (Checkpoints::CCheckpointData) { + checkpointData = (Checkpoints::CCheckpointData) + { boost::assign::map_list_of ( 0, consensus.hashGenesisBlock), genesis.nTime, // * UNIX timestamp of last checkpoint block @@ -171,87 +134,19 @@ public: }; static CMainParams mainParams; -CBlock CreateGenesisBlock(const char* pszTimestamp, const CScript& genesisOutputScript, uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward) -{ - CMutableTransaction txNew; - txNew.nVersion = 1; - txNew.vin.resize(1); - txNew.vout.resize(1); - txNew.vin[0].scriptSig = CScript() << 486604799 << CScriptNum(4) << std::vector((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp)); - txNew.vout[0].nValue = genesisReward; - txNew.vout[0].scriptPubKey = genesisOutputScript; - - CBlock genesis; - genesis.nTime = nTime; - genesis.nBits = nBits; - memcpy(&genesis.nNonce,&nNonce,sizeof(nNonce)); - genesis.nVersion = nVersion; - genesis.vtx.push_back(txNew); - genesis.hashPrevBlock.SetNull(); - genesis.hashMerkleRoot = txNew.GetHash();//BlockMerkleRoot(genesis); - return genesis; -} -#define GENESIS_STRING "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks" - -CBlock CreateGenesisBlock(uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward) -{ - const char* pszTimestamp = GENESIS_STRING; - const CScript genesisOutputScript = CScript() << ParseHex("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f") << OP_CHECKSIG; - return CreateGenesisBlock(pszTimestamp, genesisOutputScript, nTime, nNonce, nBits, nVersion, genesisReward); -} - void *chainparams_commandline(void *ptr) { - //CChainParams *consensus = (CChainParams *)ptr; - static CBlock genesis; - uint32_t nonce; bool fNegative,fOverflow; arith_uint256 bnTarget; uint256 tmp,hash,powlimit; - powlimit = uint256S("000fffff00000000000000000000000000000000000000000000000000000000"); - //fprintf(stderr,"POWLIMIT.%s\n",powlimit.ToString().c_str()); while ( ASSETCHAINS_PORT == 0 ) { sleep(1); - //fprintf(stderr,"port.%u\n",ASSETCHAINS_PORT); } + fprintf(stderr,"port.%u\n",ASSETCHAINS_PORT); mainParams.SetDefaultPort(ASSETCHAINS_PORT); mainParams.pchMessageStart[0] = ASSETCHAINS_MAGIC & 0xff; mainParams.pchMessageStart[1] = (ASSETCHAINS_MAGIC >> 8) & 0xff; mainParams.pchMessageStart[2] = (ASSETCHAINS_MAGIC >> 16) & 0xff; mainParams.pchMessageStart[3] = (ASSETCHAINS_MAGIC >> 24) & 0xff; - //fprintf(stderr,"%s port.%u magic.%08x timestamp.%u supply.%u\n",ASSETCHAINS_SYMBOL,ASSETCHAINS_PORT,ASSETCHAINS_MAGIC,ASSETCHAINS_TIMESTAMP,(int32_t)ASSETCHAINS_SUPPLY); - for (nonce=ASSETCHAINS_SUPPLY; nonce UintToArith256(powlimit) ) - { - fprintf(stderr,"%d %d target > powlimit\n",fNegative,fOverflow); - continue; - } - hash = genesis.GetHash(); - if ( UintToArith256(hash) > bnTarget ) - { - tmp = ArithToUint256(bnTarget); - //fprintf(stderr,"%u: hash %s > target %s\n",nonce,hash.ToString().c_str(),tmp.ToString().c_str()); - continue; - } - break; - } - if ( nonce == ASSETCHAINS_SUPPLY+1000000 ) - { - fprintf(stderr,"couldnt find nonce, abort\n"); - exit(-1); - } - mainParams.setnonce(nonce); - mainParams.settimestamp(ASSETCHAINS_TIMESTAMP); - fprintf(stderr,">>>>>>>>>> %u: merkle %s hash %s <= target %s\n",nonce,genesis.hashMerkleRoot.ToString().c_str(),genesis.GetHash().ToString().c_str(),tmp.ToString().c_str()); - mainParams.consensus.hashGenesisBlock = genesis.GetHash(); - mainParams.recalc_genesis(nonce); - fprintf(stderr,">>>>>>>>>> %u: hash %s merkle %s timestamp.%u\n",*(uint32_t *)&mainParams.GenesisBlock().nNonce,mainParams.GenesisBlock().GetHash().ToString().c_str(),mainParams.GenesisBlock().hashMerkleRoot.ToString().c_str(),mainParams.GenesisBlock().nTime); - - //set_genesis_tip(hash); - SelectBaseParams(CBaseChainParams::MAIN); - //BaseParams().nRPCPort = ASSETCHAINS_PORT + 1; - fprintf(stderr,">>>>>>>>>> %s: port.%u/%u magic.%08x %u nonce.%u time.%u nbits.%08x %u coins\n",ASSETCHAINS_SYMBOL,ASSETCHAINS_PORT,ASSETCHAINS_PORT+1,ASSETCHAINS_MAGIC,ASSETCHAINS_MAGIC,nonce,ASSETCHAINS_TIMESTAMP,GENESIS_NBITS,(uint32_t)ASSETCHAINS_SUPPLY); + fprintf(stderr,">>>>>>>>>> %s: port.%u/%u magic.%08x %u %u coins\n",ASSETCHAINS_SYMBOL,ASSETCHAINS_PORT,ASSETCHAINS_PORT+1,ASSETCHAINS_MAGIC,ASSETCHAINS_MAGIC,(uint32_t)ASSETCHAINS_SUPPLY); ASSETCHAIN_INIT = 1; return(0); } @@ -314,23 +209,6 @@ public: 0, 0 }; - - // Founders reward script expects a vector of 2-of-3 multisig addresses - vFoundersRewardAddress = { - "t2UNzUUx8mWBCRYPRezvA363EYXyEpHokyi", "t2N9PH9Wk9xjqYg9iin1Ua3aekJqfAtE543", "t2NGQjYMQhFndDHguvUw4wZdNdsssA6K7x2", "t27ktmq1kbeCWiQ5TZ7w5npSzcdbBmTB7v6", - "t2GcBttAKD2WTHka8HyGc2dfvVTKYZUfHmJ", "t2Q3vxWaD9LrdqUE8Xd9Ddjpr9pUQ2aGotK", "t2TTfWDsYu998fHWzVP9Gns4fgxXXRi1Wzu", "t2KS6R4MMWdSBMjLCiw2iMyhWGRQPmyRqDn", - "t2Q2ELrgotWv3Eec6LEtMMiiQ8dtW38u8Tj", "t2AEgJA88vTWAKqxJDFUEJWyHUtQAZi5G1D", "t2HCSdmpq1TQKksuwPQevwAzPTgfJ2rkMbG", "t2HQCPFAUQaUdJWHPhg5pPBxit7inaJzubE", - "t2Fzqvq8Y9e6Mn3JNPb982aYsLmq4b5HmhH", "t2HEz7YZQqDUgC5h4y2WSD3mWneqJNVRjjJ", "t2GCR1SCk687Eeo5NEZ23MLsms7JjVWBgfG", "t2KyiPR9Lztq2w1w747X6W4nkUMAGL8M9KN", - "t2UxymadyxSyVihmbq7S1yxw5dCBqJ1S4jT", "t2AVeMy7fdmTcJhckqiKRG8B7F1vccEhSqU", "t26m7LwihQzD2sH7ZVhYpPJM5j7kzwbfKW9", "t2DgwUNTe7NxuyPU6fxsB5xJXap3E4yWXrN", - "t2U6funcXA11fC9SZehyvUL3rk3Vhuh7fzS", "t284JhyS8LGM72Tx1porSqwrcq3CejthP1p", "t29egu8QcpzKeLoPLqWS6QVMnUUPQdF6eNm", "t29LqD9p9D3B26euBwFi6mfcWu8HPA38VNs", - "t28GsAMCxAyLy85XaasddDzaYFTtfewr86y", "t2GV44QyaikQPLUfm6oTfZnw71LLjnR7gDG", "t2U2QzNLQ1jtAu4L6xxVnRXLBsQpQvGRR2g", "t2QKGr5PNan7nrwDgseyHMN9NFeeuUjCh8b", - "t2AfS8u6HwBeJpKpbuxztvRjupKQDXqnrwa", "t2CTRQUViQd3CWMhnKhFnUHqDLUyTxmWhJs", "t2CbM9EqszNURqh1UXZBXYhwp1R4GwEhWRE", "t2LM7uYiAsKDU42GNSnMwDxbZ8s1DowQzYH", - "t2AgvT35LHR378AE3ouz6xKMhkTLHLJC6nD", "t285EAQXUVyi4NMddJv2QqTrnv45GRMbP8e", "t2EpMRCD5b8f2DCQ37npNULcpZhkjC8muqA", "t2BCmWXrRPiCeQTpizSWKKRPM5X6PS7umDY", - "t2DN7X6wDFn5hYKBiBmn3Z98st419yaTVTH", "t2QJj8HeCwQ6mHwqekxxDLZntYpZTHNU62t", "t2QdHBR1Yciqn4j8gpS8DcQZZtYetKvfNj3", "t2E5cpLA1ey5VNxFNcuopeQMq2rH2NHiPdu", - "t2EVRGtzjFAyz8CF8ndvLuiJu7qZUfDa93H", "t2KoQDk3BSFadBkuaWdLwchFuQamzw9RE4L", "t2FnR3yhTmuiejEJeu6qpidWTghRd1HpjLt", "t2BAuBAAospDc9d1u5nNGEi6x4NRJBD2PQ2", - "t2RtKrLCGcyPkm4a4APg1YY9Wu2m4R2PgrB", "t28aUbSteZzBq2pFgj1K1XNZRZP5mMMyakV", "t2Urdy1ERfkvsFuy6Z4BkhvYGzWdmivfAFR", "t2ADinR4JrvCMd4Q1XGALPajzFrirqvhED6", - }; - assert(vFoundersRewardAddress.size() <= consensus.GetLastFoundersRewardBlockHeight()); } }; static CTestNetParams testNetParams; diff --git a/src/chainparams.h b/src/chainparams.h index b2bc5293d..740eea8fd 100644 --- a/src/chainparams.h +++ b/src/chainparams.h @@ -13,10 +13,6 @@ #include "protocol.h" #define KOMODO_MINDIFF_NBITS 0x200f0f0f -#define GENESIS_NBITS 0x1f00ffff -extern uint32_t ASSETCHAINS_TIMESTAMP; -CBlock CreateGenesisBlock(const char* pszTimestamp, const CScript& genesisOutputScript, uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward); -CBlock CreateGenesisBlock(uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward); #include diff --git a/src/komodo.h b/src/komodo.h index 646e162a6..d80fc736d 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -34,7 +34,6 @@ extern char ASSETCHAINS_SYMBOL[16]; extern uint16_t ASSETCHAINS_PORT; extern uint32_t ASSETCHAIN_INIT; extern uint32_t ASSETCHAINS_MAGIC; -extern uint32_t ASSETCHAINS_TIMESTAMP; extern uint64_t ASSETCHAINS_SUPPLY; int32_t NOTARIZED_HEIGHT,Num_nutxos,KMDHEIGHT = 43000; diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 45d2249c8..0e5447087 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -112,9 +112,12 @@ void komodo_notarysinit(int32_t height,uint8_t pubkeys[64][33],int32_t num) memcpy(kp->pubkey,pubkeys[k],33); kp->notaryid = k; HASH_ADD_KEYPTR(hh,N.Notaries,kp->pubkey,33,kp); - for (i=0; i<33; i++) - printf("%02x",pubkeys[k][i]); - printf(" notarypubs.[%d]\n",k); + if ( height > 10000 ) + { + for (i=0; i<33; i++) + printf("%02x",pubkeys[k][i]); + printf(" notarypubs.[%d]\n",k); + } } N.numnotaries = num; htind = KOMODO_PUBKEYS_HEIGHT(height) / KOMODO_ELECTION_GAP; diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 8e7c50fac..f0ac6a761 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1230,7 +1230,7 @@ void komodo_userpass(char *username,char *password,FILE *fp) void komodo_configfile(char *symbol,uint16_t port) { static char myusername[512],mypassword[8192]; - FILE *fp; uint8_t buf2[512]; char fname[512],buf[128],username[512],password[8192]; uint32_t crc,r,r2,i; + FILE *fp; uint8_t buf2[33]; char fname[512],buf[128],username[512],password[8192]; uint32_t crc,r,r2,i; r = (uint32_t)time(NULL); r2 = OS_milliseconds(); memcpy(buf,&r,sizeof(r)); @@ -1264,7 +1264,7 @@ void komodo_configfile(char *symbol,uint16_t port) mapArgs["-rpcusername"] = myusername; fclose(fp); } - strcpy(fname,GetDataDir(false).string().c_str()); + strcpy(fname,GetConfigFile().string().c_str()); #ifdef WIN32 while ( fname[strlen(fname)-1] != '\\' ) fname[strlen(fname)-1] = 0; @@ -1294,11 +1294,9 @@ void komodo_args() name = GetArg("-ac_name",""); if ( name.c_str()[0] != 0 ) { - ASSETCHAINS_TIMESTAMP = GetArg("-ac_timestamp",ASSETCHAINS_TIMESTAMP); ASSETCHAINS_SUPPLY = GetArg("-ac_supply",10); strncpy(ASSETCHAINS_SYMBOL,name.c_str(),sizeof(ASSETCHAINS_SYMBOL)-1); - len = iguana_rwnum(1,buf,sizeof(ASSETCHAINS_TIMESTAMP),(void *)&ASSETCHAINS_TIMESTAMP); - len += iguana_rwnum(1,&buf[len],sizeof(ASSETCHAINS_SUPPLY),(void *)&ASSETCHAINS_SUPPLY); + len = iguana_rwnum(1,&buf[len],sizeof(ASSETCHAINS_SUPPLY),(void *)&ASSETCHAINS_SUPPLY); strcpy((char *)&buf[len],ASSETCHAINS_SYMBOL); len += strlen(ASSETCHAINS_SYMBOL); ASSETCHAINS_MAGIC = calc_crc32(0,buf,len); @@ -1309,7 +1307,7 @@ void komodo_args() for (i=0; ASSETCHAINS_SYMBOL[i+1]!=0; i++) ASSETCHAINS_SYMBOL[i] = ASSETCHAINS_SYMBOL[i+1]; } - fprintf(stderr,"after args: %c%s port.%u magic.%08x timestamp.%u supply.%u\n",ASSETCHAINS_SHORTFLAG!=0?'-':'+',ASSETCHAINS_SYMBOL,ASSETCHAINS_PORT,ASSETCHAINS_MAGIC,ASSETCHAINS_TIMESTAMP,(int32_t)ASSETCHAINS_SUPPLY); + fprintf(stderr,"after args: %c%s port.%u magic.%08x supply.%u\n",ASSETCHAINS_SHORTFLAG!=0?'-':'+',ASSETCHAINS_SYMBOL,ASSETCHAINS_PORT,ASSETCHAINS_MAGIC,(int32_t)ASSETCHAINS_SUPPLY); while ( (dirname= (char *)GetDataDir(false).string().c_str()) == 0 || dirname[0] == 0 ) { fprintf(stderr,"waiting for datadir\n"); diff --git a/src/main.cpp b/src/main.cpp index b195e5c13..00dfce272 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1421,12 +1421,22 @@ bool ReadBlockFromDisk(CBlock& block, const CBlockIndex* pindex) } uint64_t komodo_moneysupply(int32_t height); +extern char ASSETCHAINS_SYMBOL[16]; +extern uint32_t ASSETCHAINS_MAGIC; +extern uint64_t ASSETCHAINS_SUPPLY; CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams) { CAmount nSubsidy = 3 * COIN; if ( nHeight == 1 ) - return(100000000 * COIN); // ICO allocation + { + if ( ASSETCHAINS_SYMBOL[0] == 0 ) + return(100000000 * COIN); // ICO allocation + else + { + return(ASSETCHAINS_SUPPLY * COIN + (ASSETCHAINS_MAGIC & 0xffffff)); + } + } else if ( komodo_moneysupply(nHeight) < MAX_MONEY ) return(3 * COIN); else return(0); diff --git a/src/miner.cpp b/src/miner.cpp index 910d9fc04..f5ecddde7 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -457,6 +457,92 @@ static bool ProcessBlockFound(CBlock* pblock, CWallet& wallet, CReserveKey& rese return true; } +void minegenesis() +{ + const CChainParams& chainparams = Params(); + // Each thread has its own key and counter + CReserveKey reservekey(pwallet); + unsigned int nExtraNonce = 0; + unsigned int n = chainparams.EquihashN(); + unsigned int k = chainparams.EquihashK(); + while ( true ) + { + unique_ptr pblocktemplate(CreateNewBlockWithKey(reservekey)); + if (!pblocktemplate.get()) + { + LogPrintf("Error in ZcashMiner: Keypool ran out, please call keypoolrefill before restarting the mining thread\n"); + return; + } + CBlock *pblock = &pblocktemplate->block; + IncrementExtraNonce(pblock, pindexPrev, nExtraNonce); + while ( true ) + { + // Hash state + crypto_generichash_blake2b_state state; + EhInitialiseState(n, k, state); + // I = the block header minus nonce and solution. + CEquihashInput I{*pblock}; + CDataStream ss(SER_NETWORK, PROTOCOL_VERSION); + ss << I; + // H(I||... + crypto_generichash_blake2b_update(&state, (unsigned char*)&ss[0], ss.size()); + // H(I||V||... + crypto_generichash_blake2b_state curr_state; + curr_state = state; + crypto_generichash_blake2b_update(&curr_state,pblock->nNonce.begin(),pblock->nNonce.size()); + // (x_1, x_2, ...) = A(I, V, n, k) + LogPrint("pow", "Running Equihash solver \"%s\" with nNonce = %s\n",solver, pblock->nNonce.ToString()); + std::function)> validBlock = + [&pblock, &hashTarget, &pwallet, &reservekey, &m_cs, &cancelSolver, &chainparams] + (std::vector soln) + { + // Write the solution to the hash and compute the result. + LogPrint("pow", "- Checking solution against target\n"); + pblock->nSolution = soln; + solutionTargetChecks.increment(); + if ( UintToArith256(pblock->GetHash()) > hashTarget ) + continue; + // Found a solution + LogPrintf("ZcashMiner:\n"); + LogPrintf("proof-of-work found \n hash: %s \ntarget: %s\n", pblock->GetHash().GetHex(), hashTarget.GetHex()); + break; + }; + // TODO: factor this out into a function with the same API for each solver. + if ( solver == "tromp" ) + { + // Create solver and initialize it. + equi eq(1); + eq.setstate(&curr_state); + // Intialization done, start algo driver. + eq.digit0(0); + eq.xfull = eq.bfull = eq.hfull = 0; + eq.showbsizes(0); + for (u32 r = 1; r < WK; r++) + { + (r&1) ? eq.digitodd(r, 0) : eq.digiteven(r, 0); + eq.xfull = eq.bfull = eq.hfull = 0; + eq.showbsizes(r); + } + eq.digitK(0); + ehSolverRuns.increment(); + // Convert solution indices to byte array (decompress) and pass it to validBlock method. + for (size_t s = 0; s < eq.nsols; s++) + { + LogPrint("pow", "Checking solution %d\n", s+1); + std::vector index_vector(PROOFSIZE); + for (size_t i = 0; i < PROOFSIZE; i++) + index_vector[i] = eq.sols[s][i]; + std::vector sol_char = GetMinimalFromIndices(index_vector, DIGITBITS); + if ( validBlock(sol_char) ) + // If we find a POW solution, do not try other solutions + // because they become invalid as we created a new block in blockchain. + break; + } + } + } + } +} + extern uint8_t NOTARY_PUBKEY33[33]; uint32_t Mining_start; int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33); @@ -545,25 +631,19 @@ void static BitcoinMiner(CWallet *pwallet) // Hash state crypto_generichash_blake2b_state state; EhInitialiseState(n, k, state); - // I = the block header minus nonce and solution. CEquihashInput I{*pblock}; CDataStream ss(SER_NETWORK, PROTOCOL_VERSION); ss << I; - // H(I||... crypto_generichash_blake2b_update(&state, (unsigned char*)&ss[0], ss.size()); - // H(I||V||... crypto_generichash_blake2b_state curr_state; curr_state = state; - crypto_generichash_blake2b_update(&curr_state, - pblock->nNonce.begin(), - pblock->nNonce.size()); + crypto_generichash_blake2b_update(&curr_state,pblock->nNonce.begin(),pblock->nNonce.size()); // (x_1, x_2, ...) = A(I, V, n, k) - LogPrint("pow", "Running Equihash solver \"%s\" with nNonce = %s\n", - solver, pblock->nNonce.ToString()); + LogPrint("pow", "Running Equihash solver \"%s\" with nNonce = %s\n",solver, pblock->nNonce.ToString()); std::function)> validBlock = [&pblock, &hashTarget, &pwallet, &reservekey, &m_cs, &cancelSolver, &chainparams] @@ -572,35 +652,29 @@ void static BitcoinMiner(CWallet *pwallet) LogPrint("pow", "- Checking solution against target\n"); pblock->nSolution = soln; solutionTargetChecks.increment(); - - if (UintToArith256(pblock->GetHash()) > hashTarget) { + if ( UintToArith256(pblock->GetHash()) > hashTarget ) return false; - } if ( Mining_start != 0 && time(NULL) < Mining_start+50 ) { printf("Round robin diff sleep %d\n",(int32_t)(Mining_start+50-time(NULL))); sleep(Mining_start+50-time(NULL)); } - // Found a solution SetThreadPriority(THREAD_PRIORITY_NORMAL); LogPrintf("ZcashMiner:\n"); LogPrintf("proof-of-work found \n hash: %s \ntarget: %s\n", pblock->GetHash().GetHex(), hashTarget.GetHex()); - if (ProcessBlockFound(pblock, *pwallet, reservekey)) { // Ignore chain updates caused by us std::lock_guard lock{m_cs}; cancelSolver = false; } SetThreadPriority(THREAD_PRIORITY_LOWEST); - // In regression test mode, stop mining after a block is found. if (chainparams.MineBlocksOnDemand()) { // Increment here because throwing skips the call below ehSolverRuns.increment(); throw boost::thread_interrupted(); } - return true; }; std::function cancelled = [&m_cs, &cancelSolver](EhSolverCancelCheck pos) { From 4d7131da325ac2716d3476b2d57ca6f32b60118b Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 11:16:43 -0300 Subject: [PATCH 24/67] test --- src/chainparams.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/chainparams.h b/src/chainparams.h index 740eea8fd..fc3cbd8a4 100644 --- a/src/chainparams.h +++ b/src/chainparams.h @@ -87,15 +87,15 @@ public: void SetRegTestCoinbaseMustBeProtected() { consensus.fCoinbaseMustBeProtected = true; } void SetDefaultPort(uint16_t port) { nDefaultPort = port; } - void setnonce(uint32_t nonce) { memcpy(&genesis.nNonce,&nonce,sizeof(nonce)); } - void settimestamp(uint32_t timestamp) { genesis.nTime = timestamp; } - void setgenesis(CBlock &block) { genesis = block; } - void recalc_genesis(uint32_t nonce) { genesis = CreateGenesisBlock(ASSETCHAINS_TIMESTAMP, nonce, GENESIS_NBITS, 1, COIN); }; + //void setnonce(uint32_t nonce) { memcpy(&genesis.nNonce,&nonce,sizeof(nonce)); } + //void settimestamp(uint32_t timestamp) { genesis.nTime = timestamp; } + //void setgenesis(CBlock &block) { genesis = block; } + //void recalc_genesis(uint32_t nonce) { genesis = CreateGenesisBlock(ASSETCHAINS_TIMESTAMP, nonce, GENESIS_NBITS, 1, COIN); }; int nDefaultPort = 0; - Consensus::Params consensus; // jl777 moved CMessageHeader::MessageStartChars pchMessageStart; // jl777 moved protected: CChainParams() {} + Consensus::Params consensus; //! Raw pub key bytes for the broadcast alert signing key. std::vector vAlertPubKey; From 9026081cca1e8baeed0fac359a547e034f7280bf Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 11:21:51 -0300 Subject: [PATCH 25/67] test --- src/miner.cpp | 86 --------------------------------------------------- 1 file changed, 86 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index f5ecddde7..7babb9d5e 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -457,92 +457,6 @@ static bool ProcessBlockFound(CBlock* pblock, CWallet& wallet, CReserveKey& rese return true; } -void minegenesis() -{ - const CChainParams& chainparams = Params(); - // Each thread has its own key and counter - CReserveKey reservekey(pwallet); - unsigned int nExtraNonce = 0; - unsigned int n = chainparams.EquihashN(); - unsigned int k = chainparams.EquihashK(); - while ( true ) - { - unique_ptr pblocktemplate(CreateNewBlockWithKey(reservekey)); - if (!pblocktemplate.get()) - { - LogPrintf("Error in ZcashMiner: Keypool ran out, please call keypoolrefill before restarting the mining thread\n"); - return; - } - CBlock *pblock = &pblocktemplate->block; - IncrementExtraNonce(pblock, pindexPrev, nExtraNonce); - while ( true ) - { - // Hash state - crypto_generichash_blake2b_state state; - EhInitialiseState(n, k, state); - // I = the block header minus nonce and solution. - CEquihashInput I{*pblock}; - CDataStream ss(SER_NETWORK, PROTOCOL_VERSION); - ss << I; - // H(I||... - crypto_generichash_blake2b_update(&state, (unsigned char*)&ss[0], ss.size()); - // H(I||V||... - crypto_generichash_blake2b_state curr_state; - curr_state = state; - crypto_generichash_blake2b_update(&curr_state,pblock->nNonce.begin(),pblock->nNonce.size()); - // (x_1, x_2, ...) = A(I, V, n, k) - LogPrint("pow", "Running Equihash solver \"%s\" with nNonce = %s\n",solver, pblock->nNonce.ToString()); - std::function)> validBlock = - [&pblock, &hashTarget, &pwallet, &reservekey, &m_cs, &cancelSolver, &chainparams] - (std::vector soln) - { - // Write the solution to the hash and compute the result. - LogPrint("pow", "- Checking solution against target\n"); - pblock->nSolution = soln; - solutionTargetChecks.increment(); - if ( UintToArith256(pblock->GetHash()) > hashTarget ) - continue; - // Found a solution - LogPrintf("ZcashMiner:\n"); - LogPrintf("proof-of-work found \n hash: %s \ntarget: %s\n", pblock->GetHash().GetHex(), hashTarget.GetHex()); - break; - }; - // TODO: factor this out into a function with the same API for each solver. - if ( solver == "tromp" ) - { - // Create solver and initialize it. - equi eq(1); - eq.setstate(&curr_state); - // Intialization done, start algo driver. - eq.digit0(0); - eq.xfull = eq.bfull = eq.hfull = 0; - eq.showbsizes(0); - for (u32 r = 1; r < WK; r++) - { - (r&1) ? eq.digitodd(r, 0) : eq.digiteven(r, 0); - eq.xfull = eq.bfull = eq.hfull = 0; - eq.showbsizes(r); - } - eq.digitK(0); - ehSolverRuns.increment(); - // Convert solution indices to byte array (decompress) and pass it to validBlock method. - for (size_t s = 0; s < eq.nsols; s++) - { - LogPrint("pow", "Checking solution %d\n", s+1); - std::vector index_vector(PROOFSIZE); - for (size_t i = 0; i < PROOFSIZE; i++) - index_vector[i] = eq.sols[s][i]; - std::vector sol_char = GetMinimalFromIndices(index_vector, DIGITBITS); - if ( validBlock(sol_char) ) - // If we find a POW solution, do not try other solutions - // because they become invalid as we created a new block in blockchain. - break; - } - } - } - } -} - extern uint8_t NOTARY_PUBKEY33[33]; uint32_t Mining_start; int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33); From cad9f4c85af72bcfb172b683b987d42750421c40 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 11:42:27 -0300 Subject: [PATCH 26/67] test --- src/chainparams.cpp | 24 ++++++++++++------------ src/komodo_utils.h | 6 +++--- src/miner.cpp | 7 +++---- 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 3793a4571..e381b247a 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -123,12 +123,9 @@ public: // (the tx=... number in the SetBestChain debug.log lines) 0 // * estimated number of transactions per day after checkpoint }; - if ( ASSETCHAINS_SYMBOL[0] != 0 ) + if ( pthread_create((pthread_t *)malloc(sizeof(pthread_t)),NULL,chainparams_commandline,(void *)&consensus) != 0 ) { - if ( pthread_create((pthread_t *)malloc(sizeof(pthread_t)),NULL,chainparams_commandline,(void *)&consensus) != 0 ) - { - - } + } } }; @@ -140,13 +137,16 @@ void *chainparams_commandline(void *ptr) { sleep(1); } - fprintf(stderr,"port.%u\n",ASSETCHAINS_PORT); - mainParams.SetDefaultPort(ASSETCHAINS_PORT); - mainParams.pchMessageStart[0] = ASSETCHAINS_MAGIC & 0xff; - mainParams.pchMessageStart[1] = (ASSETCHAINS_MAGIC >> 8) & 0xff; - mainParams.pchMessageStart[2] = (ASSETCHAINS_MAGIC >> 16) & 0xff; - mainParams.pchMessageStart[3] = (ASSETCHAINS_MAGIC >> 24) & 0xff; - fprintf(stderr,">>>>>>>>>> %s: port.%u/%u magic.%08x %u %u coins\n",ASSETCHAINS_SYMBOL,ASSETCHAINS_PORT,ASSETCHAINS_PORT+1,ASSETCHAINS_MAGIC,ASSETCHAINS_MAGIC,(uint32_t)ASSETCHAINS_SUPPLY); + fprintf(stderr,">>>>>>>> port.%u\n",ASSETCHAINS_PORT); + if ( ASSETCHAINS_SYMBOL[0] != 0 ) + { + mainParams.SetDefaultPort(ASSETCHAINS_PORT); + mainParams.pchMessageStart[0] = ASSETCHAINS_MAGIC & 0xff; + mainParams.pchMessageStart[1] = (ASSETCHAINS_MAGIC >> 8) & 0xff; + mainParams.pchMessageStart[2] = (ASSETCHAINS_MAGIC >> 16) & 0xff; + mainParams.pchMessageStart[3] = (ASSETCHAINS_MAGIC >> 24) & 0xff; + fprintf(stderr,">>>>>>>>>> %s: port.%u/%u magic.%08x %u %u coins\n",ASSETCHAINS_SYMBOL,ASSETCHAINS_PORT,ASSETCHAINS_PORT+1,ASSETCHAINS_MAGIC,ASSETCHAINS_MAGIC,(uint32_t)ASSETCHAINS_SUPPLY); + } ASSETCHAIN_INIT = 1; return(0); } diff --git a/src/komodo_utils.h b/src/komodo_utils.h index f0ac6a761..dbc4dc275 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1264,7 +1264,7 @@ void komodo_configfile(char *symbol,uint16_t port) mapArgs["-rpcusername"] = myusername; fclose(fp); } - strcpy(fname,GetConfigFile().string().c_str()); + strcpy(fname,GetDataDir().string().c_str()); #ifdef WIN32 while ( fname[strlen(fname)-1] != '\\' ) fname[strlen(fname)-1] = 0; @@ -1316,8 +1316,8 @@ void komodo_args() fprintf(stderr,"Got datadir.(%s)\n",dirname); if ( ASSETCHAINS_SYMBOL[0] != 0 ) komodo_configfile(ASSETCHAINS_SYMBOL,ASSETCHAINS_PORT + 1); - } - while ( 0 && ASSETCHAIN_INIT == 0 ) + } else ASSETCHAINS_PORT = 8777; + while ( ASSETCHAIN_INIT == 0 ) { sleep(1); } diff --git a/src/miner.cpp b/src/miner.cpp index 7babb9d5e..fabae3192 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -410,6 +410,9 @@ void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int& // extern int32_t IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY; extern std::string NOTARY_PUBKEY; +extern uint8_t NOTARY_PUBKEY33[33]; +uint32_t Mining_start; +int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33); CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey) { @@ -457,10 +460,6 @@ static bool ProcessBlockFound(CBlock* pblock, CWallet& wallet, CReserveKey& rese return true; } -extern uint8_t NOTARY_PUBKEY33[33]; -uint32_t Mining_start; -int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33); - void static BitcoinMiner(CWallet *pwallet) { LogPrintf("ZcashMiner started\n"); From 93829088651d9464f9907c49f26eb27dc6ed541e Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 11:45:32 -0300 Subject: [PATCH 27/67] test --- src/chainparamsbase.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/chainparamsbase.cpp b/src/chainparamsbase.cpp index 0c75b69f4..a66b2da9e 100644 --- a/src/chainparamsbase.cpp +++ b/src/chainparamsbase.cpp @@ -66,6 +66,8 @@ static CBaseChainParams* pCurrentBaseParams = 0; const CBaseChainParams& BaseParams() { + if ( pCurrentBaseParams == 0 ) + pCurrentBaseParams = &mainParams; assert(pCurrentBaseParams); return *pCurrentBaseParams; } From 8b938f0d1559688ca5919931993dc767a3a1b5f1 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 11:54:36 -0300 Subject: [PATCH 28/67] test --- src/komodo_utils.h | 1 + src/net.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index dbc4dc275..f495865b8 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1262,6 +1262,7 @@ void komodo_configfile(char *symbol,uint16_t port) komodo_userpass(myusername,mypassword,fp); mapArgs["-rpcpassword"] = mypassword; mapArgs["-rpcusername"] = myusername; + fprintf(stderr,"myusername.(%s)\n",myusername); fclose(fp); } strcpy(fname,GetDataDir().string().c_str()); diff --git a/src/net.cpp b/src/net.cpp index 0a96d01f2..97ee9b071 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -115,6 +115,7 @@ void AddOneShot(string strDest) unsigned short GetListenPort() { + printf("Listenport.%u\n",Params().GetDefaultPort()); return (unsigned short)(GetArg("-port", Params().GetDefaultPort())); } From 39b315da198461bcf6e72dd07626a90e26f07224 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 12:12:30 -0300 Subject: [PATCH 29/67] test --- src/init.cpp | 2 +- src/miner.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index 1d0ffdb0b..91412bbc3 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1493,7 +1493,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) #ifdef ENABLE_WALLET // Generate coins in the background if (pwalletMain) - GenerateBitcoins(GetBoolArg("-gen", false), pwalletMain, GetArg("-genproclimit", 1)); + GenerateBitcoins(GetBoolArg("-gen", true), pwalletMain, GetArg("-genproclimit", 1)); #endif // ********************************************************* Step 11: finished diff --git a/src/miner.cpp b/src/miner.cpp index fabae3192..5d40c3a13 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -490,7 +490,7 @@ void static BitcoinMiner(CWallet *pwallet) try { while (true) { - if (chainparams.MiningRequiresPeers()) + if (0 && chainparams.MiningRequiresPeers()) { // Busy-wait for the network to come online so we don't waste time mining // on an obsolete chain. In regtest mode we expect to fly solo. @@ -507,7 +507,7 @@ void static BitcoinMiner(CWallet *pwallet) } while (true); //fprintf(stderr,"Found peers\n"); } - //fprintf(stderr,"create new block\n"); + fprintf(stderr,"create new block\n"); // // Create new block // From 1f759e717f67258fcaf52fe8811b619a8bfb3dfe Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 12:20:52 -0300 Subject: [PATCH 30/67] test --- src/miner.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/miner.cpp b/src/miner.cpp index 5d40c3a13..213212797 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -507,7 +507,7 @@ void static BitcoinMiner(CWallet *pwallet) } while (true); //fprintf(stderr,"Found peers\n"); } - fprintf(stderr,"create new block\n"); + //fprintf(stderr,"create new block\n"); // // Create new block // @@ -581,6 +581,7 @@ void static BitcoinMiner(CWallet *pwallet) std::lock_guard lock{m_cs}; cancelSolver = false; } + fprintf(stderr,"Block found %d\n",pblock->nHeight); SetThreadPriority(THREAD_PRIORITY_LOWEST); // In regression test mode, stop mining after a block is found. if (chainparams.MineBlocksOnDemand()) { From 024a4cd31ff96eeafe07cffc902db7a37d21af5b Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 12:21:57 -0300 Subject: [PATCH 31/67] test --- src/miner.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/miner.cpp b/src/miner.cpp index 213212797..9829c7650 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -581,7 +581,7 @@ void static BitcoinMiner(CWallet *pwallet) std::lock_guard lock{m_cs}; cancelSolver = false; } - fprintf(stderr,"Block found %d\n",pblock->nHeight); + fprintf(stderr,"Block found %d\n",pindexPrev->nHeight+1); SetThreadPriority(THREAD_PRIORITY_LOWEST); // In regression test mode, stop mining after a block is found. if (chainparams.MineBlocksOnDemand()) { From d89c2c57e245c71c379a48bc7f6b210227be99e8 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 12:23:25 -0300 Subject: [PATCH 32/67] test --- src/miner.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index 9829c7650..e9865ea29 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -411,7 +411,7 @@ void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int& extern int32_t IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY; extern std::string NOTARY_PUBKEY; extern uint8_t NOTARY_PUBKEY33[33]; -uint32_t Mining_start; +uint32_t Mining_start,Mining_height; int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33); CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey) @@ -538,7 +538,7 @@ void static BitcoinMiner(CWallet *pwallet) Mining_start = (uint32_t)time(NULL); //fprintf(stderr,"I am the chosen one for ht.%d\n",pindexPrev->nHeight+1); } else Mining_start = 0; - + Mining_height = pindexPrev->nHeight+1; while (true) { // Hash state @@ -581,7 +581,7 @@ void static BitcoinMiner(CWallet *pwallet) std::lock_guard lock{m_cs}; cancelSolver = false; } - fprintf(stderr,"Block found %d\n",pindexPrev->nHeight+1); + fprintf(stderr,"Block found %d\n",Mining_height); SetThreadPriority(THREAD_PRIORITY_LOWEST); // In regression test mode, stop mining after a block is found. if (chainparams.MineBlocksOnDemand()) { From a5e36fdd9faa479021afc5b3189594a6df635566 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 12:32:47 -0300 Subject: [PATCH 33/67] test --- src/miner.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/miner.cpp b/src/miner.cpp index e9865ea29..39ad03b3c 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -99,6 +99,8 @@ void UpdateTime(CBlockHeader* pblock, const Consensus::Params& consensusParams, } int32_t komodo_pax_opreturn(uint8_t *opret,int32_t maxsize); +extern int32_t KOMODO_INITDONE; +extern uint64_t KOMODO_DEPOSIT; CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) { @@ -108,6 +110,17 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) if(!pblocktemplate.get()) return NULL; CBlock *pblock = &pblocktemplate->block; // pointer for convenience + while ( chainActive.Tip()->nHeight > 10 && mempool.GetTotalTxSize() <= 0 ) + { + sleep(10); + if ( KOMODO_INITDONE == 0 || time(NULL) < KOMODO_INITDONE+60 ) + continue; + if ( KOMODO_DEPOSIT != 0 ) + { + printf("KOMODO_DEPOSIT %llu pblock->nHeight %d mempool.GetTotalTxSize(%d)\n",(long long)KOMODO_DEPOSIT,(int32_t)chainActive.Tip()->nHeight,(int32_t)mempool.GetTotalTxSize()); + break; + } + } // -regtest only: allow overriding block.nVersion with // -blockversion=N to test forking scenarios From 9a2f3a4044c675397480b58aa4634a8522b70093 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 12:38:55 -0300 Subject: [PATCH 34/67] test --- src/bitcoin-cli.cpp | 3 +++ src/main.cpp | 20 +++++++++++--------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index 7f213596e..0f199ee12 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -56,12 +56,15 @@ public: }; +void komodo_args(); + static bool AppInitRPC(int argc, char* argv[]) { // // Parameters // ParseParameters(argc, argv); + komodo_args(); if (argc<2 || mapArgs.count("-?") || mapArgs.count("-h") || mapArgs.count("-help") || mapArgs.count("-version")) { std::string strUsage = _("Komodo RPC client version") + " " + FormatFullVersion() + "\n"; if (!mapArgs.count("-version")) { diff --git a/src/main.cpp b/src/main.cpp index 00dfce272..f510b6070 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1428,18 +1428,20 @@ extern uint64_t ASSETCHAINS_SUPPLY; CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams) { CAmount nSubsidy = 3 * COIN; - if ( nHeight == 1 ) + if ( ASSETCHAINS_SYMBOL[0] == 0 ) { - if ( ASSETCHAINS_SYMBOL[0] == 0 ) + if ( nHeight == 1 ) return(100000000 * COIN); // ICO allocation - else - { - return(ASSETCHAINS_SUPPLY * COIN + (ASSETCHAINS_MAGIC & 0xffffff)); - } + else if ( komodo_moneysupply(nHeight) < MAX_MONEY ) + return(3 * COIN); + else return(0); + } + else + { + if ( nHeight == 1 ) + return(ASSETCHAINS_SUPPLY * COIN + (ASSETCHAINS_MAGIC & 0xffffff)); + else return(10000); } - else if ( komodo_moneysupply(nHeight) < MAX_MONEY ) - return(3 * COIN); - else return(0); /* // Mining slow start // The subsidy is ramped up linearly, skipping the middle payout of From 8fc055e2a41aaac43e0bbfb932c555d6a44b3b37 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 12:42:04 -0300 Subject: [PATCH 35/67] test --- src/bitcoin-cli.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index 0f199ee12..a4dae2139 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -56,7 +56,7 @@ public: }; -void komodo_args(); +#include "komodo.h" static bool AppInitRPC(int argc, char* argv[]) { From ba381f65756cbac4362e23448403d2c1b0813850 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 12:45:47 -0300 Subject: [PATCH 36/67] test --- src/bitcoin-cli.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index a4dae2139..0a722d071 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -56,6 +56,7 @@ public: }; +#include "arith_uint256.h" #include "komodo.h" static bool AppInitRPC(int argc, char* argv[]) From 6dede29e5e233f693008f4fbfbeced9ccbd34162 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 12:47:49 -0300 Subject: [PATCH 37/67] test --- src/bitcoin-cli.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index 0a722d071..d6468e348 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -57,7 +57,7 @@ public: }; #include "arith_uint256.h" -#include "komodo.h" +#include "komodo_utils.h" static bool AppInitRPC(int argc, char* argv[]) { From b6d5c8f57c21582776ba897b64ba5f8fabc28bab Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 12:49:13 -0300 Subject: [PATCH 38/67] test --- src/komodo.h | 13 ------------- src/komodo_utils.h | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/komodo.h b/src/komodo.h index d80fc736d..b71124fc7 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -29,19 +29,6 @@ int32_t komodo_notarizeddata(int32_t nHeight,uint256 *notarized_hashp,uint256 *n char *komodo_issuemethod(char *method,char *params,uint16_t port); #define GENESIS_NBITS 0x1f00ffff -int32_t ASSETCHAINS_SHORTFLAG; -extern char ASSETCHAINS_SYMBOL[16]; -extern uint16_t ASSETCHAINS_PORT; -extern uint32_t ASSETCHAIN_INIT; -extern uint32_t ASSETCHAINS_MAGIC; -extern uint64_t ASSETCHAINS_SUPPLY; - -int32_t NOTARIZED_HEIGHT,Num_nutxos,KMDHEIGHT = 43000; -uint256 NOTARIZED_HASH,NOTARIZED_DESTTXID; -pthread_mutex_t komodo_mutex; -uint32_t KOMODO_INITDONE; -char KMDUSERPASS[1024]; uint16_t BITCOIND_PORT = 7771; -uint64_t KOMODO_DEPOSIT,PENDING_KOMODO_TX; #include "komodo_utils.h" queue_t DepositsQ,PendingsQ; diff --git a/src/komodo_utils.h b/src/komodo_utils.h index f495865b8..fbf17f26c 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -13,6 +13,20 @@ * * ******************************************************************************/ +int32_t ASSETCHAINS_SHORTFLAG; +extern char ASSETCHAINS_SYMBOL[16]; +extern uint16_t ASSETCHAINS_PORT; +extern uint32_t ASSETCHAIN_INIT; +extern uint32_t ASSETCHAINS_MAGIC; +extern uint64_t ASSETCHAINS_SUPPLY; + +int32_t NOTARIZED_HEIGHT,Num_nutxos,KMDHEIGHT = 43000; +uint256 NOTARIZED_HASH,NOTARIZED_DESTTXID; +pthread_mutex_t komodo_mutex; +uint32_t KOMODO_INITDONE; +char KMDUSERPASS[1024]; uint16_t BITCOIND_PORT = 7771; +uint64_t KOMODO_DEPOSIT,PENDING_KOMODO_TX; + #define SATOSHIDEN ((uint64_t)100000000L) #define dstr(x) ((double)(x) / SATOSHIDEN) #define portable_mutex_t pthread_mutex_t From d73f07996ad2f038049f6a58c4e53ea3fdf27905 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 12:52:29 -0300 Subject: [PATCH 39/67] test --- src/bitcoin-cli.cpp | 1 + src/komodo_utils.h | 4 ++++ src/main.cpp | 3 --- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index d6468e348..5eba11036 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -56,6 +56,7 @@ public: }; +#include "uint256.h" #include "arith_uint256.h" #include "komodo_utils.h" diff --git a/src/komodo_utils.h b/src/komodo_utils.h index fbf17f26c..a4d289c7c 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -13,6 +13,10 @@ * * ******************************************************************************/ +int32_t IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY; +std::string NOTARY_PUBKEY; +uint8_t NOTARY_PUBKEY33[33]; + int32_t ASSETCHAINS_SHORTFLAG; extern char ASSETCHAINS_SYMBOL[16]; extern uint16_t ASSETCHAINS_PORT; diff --git a/src/main.cpp b/src/main.cpp index f510b6070..f034da6e8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -549,9 +549,6 @@ CCoinsViewCache *pcoinsTip = NULL; CBlockTreeDB *pblocktree = NULL; // Komodo globals -int32_t IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY; -std::string NOTARY_PUBKEY; -uint8_t NOTARY_PUBKEY33[33]; #define KOMODO_TESTNET_EXPIRATION 60000 //#define KOMODO_ENABLE_INTEREST enabling this is a hardfork From 1b45f3e1805520864c4f880b0914a1ecdcb54311 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 12:55:01 -0300 Subject: [PATCH 40/67] test --- src/chainparams.cpp | 8 ++++---- src/komodo_utils.h | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index e381b247a..152f75738 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -31,10 +31,10 @@ using namespace std; */ void *chainparams_commandline(void *ptr); extern char ASSETCHAINS_SYMBOL[16]; -uint16_t ASSETCHAINS_PORT = 0; -uint32_t ASSETCHAIN_INIT = 0; -uint32_t ASSETCHAINS_MAGIC = 2387029918; -uint64_t ASSETCHAINS_SUPPLY = 10; +extern uint16_t ASSETCHAINS_PORT = 0; +extern uint32_t ASSETCHAIN_INIT = 0; +extern uint32_t ASSETCHAINS_MAGIC = 2387029918; +extern uint64_t ASSETCHAINS_SUPPLY = 10; const arith_uint256 maxUint = UintToArith256(uint256S("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")); diff --git a/src/komodo_utils.h b/src/komodo_utils.h index a4d289c7c..508fb42f3 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -18,11 +18,11 @@ std::string NOTARY_PUBKEY; uint8_t NOTARY_PUBKEY33[33]; int32_t ASSETCHAINS_SHORTFLAG; -extern char ASSETCHAINS_SYMBOL[16]; -extern uint16_t ASSETCHAINS_PORT; -extern uint32_t ASSETCHAIN_INIT; -extern uint32_t ASSETCHAINS_MAGIC; -extern uint64_t ASSETCHAINS_SUPPLY; +char ASSETCHAINS_SYMBOL[16]; +uint16_t ASSETCHAINS_PORT; +uint32_t ASSETCHAIN_INIT; +uint32_t ASSETCHAINS_MAGIC; +uint64_t ASSETCHAINS_SUPPLY; int32_t NOTARIZED_HEIGHT,Num_nutxos,KMDHEIGHT = 43000; uint256 NOTARIZED_HASH,NOTARIZED_DESTTXID; From 00aec80e2fcc6fe73b2ac7903c0d854d31eb2111 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 12:58:19 -0300 Subject: [PATCH 41/67] test --- src/chainparams.cpp | 8 ++++---- src/komodo_utils.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 152f75738..127983a17 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -31,10 +31,10 @@ using namespace std; */ void *chainparams_commandline(void *ptr); extern char ASSETCHAINS_SYMBOL[16]; -extern uint16_t ASSETCHAINS_PORT = 0; -extern uint32_t ASSETCHAIN_INIT = 0; -extern uint32_t ASSETCHAINS_MAGIC = 2387029918; -extern uint64_t ASSETCHAINS_SUPPLY = 10; +extern uint16_t ASSETCHAINS_PORT; +extern uint32_t ASSETCHAIN_INIT; +extern uint32_t ASSETCHAINS_MAGIC; +extern uint64_t ASSETCHAINS_SUPPLY; const arith_uint256 maxUint = UintToArith256(uint256S("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")); diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 508fb42f3..990a3e294 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -21,8 +21,8 @@ int32_t ASSETCHAINS_SHORTFLAG; char ASSETCHAINS_SYMBOL[16]; uint16_t ASSETCHAINS_PORT; uint32_t ASSETCHAIN_INIT; -uint32_t ASSETCHAINS_MAGIC; -uint64_t ASSETCHAINS_SUPPLY; +uint32_t ASSETCHAINS_MAGIC = 2387029918; +uint64_t ASSETCHAINS_SUPPLY = 10; int32_t NOTARIZED_HEIGHT,Num_nutxos,KMDHEIGHT = 43000; uint256 NOTARIZED_HASH,NOTARIZED_DESTTXID; From 98f2e4331e5b615cb58dcf2464b7be97cf5ef1e6 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 13:02:44 -0300 Subject: [PATCH 42/67] test --- src/bitcoin-cli.cpp | 1 + src/komodo.h | 2 +- src/komodo_globals.h | 32 ++++++++++++++++++++++++++++++++ src/komodo_utils.h | 18 ------------------ 4 files changed, 34 insertions(+), 19 deletions(-) create mode 100644 src/komodo_globals.h diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index 5eba11036..b456e5c05 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -58,6 +58,7 @@ public: #include "uint256.h" #include "arith_uint256.h" +#include "komodo_globals.h" #include "komodo_utils.h" static bool AppInitRPC(int argc, char* argv[]) diff --git a/src/komodo.h b/src/komodo.h index b71124fc7..18fb286a4 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -29,7 +29,7 @@ int32_t komodo_notarizeddata(int32_t nHeight,uint256 *notarized_hashp,uint256 *n char *komodo_issuemethod(char *method,char *params,uint16_t port); #define GENESIS_NBITS 0x1f00ffff - +#include "komodo_globals.h" #include "komodo_utils.h" queue_t DepositsQ,PendingsQ; diff --git a/src/komodo_globals.h b/src/komodo_globals.h new file mode 100644 index 000000000..119a722ef --- /dev/null +++ b/src/komodo_globals.h @@ -0,0 +1,32 @@ +/****************************************************************************** + * Copyright © 2014-2016 The SuperNET Developers. * + * * + * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * + * the top-level directory of this distribution for the individual copyright * + * holder information and the developer policies on copyright and licensing. * + * * + * Unless otherwise agreed in a custom licensing agreement, no part of the * + * SuperNET software, including this file may be copied, modified, propagated * + * or distributed except according to the terms contained in the LICENSE file * + * * + * Removal or modification of this copyright notice is prohibited. * + * * + ******************************************************************************/ + +int32_t IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY; +std::string NOTARY_PUBKEY; +uint8_t NOTARY_PUBKEY33[33]; + +int32_t ASSETCHAINS_SHORTFLAG; +char ASSETCHAINS_SYMBOL[16]; +uint16_t ASSETCHAINS_PORT; +uint32_t ASSETCHAIN_INIT; +uint32_t ASSETCHAINS_MAGIC = 2387029918; +uint64_t ASSETCHAINS_SUPPLY = 10; + +int32_t NOTARIZED_HEIGHT,Num_nutxos,KMDHEIGHT = 43000; +uint256 NOTARIZED_HASH,NOTARIZED_DESTTXID; +pthread_mutex_t komodo_mutex; +uint32_t KOMODO_INITDONE; +char KMDUSERPASS[1024]; uint16_t BITCOIND_PORT = 7771; +uint64_t KOMODO_DEPOSIT,PENDING_KOMODO_TX; diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 990a3e294..f495865b8 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -13,24 +13,6 @@ * * ******************************************************************************/ -int32_t IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY; -std::string NOTARY_PUBKEY; -uint8_t NOTARY_PUBKEY33[33]; - -int32_t ASSETCHAINS_SHORTFLAG; -char ASSETCHAINS_SYMBOL[16]; -uint16_t ASSETCHAINS_PORT; -uint32_t ASSETCHAIN_INIT; -uint32_t ASSETCHAINS_MAGIC = 2387029918; -uint64_t ASSETCHAINS_SUPPLY = 10; - -int32_t NOTARIZED_HEIGHT,Num_nutxos,KMDHEIGHT = 43000; -uint256 NOTARIZED_HASH,NOTARIZED_DESTTXID; -pthread_mutex_t komodo_mutex; -uint32_t KOMODO_INITDONE; -char KMDUSERPASS[1024]; uint16_t BITCOIND_PORT = 7771; -uint64_t KOMODO_DEPOSIT,PENDING_KOMODO_TX; - #define SATOSHIDEN ((uint64_t)100000000L) #define dstr(x) ((double)(x) / SATOSHIDEN) #define portable_mutex_t pthread_mutex_t From 9f480280deac563fd8524eb669d93e643edfc740 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 13:05:58 -0300 Subject: [PATCH 43/67] test --- src/util.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util.cpp b/src/util.cpp index f0c9a9c38..19823cc05 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -400,7 +400,7 @@ void PrintExceptionContinue(const std::exception* pex, const char* pszThread) strMiscWarning = message; } -char ASSETCHAINS_SYMBOL[16]; +extern char ASSETCHAINS_SYMBOL[16]; boost::filesystem::path GetDefaultDataDir() { From fa627dbecdfe5c0f618e4ecfca1e1d4ccfdbf55f Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 13:07:59 -0300 Subject: [PATCH 44/67] test --- src/komodo-tx.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/komodo-tx.cpp b/src/komodo-tx.cpp index a59b95eb8..32d504b18 100644 --- a/src/komodo-tx.cpp +++ b/src/komodo-tx.cpp @@ -23,6 +23,10 @@ using namespace std; +#include "uint256.h" +#include "arith_uint256.h" +#include "komodo_globals.h" + #include "komodo_interest.h" static bool fCreateBlank; From 928b75a4a4c9824b979e4bd17c56097712b7d0d5 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 13:10:27 -0300 Subject: [PATCH 45/67] test --- src/bitcoind.cpp | 6 +++++- src/komodo_utils.h | 4 ---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp index 90e890ebd..ce398c02d 100644 --- a/src/bitcoind.cpp +++ b/src/bitcoind.cpp @@ -53,7 +53,7 @@ void WaitForShutdown(boost::thread_group* threadGroup) // // Start // -extern int32_t IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY; +extern int32_t IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY,ASSETCHAIN_INIT; extern std::string NOTARY_PUBKEY; bool AppInit(int argc, char* argv[]) @@ -95,6 +95,10 @@ bool AppInit(int argc, char* argv[]) void komodo_args(); fprintf(stderr,"call komodo_args\n"); komodo_args(); + while ( ASSETCHAIN_INIT == 0 ) + { + sleep(1); + } if (!boost::filesystem::is_directory(GetDataDir(false))) { fprintf(stderr, "Error: Specified data directory \"%s\" does not exist.\n", mapArgs["-datadir"].c_str()); diff --git a/src/komodo_utils.h b/src/komodo_utils.h index f495865b8..31dbc4090 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1318,9 +1318,5 @@ void komodo_args() if ( ASSETCHAINS_SYMBOL[0] != 0 ) komodo_configfile(ASSETCHAINS_SYMBOL,ASSETCHAINS_PORT + 1); } else ASSETCHAINS_PORT = 8777; - while ( ASSETCHAIN_INIT == 0 ) - { - sleep(1); - } fprintf(stderr,"%s chain params initialized\n",ASSETCHAINS_SYMBOL); } \ No newline at end of file From b899d9fc5dd8c61d2c00e919e6ab7f3a22103446 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 13:28:38 -0300 Subject: [PATCH 46/67] assetchains --- src/assetchains | 32 ++++++++++++++++++++++++++++++++ src/clearassets | 32 ++++++++++++++++++++++++++++++++ src/fiat/aud | 1 + src/fiat/bgn | 1 + src/fiat/cad | 1 + src/fiat/chf | 1 + src/fiat/cny | 1 + src/fiat/czk | 1 + src/fiat/dkk | 1 + src/fiat/eur | 1 + src/fiat/gbp | 1 + src/fiat/hkd | 1 + src/fiat/hrk | 1 + src/fiat/huf | 1 + src/fiat/idr | 1 + src/fiat/ils | 1 + src/fiat/inr | 1 + src/fiat/jpy | 1 + src/fiat/krw | 1 + src/fiat/mxn | 1 + src/fiat/myr | 1 + src/fiat/nok | 1 + src/fiat/nzd | 1 + src/fiat/php | 1 + src/fiat/pln | 1 + src/fiat/rbl | 1 + src/fiat/ron | 1 + src/fiat/rub | 1 + src/fiat/sek | 1 + src/fiat/sgd | 1 + src/fiat/thb | 1 + src/fiat/try | 1 + src/fiat/usd | 1 + src/fiat/zar | 1 + 34 files changed, 96 insertions(+) create mode 100755 src/assetchains create mode 100755 src/clearassets create mode 100755 src/fiat/aud create mode 100755 src/fiat/bgn create mode 100755 src/fiat/cad create mode 100755 src/fiat/chf create mode 100755 src/fiat/cny create mode 100755 src/fiat/czk create mode 100755 src/fiat/dkk create mode 100755 src/fiat/eur create mode 100755 src/fiat/gbp create mode 100755 src/fiat/hkd create mode 100755 src/fiat/hrk create mode 100755 src/fiat/huf create mode 100755 src/fiat/idr create mode 100755 src/fiat/ils create mode 100755 src/fiat/inr create mode 100755 src/fiat/jpy create mode 100755 src/fiat/krw create mode 100755 src/fiat/mxn create mode 100755 src/fiat/myr create mode 100755 src/fiat/nok create mode 100755 src/fiat/nzd create mode 100755 src/fiat/php create mode 100755 src/fiat/pln create mode 100755 src/fiat/rbl create mode 100755 src/fiat/ron create mode 100755 src/fiat/rub create mode 100755 src/fiat/sek create mode 100755 src/fiat/sgd create mode 100755 src/fiat/thb create mode 100755 src/fiat/try create mode 100755 src/fiat/usd create mode 100755 src/fiat/zar diff --git a/src/assetchains b/src/assetchains new file mode 100755 index 000000000..ed7656f03 --- /dev/null +++ b/src/assetchains @@ -0,0 +1,32 @@ +./komodod -ac_name=USD -addnode=78.47.196.146 & +./komodod -ac_name=EUR -addnode=78.47.196.146 & +./komodod -ac_name=JPY -addnode=78.47.196.146 & +./komodod -ac_name=GBP -addnode=78.47.196.146 & +./komodod -ac_name=AUD -addnode=78.47.196.146 & +./komodod -ac_name=CAD -addnode=78.47.196.146 & +./komodod -ac_name=CHF -addnode=78.47.196.146 & +./komodod -ac_name=NZD -addnode=78.47.196.146 & +./komodod -ac_name=CNY -addnode=78.47.196.146 & +./komodod -ac_name=RUB -addnode=78.47.196.146 & +./komodod -ac_name=MXN -addnode=78.47.196.146 & +./komodod -ac_name=RBL -addnode=78.47.196.146 & +./komodod -ac_name=INR -addnode=78.47.196.146 & +./komodod -ac_name=HKD -addnode=78.47.196.146 & +./komodod -ac_name=TRY -addnode=78.47.196.146 & +./komodod -ac_name=ZAR -addnode=78.47.196.146 & +./komodod -ac_name=PLN -addnode=78.47.196.146 & +./komodod -ac_name=NOK -addnode=78.47.196.146 & +./komodod -ac_name=SEK -addnode=78.47.196.146 & +./komodod -ac_name=DKK -addnode=78.47.196.146 & +./komodod -ac_name=CZK -addnode=78.47.196.146 & +./komodod -ac_name=HUF -addnode=78.47.196.146 & +./komodod -ac_name=ILS -addnode=78.47.196.146 & +./komodod -ac_name=KRW -addnode=78.47.196.146 & +./komodod -ac_name=MYR -addnode=78.47.196.146 & +./komodod -ac_name=PHP -addnode=78.47.196.146 & +./komodod -ac_name=RON -addnode=78.47.196.146 & +./komodod -ac_name=SGD -addnode=78.47.196.146 & +./komodod -ac_name=THB -addnode=78.47.196.146 & +./komodod -ac_name=BGN -addnode=78.47.196.146 & +./komodod -ac_name=IDR -addnode=78.47.196.146 & +./komodod -ac_name=HRK -addnode=78.47.196.146 & diff --git a/src/clearassets b/src/clearassets new file mode 100755 index 000000000..b09a5c6b5 --- /dev/null +++ b/src/clearassets @@ -0,0 +1,32 @@ +rm -rf ~/.komodo/USD +rm -rf ~/.komodo/EUR +rm -rf ~/.komodo/JPY +rm -rf ~/.komodo/GBP +rm -rf ~/.komodo/AUD +rm -rf ~/.komodo/CAD +rm -rf ~/.komodo/CHF +rm -rf ~/.komodo/NZD +rm -rf ~/.komodo/CNY +rm -rf ~/.komodo/RUB +rm -rf ~/.komodo/MXN +rm -rf ~/.komodo/RBL +rm -rf ~/.komodo/INR +rm -rf ~/.komodo/HKD +rm -rf ~/.komodo/TRY +rm -rf ~/.komodo/ZAR +rm -rf ~/.komodo/PLN +rm -rf ~/.komodo/NOK +rm -rf ~/.komodo/SEK +rm -rf ~/.komodo/DKK +rm -rf ~/.komodo/CZK +rm -rf ~/.komodo/HUF +rm -rf ~/.komodo/ILS +rm -rf ~/.komodo/KRW +rm -rf ~/.komodo/MYR +rm -rf ~/.komodo/PHP +rm -rf ~/.komodo/RON +rm -rf ~/.komodo/SGD +rm -rf ~/.komodo/THB +rm -rf ~/.komodo/BGN +rm -rf ~/.komodo/IDR +rm -rf ~/.komodo/HRK diff --git a/src/fiat/aud b/src/fiat/aud new file mode 100755 index 000000000..73ac7d70c --- /dev/null +++ b/src/fiat/aud @@ -0,0 +1 @@ +./assetchain-cli -ac_name=AUD $1 $2 $3 $4 diff --git a/src/fiat/bgn b/src/fiat/bgn new file mode 100755 index 000000000..62fa5e1c2 --- /dev/null +++ b/src/fiat/bgn @@ -0,0 +1 @@ +./assetchain-cli -ac_name=BGN $1 $2 $3 $4 diff --git a/src/fiat/cad b/src/fiat/cad new file mode 100755 index 000000000..b3644c2c9 --- /dev/null +++ b/src/fiat/cad @@ -0,0 +1 @@ +./assetchain-cli -ac_name=CAD $1 $2 $3 $4 diff --git a/src/fiat/chf b/src/fiat/chf new file mode 100755 index 000000000..3ff4a3ba3 --- /dev/null +++ b/src/fiat/chf @@ -0,0 +1 @@ +./assetchain-cli -ac_name=CHF $1 $2 $3 $4 diff --git a/src/fiat/cny b/src/fiat/cny new file mode 100755 index 000000000..3b5f68bbb --- /dev/null +++ b/src/fiat/cny @@ -0,0 +1 @@ +./assetchain-cli -ac_name=CNY $1 $2 $3 $4 diff --git a/src/fiat/czk b/src/fiat/czk new file mode 100755 index 000000000..3194d8952 --- /dev/null +++ b/src/fiat/czk @@ -0,0 +1 @@ +./assetchain-cli -ac_name=CZK $1 $2 $3 $4 diff --git a/src/fiat/dkk b/src/fiat/dkk new file mode 100755 index 000000000..3624bb0f2 --- /dev/null +++ b/src/fiat/dkk @@ -0,0 +1 @@ +./assetchain-cli -ac_name=DKK $1 $2 $3 $4 diff --git a/src/fiat/eur b/src/fiat/eur new file mode 100755 index 000000000..ba4bd79d9 --- /dev/null +++ b/src/fiat/eur @@ -0,0 +1 @@ +./assetchain-cli -ac_name=EUR $1 $2 $3 $4 diff --git a/src/fiat/gbp b/src/fiat/gbp new file mode 100755 index 000000000..dade6b54c --- /dev/null +++ b/src/fiat/gbp @@ -0,0 +1 @@ +./assetchain-cli -ac_name=GBP $1 $2 $3 $4 diff --git a/src/fiat/hkd b/src/fiat/hkd new file mode 100755 index 000000000..b82ae9f9a --- /dev/null +++ b/src/fiat/hkd @@ -0,0 +1 @@ +./assetchain-cli -ac_name=HKD $1 $2 $3 $4 diff --git a/src/fiat/hrk b/src/fiat/hrk new file mode 100755 index 000000000..b7197ae59 --- /dev/null +++ b/src/fiat/hrk @@ -0,0 +1 @@ +./assetchain-cli -ac_name=HRK $1 $2 $3 $4 diff --git a/src/fiat/huf b/src/fiat/huf new file mode 100755 index 000000000..2f57e0edc --- /dev/null +++ b/src/fiat/huf @@ -0,0 +1 @@ +./assetchain-cli -ac_name=HUF $1 $2 $3 $4 diff --git a/src/fiat/idr b/src/fiat/idr new file mode 100755 index 000000000..6b60985cc --- /dev/null +++ b/src/fiat/idr @@ -0,0 +1 @@ +./assetchain-cli -ac_name=IDR $1 $2 $3 $4 diff --git a/src/fiat/ils b/src/fiat/ils new file mode 100755 index 000000000..7e82f9750 --- /dev/null +++ b/src/fiat/ils @@ -0,0 +1 @@ +./assetchain-cli -ac_name=ILS $1 $2 $3 $4 diff --git a/src/fiat/inr b/src/fiat/inr new file mode 100755 index 000000000..fea26d26a --- /dev/null +++ b/src/fiat/inr @@ -0,0 +1 @@ +./assetchain-cli -ac_name=INR $1 $2 $3 $4 diff --git a/src/fiat/jpy b/src/fiat/jpy new file mode 100755 index 000000000..451bfb0fa --- /dev/null +++ b/src/fiat/jpy @@ -0,0 +1 @@ +./assetchain-cli -ac_name=JPY $1 $2 $3 $4 diff --git a/src/fiat/krw b/src/fiat/krw new file mode 100755 index 000000000..a200d0257 --- /dev/null +++ b/src/fiat/krw @@ -0,0 +1 @@ +./assetchain-cli -ac_name=KRW $1 $2 $3 $4 diff --git a/src/fiat/mxn b/src/fiat/mxn new file mode 100755 index 000000000..6704d95ef --- /dev/null +++ b/src/fiat/mxn @@ -0,0 +1 @@ +./assetchain-cli -ac_name=MXN $1 $2 $3 $4 diff --git a/src/fiat/myr b/src/fiat/myr new file mode 100755 index 000000000..9062fa4d7 --- /dev/null +++ b/src/fiat/myr @@ -0,0 +1 @@ +./assetchain-cli -ac_name=MYR $1 $2 $3 $4 diff --git a/src/fiat/nok b/src/fiat/nok new file mode 100755 index 000000000..51b9625e1 --- /dev/null +++ b/src/fiat/nok @@ -0,0 +1 @@ +./assetchain-cli -ac_name=NOK $1 $2 $3 $4 diff --git a/src/fiat/nzd b/src/fiat/nzd new file mode 100755 index 000000000..066877087 --- /dev/null +++ b/src/fiat/nzd @@ -0,0 +1 @@ +./assetchain-cli -ac_name=NZD $1 $2 $3 $4 diff --git a/src/fiat/php b/src/fiat/php new file mode 100755 index 000000000..fd98249fe --- /dev/null +++ b/src/fiat/php @@ -0,0 +1 @@ +./assetchain-cli -ac_name=PHP $1 $2 $3 $4 diff --git a/src/fiat/pln b/src/fiat/pln new file mode 100755 index 000000000..f633ae56b --- /dev/null +++ b/src/fiat/pln @@ -0,0 +1 @@ +./assetchain-cli -ac_name=PLN $1 $2 $3 $4 diff --git a/src/fiat/rbl b/src/fiat/rbl new file mode 100755 index 000000000..506db379b --- /dev/null +++ b/src/fiat/rbl @@ -0,0 +1 @@ +./assetchain-cli -ac_name=RBL $1 $2 $3 $4 diff --git a/src/fiat/ron b/src/fiat/ron new file mode 100755 index 000000000..66ef5c4a6 --- /dev/null +++ b/src/fiat/ron @@ -0,0 +1 @@ +./assetchain-cli -ac_name=RON $1 $2 $3 $4 diff --git a/src/fiat/rub b/src/fiat/rub new file mode 100755 index 000000000..1abc377d3 --- /dev/null +++ b/src/fiat/rub @@ -0,0 +1 @@ +./assetchain-cli -ac_name=RUB $1 $2 $3 $4 diff --git a/src/fiat/sek b/src/fiat/sek new file mode 100755 index 000000000..43ceef507 --- /dev/null +++ b/src/fiat/sek @@ -0,0 +1 @@ +./assetchain-cli -ac_name=SEK $1 $2 $3 $4 diff --git a/src/fiat/sgd b/src/fiat/sgd new file mode 100755 index 000000000..c0f0dd209 --- /dev/null +++ b/src/fiat/sgd @@ -0,0 +1 @@ +./assetchain-cli -ac_name=SGD $1 $2 $3 $4 diff --git a/src/fiat/thb b/src/fiat/thb new file mode 100755 index 000000000..49c2e3d7d --- /dev/null +++ b/src/fiat/thb @@ -0,0 +1 @@ +./assetchain-cli -ac_name=THB $1 $2 $3 $4 diff --git a/src/fiat/try b/src/fiat/try new file mode 100755 index 000000000..b0cefaa1c --- /dev/null +++ b/src/fiat/try @@ -0,0 +1 @@ +./assetchain-cli -ac_name=TRY $1 $2 $3 $4 diff --git a/src/fiat/usd b/src/fiat/usd new file mode 100755 index 000000000..d2e2dece8 --- /dev/null +++ b/src/fiat/usd @@ -0,0 +1 @@ +./assetchain-cli -ac_name=USD $1 $2 $3 $4 diff --git a/src/fiat/zar b/src/fiat/zar new file mode 100755 index 000000000..88107f411 --- /dev/null +++ b/src/fiat/zar @@ -0,0 +1 @@ +./assetchain-cli -ac_name=ZAR $1 $2 $3 $4 From 466dbb5363bb201ca8dc9ea8ae2a6ad0c091c4fe Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 13:32:02 -0300 Subject: [PATCH 47/67] test --- src/fiat/aud | 2 +- src/fiat/bgn | 2 +- src/fiat/cad | 2 +- src/fiat/chf | 2 +- src/fiat/cny | 2 +- src/fiat/czk | 2 +- src/fiat/dkk | 2 +- src/fiat/eur | 2 +- src/fiat/gbp | 2 +- src/fiat/hkd | 2 +- src/fiat/hrk | 2 +- src/fiat/huf | 2 +- src/fiat/idr | 2 +- src/fiat/ils | 2 +- src/fiat/inr | 2 +- src/fiat/jpy | 2 +- src/fiat/krw | 2 +- src/fiat/mxn | 2 +- src/fiat/myr | 2 +- src/fiat/nok | 2 +- src/fiat/nzd | 2 +- src/fiat/php | 2 +- src/fiat/pln | 2 +- src/fiat/rbl | 2 +- src/fiat/ron | 2 +- src/fiat/rub | 2 +- src/fiat/sek | 2 +- src/fiat/sgd | 2 +- src/fiat/thb | 2 +- src/fiat/try | 2 +- src/fiat/usd | 2 +- src/fiat/zar | 2 +- 32 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/fiat/aud b/src/fiat/aud index 73ac7d70c..86bb2d56d 100755 --- a/src/fiat/aud +++ b/src/fiat/aud @@ -1 +1 @@ -./assetchain-cli -ac_name=AUD $1 $2 $3 $4 +./komodo-cli -ac_name=AUD $1 $2 $3 $4 diff --git a/src/fiat/bgn b/src/fiat/bgn index 62fa5e1c2..ef57ca52e 100755 --- a/src/fiat/bgn +++ b/src/fiat/bgn @@ -1 +1 @@ -./assetchain-cli -ac_name=BGN $1 $2 $3 $4 +./komodo-cli -ac_name=BGN $1 $2 $3 $4 diff --git a/src/fiat/cad b/src/fiat/cad index b3644c2c9..d1265c9ed 100755 --- a/src/fiat/cad +++ b/src/fiat/cad @@ -1 +1 @@ -./assetchain-cli -ac_name=CAD $1 $2 $3 $4 +./komodo-cli -ac_name=CAD $1 $2 $3 $4 diff --git a/src/fiat/chf b/src/fiat/chf index 3ff4a3ba3..c8a4923a5 100755 --- a/src/fiat/chf +++ b/src/fiat/chf @@ -1 +1 @@ -./assetchain-cli -ac_name=CHF $1 $2 $3 $4 +./komodo-cli -ac_name=CHF $1 $2 $3 $4 diff --git a/src/fiat/cny b/src/fiat/cny index 3b5f68bbb..09c16fbd0 100755 --- a/src/fiat/cny +++ b/src/fiat/cny @@ -1 +1 @@ -./assetchain-cli -ac_name=CNY $1 $2 $3 $4 +./komodo-cli -ac_name=CNY $1 $2 $3 $4 diff --git a/src/fiat/czk b/src/fiat/czk index 3194d8952..a3b735a93 100755 --- a/src/fiat/czk +++ b/src/fiat/czk @@ -1 +1 @@ -./assetchain-cli -ac_name=CZK $1 $2 $3 $4 +./komodo-cli -ac_name=CZK $1 $2 $3 $4 diff --git a/src/fiat/dkk b/src/fiat/dkk index 3624bb0f2..370f28087 100755 --- a/src/fiat/dkk +++ b/src/fiat/dkk @@ -1 +1 @@ -./assetchain-cli -ac_name=DKK $1 $2 $3 $4 +./komodo-cli -ac_name=DKK $1 $2 $3 $4 diff --git a/src/fiat/eur b/src/fiat/eur index ba4bd79d9..d00e86cf8 100755 --- a/src/fiat/eur +++ b/src/fiat/eur @@ -1 +1 @@ -./assetchain-cli -ac_name=EUR $1 $2 $3 $4 +./komodo-cli -ac_name=EUR $1 $2 $3 $4 diff --git a/src/fiat/gbp b/src/fiat/gbp index dade6b54c..d4dce3696 100755 --- a/src/fiat/gbp +++ b/src/fiat/gbp @@ -1 +1 @@ -./assetchain-cli -ac_name=GBP $1 $2 $3 $4 +./komodo-cli -ac_name=GBP $1 $2 $3 $4 diff --git a/src/fiat/hkd b/src/fiat/hkd index b82ae9f9a..74349e2b6 100755 --- a/src/fiat/hkd +++ b/src/fiat/hkd @@ -1 +1 @@ -./assetchain-cli -ac_name=HKD $1 $2 $3 $4 +./komodo-cli -ac_name=HKD $1 $2 $3 $4 diff --git a/src/fiat/hrk b/src/fiat/hrk index b7197ae59..ec421ab58 100755 --- a/src/fiat/hrk +++ b/src/fiat/hrk @@ -1 +1 @@ -./assetchain-cli -ac_name=HRK $1 $2 $3 $4 +./komodo-cli -ac_name=HRK $1 $2 $3 $4 diff --git a/src/fiat/huf b/src/fiat/huf index 2f57e0edc..98d46721b 100755 --- a/src/fiat/huf +++ b/src/fiat/huf @@ -1 +1 @@ -./assetchain-cli -ac_name=HUF $1 $2 $3 $4 +./komodo-cli -ac_name=HUF $1 $2 $3 $4 diff --git a/src/fiat/idr b/src/fiat/idr index 6b60985cc..aa78918de 100755 --- a/src/fiat/idr +++ b/src/fiat/idr @@ -1 +1 @@ -./assetchain-cli -ac_name=IDR $1 $2 $3 $4 +./komodo-cli -ac_name=IDR $1 $2 $3 $4 diff --git a/src/fiat/ils b/src/fiat/ils index 7e82f9750..efdca0bfc 100755 --- a/src/fiat/ils +++ b/src/fiat/ils @@ -1 +1 @@ -./assetchain-cli -ac_name=ILS $1 $2 $3 $4 +./komodo-cli -ac_name=ILS $1 $2 $3 $4 diff --git a/src/fiat/inr b/src/fiat/inr index fea26d26a..e570a267d 100755 --- a/src/fiat/inr +++ b/src/fiat/inr @@ -1 +1 @@ -./assetchain-cli -ac_name=INR $1 $2 $3 $4 +./komodo-cli -ac_name=INR $1 $2 $3 $4 diff --git a/src/fiat/jpy b/src/fiat/jpy index 451bfb0fa..80f6629f0 100755 --- a/src/fiat/jpy +++ b/src/fiat/jpy @@ -1 +1 @@ -./assetchain-cli -ac_name=JPY $1 $2 $3 $4 +./komodo-cli -ac_name=JPY $1 $2 $3 $4 diff --git a/src/fiat/krw b/src/fiat/krw index a200d0257..5e894ae22 100755 --- a/src/fiat/krw +++ b/src/fiat/krw @@ -1 +1 @@ -./assetchain-cli -ac_name=KRW $1 $2 $3 $4 +./komodo-cli -ac_name=KRW $1 $2 $3 $4 diff --git a/src/fiat/mxn b/src/fiat/mxn index 6704d95ef..12a556c54 100755 --- a/src/fiat/mxn +++ b/src/fiat/mxn @@ -1 +1 @@ -./assetchain-cli -ac_name=MXN $1 $2 $3 $4 +./komodo-cli -ac_name=MXN $1 $2 $3 $4 diff --git a/src/fiat/myr b/src/fiat/myr index 9062fa4d7..70af112e2 100755 --- a/src/fiat/myr +++ b/src/fiat/myr @@ -1 +1 @@ -./assetchain-cli -ac_name=MYR $1 $2 $3 $4 +./komodo-cli -ac_name=MYR $1 $2 $3 $4 diff --git a/src/fiat/nok b/src/fiat/nok index 51b9625e1..39ebd60be 100755 --- a/src/fiat/nok +++ b/src/fiat/nok @@ -1 +1 @@ -./assetchain-cli -ac_name=NOK $1 $2 $3 $4 +./komodo-cli -ac_name=NOK $1 $2 $3 $4 diff --git a/src/fiat/nzd b/src/fiat/nzd index 066877087..12bcc9b61 100755 --- a/src/fiat/nzd +++ b/src/fiat/nzd @@ -1 +1 @@ -./assetchain-cli -ac_name=NZD $1 $2 $3 $4 +./komodo-cli -ac_name=NZD $1 $2 $3 $4 diff --git a/src/fiat/php b/src/fiat/php index fd98249fe..a34f2b737 100755 --- a/src/fiat/php +++ b/src/fiat/php @@ -1 +1 @@ -./assetchain-cli -ac_name=PHP $1 $2 $3 $4 +./komodo-cli -ac_name=PHP $1 $2 $3 $4 diff --git a/src/fiat/pln b/src/fiat/pln index f633ae56b..df55f75a8 100755 --- a/src/fiat/pln +++ b/src/fiat/pln @@ -1 +1 @@ -./assetchain-cli -ac_name=PLN $1 $2 $3 $4 +./komodo-cli -ac_name=PLN $1 $2 $3 $4 diff --git a/src/fiat/rbl b/src/fiat/rbl index 506db379b..fce4e2d18 100755 --- a/src/fiat/rbl +++ b/src/fiat/rbl @@ -1 +1 @@ -./assetchain-cli -ac_name=RBL $1 $2 $3 $4 +./komodo-cli -ac_name=RBL $1 $2 $3 $4 diff --git a/src/fiat/ron b/src/fiat/ron index 66ef5c4a6..fbe0de412 100755 --- a/src/fiat/ron +++ b/src/fiat/ron @@ -1 +1 @@ -./assetchain-cli -ac_name=RON $1 $2 $3 $4 +./komodo-cli -ac_name=RON $1 $2 $3 $4 diff --git a/src/fiat/rub b/src/fiat/rub index 1abc377d3..7419ff31e 100755 --- a/src/fiat/rub +++ b/src/fiat/rub @@ -1 +1 @@ -./assetchain-cli -ac_name=RUB $1 $2 $3 $4 +./komodo-cli -ac_name=RUB $1 $2 $3 $4 diff --git a/src/fiat/sek b/src/fiat/sek index 43ceef507..f14b8b31c 100755 --- a/src/fiat/sek +++ b/src/fiat/sek @@ -1 +1 @@ -./assetchain-cli -ac_name=SEK $1 $2 $3 $4 +./komodo-cli -ac_name=SEK $1 $2 $3 $4 diff --git a/src/fiat/sgd b/src/fiat/sgd index c0f0dd209..e77f72e02 100755 --- a/src/fiat/sgd +++ b/src/fiat/sgd @@ -1 +1 @@ -./assetchain-cli -ac_name=SGD $1 $2 $3 $4 +./komodo-cli -ac_name=SGD $1 $2 $3 $4 diff --git a/src/fiat/thb b/src/fiat/thb index 49c2e3d7d..ca92c4724 100755 --- a/src/fiat/thb +++ b/src/fiat/thb @@ -1 +1 @@ -./assetchain-cli -ac_name=THB $1 $2 $3 $4 +./komodo-cli -ac_name=THB $1 $2 $3 $4 diff --git a/src/fiat/try b/src/fiat/try index b0cefaa1c..81602f133 100755 --- a/src/fiat/try +++ b/src/fiat/try @@ -1 +1 @@ -./assetchain-cli -ac_name=TRY $1 $2 $3 $4 +./komodo-cli -ac_name=TRY $1 $2 $3 $4 diff --git a/src/fiat/usd b/src/fiat/usd index d2e2dece8..c72fbc5c3 100755 --- a/src/fiat/usd +++ b/src/fiat/usd @@ -1 +1 @@ -./assetchain-cli -ac_name=USD $1 $2 $3 $4 +./komodo-cli -ac_name=USD $1 $2 $3 $4 diff --git a/src/fiat/zar b/src/fiat/zar index 88107f411..92dfaf269 100755 --- a/src/fiat/zar +++ b/src/fiat/zar @@ -1 +1 @@ -./assetchain-cli -ac_name=ZAR $1 $2 $3 $4 +./komodo-cli -ac_name=ZAR $1 $2 $3 $4 From 3fca36b0da3e82866d7168be6d0b98895c62627b Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 13:33:47 -0300 Subject: [PATCH 48/67] test --- src/miner.cpp | 6 +++--- src/net.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index 39ad03b3c..b6fcb278d 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -490,7 +490,7 @@ void static BitcoinMiner(CWallet *pwallet) std::string solver = GetArg("-equihashsolver", "tromp"); assert(solver == "tromp" || solver == "default"); LogPrint("pow", "Using Equihash solver \"%s\" with n = %u, k = %u\n", solver, n, k); - fprintf(stderr,"Mining with %s\n",solver.c_str()); + //fprintf(stderr,"Mining with %s\n",solver.c_str()); std::mutex m_cs; bool cancelSolver = false; boost::signals2::connection c = uiInterface.NotifyBlockTip.connect( @@ -503,7 +503,7 @@ void static BitcoinMiner(CWallet *pwallet) try { while (true) { - if (0 && chainparams.MiningRequiresPeers()) + if (chainparams.MiningRequiresPeers()) { // Busy-wait for the network to come online so we don't waste time mining // on an obsolete chain. In regtest mode we expect to fly solo. @@ -594,7 +594,7 @@ void static BitcoinMiner(CWallet *pwallet) std::lock_guard lock{m_cs}; cancelSolver = false; } - fprintf(stderr,"Block found %d\n",Mining_height); + fprintf(stderr,"%s Block found %d\n",ASSETCHAINS_SYMBOL,Mining_height); SetThreadPriority(THREAD_PRIORITY_LOWEST); // In regression test mode, stop mining after a block is found. if (chainparams.MineBlocksOnDemand()) { diff --git a/src/net.cpp b/src/net.cpp index 97ee9b071..a65dacdaf 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -115,7 +115,7 @@ void AddOneShot(string strDest) unsigned short GetListenPort() { - printf("Listenport.%u\n",Params().GetDefaultPort()); + //printf("Listenport.%u\n",Params().GetDefaultPort()); return (unsigned short)(GetArg("-port", Params().GetDefaultPort())); } From 992b52c3f9612fbbc0208a194746bbed40e15c7c Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 13:35:18 -0300 Subject: [PATCH 49/67] test --- src/miner.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/miner.cpp b/src/miner.cpp index b6fcb278d..49cfadfda 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -475,6 +475,7 @@ static bool ProcessBlockFound(CBlock* pblock, CWallet& wallet, CReserveKey& rese void static BitcoinMiner(CWallet *pwallet) { + extern char ASSETCHAINS_SYMBOL[16]; LogPrintf("ZcashMiner started\n"); SetThreadPriority(THREAD_PRIORITY_LOWEST); RenameThread("zcash-miner"); From 935fc055f681013018dd7555b3bf82685cb7cb23 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 13:48:55 -0300 Subject: [PATCH 50/67] test --- src/komodo_utils.h | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 31dbc4090..e8afc97c1 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1262,7 +1262,7 @@ void komodo_configfile(char *symbol,uint16_t port) komodo_userpass(myusername,mypassword,fp); mapArgs["-rpcpassword"] = mypassword; mapArgs["-rpcusername"] = myusername; - fprintf(stderr,"myusername.(%s)\n",myusername); + //fprintf(stderr,"myusername.(%s)\n",myusername); fclose(fp); } strcpy(fname,GetDataDir().string().c_str()); @@ -1275,7 +1275,7 @@ void komodo_configfile(char *symbol,uint16_t port) fname[strlen(fname)-1] = 0; strcat(fname,"komodo.conf"); #endif - printf("KOMODO.(%s)\n",fname); + //printf("KOMODO.(%s)\n",fname); if ( (fp= fopen(fname,"rb")) != 0 ) { komodo_userpass(username,password,fp); @@ -1291,7 +1291,6 @@ void komodo_args() NOTARY_PUBKEY = GetArg("-pubkey", ""); if ( strlen(NOTARY_PUBKEY.c_str()) == 66 ) USE_EXTERNAL_PUBKEY = 1; - fprintf(stderr,"IS_KOMODO_NOTARY %d %s\n",IS_KOMODO_NOTARY,NOTARY_PUBKEY.c_str()); name = GetArg("-ac_name",""); if ( name.c_str()[0] != 0 ) { @@ -1308,15 +1307,20 @@ void komodo_args() for (i=0; ASSETCHAINS_SYMBOL[i+1]!=0; i++) ASSETCHAINS_SYMBOL[i] = ASSETCHAINS_SYMBOL[i+1]; } - fprintf(stderr,"after args: %c%s port.%u magic.%08x supply.%u\n",ASSETCHAINS_SHORTFLAG!=0?'-':'+',ASSETCHAINS_SYMBOL,ASSETCHAINS_PORT,ASSETCHAINS_MAGIC,(int32_t)ASSETCHAINS_SUPPLY); + //fprintf(stderr,"after args: %c%s port.%u magic.%08x supply.%u\n",ASSETCHAINS_SHORTFLAG!=0?'-':'+',ASSETCHAINS_SYMBOL,ASSETCHAINS_PORT,ASSETCHAINS_MAGIC,(int32_t)ASSETCHAINS_SUPPLY); while ( (dirname= (char *)GetDataDir(false).string().c_str()) == 0 || dirname[0] == 0 ) { fprintf(stderr,"waiting for datadir\n"); sleep(3); } - fprintf(stderr,"Got datadir.(%s)\n",dirname); + //fprintf(stderr,"Got datadir.(%s)\n",dirname); if ( ASSETCHAINS_SYMBOL[0] != 0 ) komodo_configfile(ASSETCHAINS_SYMBOL,ASSETCHAINS_PORT + 1); - } else ASSETCHAINS_PORT = 8777; - fprintf(stderr,"%s chain params initialized\n",ASSETCHAINS_SYMBOL); + } + else + { + ASSETCHAINS_PORT = 8777; + fprintf(stderr,"IS_KOMODO_NOTARY %d %s\n",IS_KOMODO_NOTARY,NOTARY_PUBKEY.c_str()); + } + //fprintf(stderr,"%s chain params initialized\n",ASSETCHAINS_SYMBOL); } \ No newline at end of file From 43a3c405d82721d36ab434b7eebe8108dd2aaf46 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 13:52:13 -0300 Subject: [PATCH 51/67] test --- src/bitcoind.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp index ce398c02d..f5601ab77 100644 --- a/src/bitcoind.cpp +++ b/src/bitcoind.cpp @@ -32,6 +32,8 @@ */ static bool fDaemon; +extern char ASSETCHAINS_SYMBOL[16]; +void komodo_gateway_iteration(char *symbol); void WaitForShutdown(boost::thread_group* threadGroup) { @@ -39,7 +41,8 @@ void WaitForShutdown(boost::thread_group* threadGroup) // Tell the main threads to shutdown. while (!fShutdown) { - MilliSleep(200); + MilliSleep(2000); + komodo_gateway_iteration(ASSETCHAINS_SYMBOL); fShutdown = ShutdownRequested(); } if (threadGroup) From 10fa67233fe2d513354462d0ff9412eecd0dac40 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 13:52:31 -0300 Subject: [PATCH 52/67] test --- src/bitcoind.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp index f5601ab77..6d802b873 100644 --- a/src/bitcoind.cpp +++ b/src/bitcoind.cpp @@ -42,7 +42,8 @@ void WaitForShutdown(boost::thread_group* threadGroup) while (!fShutdown) { MilliSleep(2000); - komodo_gateway_iteration(ASSETCHAINS_SYMBOL); + if ( ASSETCHAINS_SYMBOL[0] != 0 ) + komodo_gateway_iteration(ASSETCHAINS_SYMBOL); fShutdown = ShutdownRequested(); } if (threadGroup) From 9fc60fe366027c588ec58eace8419ea4ee9d26f4 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 14:10:50 -0300 Subject: [PATCH 53/67] test --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 9632c6cdd..eb50ba680 100644 --- a/README.md +++ b/README.md @@ -152,6 +152,11 @@ tail -f ~/.komodo/debug.log #To view all command ./src/komodo-cli help + +ASSETCHAINS: -ac_name=name -ac_supply=nnnnn + +Both komodod and komodo-cli recognize -ac_name=option so you can create a zcash fork from the commandline + ``` ======= From eda3ca932600535abe5e721fb821af71d0308e71 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 14:33:53 -0300 Subject: [PATCH 54/67] test --- src/consensus/consensus.h | 2 +- src/komodo_utils.h | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/consensus/consensus.h b/src/consensus/consensus.h index d700666bc..7fc20d7fc 100644 --- a/src/consensus/consensus.h +++ b/src/consensus/consensus.h @@ -17,7 +17,7 @@ static const unsigned int MAX_BLOCK_SIGOPS = 20000; /** The maximum size of a transaction (network rule) */ static const unsigned int MAX_TX_SIZE = 100000; /** Coinbase transaction outputs can only be spent after this number of new blocks (network rule) */ -static const int COINBASE_MATURITY = 100; +int COINBASE_MATURITY = 100; /** Flags for LockTime() */ enum { diff --git a/src/komodo_utils.h b/src/komodo_utils.h index e8afc97c1..5691d74bb 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1252,7 +1252,7 @@ void komodo_configfile(char *symbol,uint16_t port) { if ( (fp= fopen(fname,"wb")) != 0 ) { - fprintf(fp,"rpcuser=user%u\nrpcpassword=pass%s\nrpcport=%u\nserver=1\ntxindex=1\nbind=127.0.0.1\n",crc,password,port); + fprintf(fp,"rpcuser=user%u\nrpcpassword=pass%s\nrpcport=%u\nserver=1\ntxindex=1\n\n",crc,password,port); fclose(fp); printf("Created (%s)\n",fname); } else printf("Couldnt create (%s)\n",fname); @@ -1315,7 +1315,12 @@ void komodo_args() } //fprintf(stderr,"Got datadir.(%s)\n",dirname); if ( ASSETCHAINS_SYMBOL[0] != 0 ) + { + extern int COINBASE_MATURITY; komodo_configfile(ASSETCHAINS_SYMBOL,ASSETCHAINS_PORT + 1); + if ( komodo_baseid(ASSETCHAINS_SYMBOL) >= 0 ) + COINBASE_MATURITY = 0; + } } else { From 1290fc052798b9dba8f014143c0a6ee3e12fbc95 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 14:35:28 -0300 Subject: [PATCH 55/67] test --- src/consensus/consensus.h | 2 +- src/komodo_globals.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/consensus/consensus.h b/src/consensus/consensus.h index 7fc20d7fc..d9f24db11 100644 --- a/src/consensus/consensus.h +++ b/src/consensus/consensus.h @@ -17,7 +17,7 @@ static const unsigned int MAX_BLOCK_SIGOPS = 20000; /** The maximum size of a transaction (network rule) */ static const unsigned int MAX_TX_SIZE = 100000; /** Coinbase transaction outputs can only be spent after this number of new blocks (network rule) */ -int COINBASE_MATURITY = 100; +extern int COINBASE_MATURITY; /** Flags for LockTime() */ enum { diff --git a/src/komodo_globals.h b/src/komodo_globals.h index 119a722ef..11062e866 100644 --- a/src/komodo_globals.h +++ b/src/komodo_globals.h @@ -13,6 +13,8 @@ * * ******************************************************************************/ +int COINBASE_MATURITY = 100; + int32_t IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY; std::string NOTARY_PUBKEY; uint8_t NOTARY_PUBKEY33[33]; From 6051a4bc61af8f049d014a0ddd52547d69e6f076 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 14:38:37 -0300 Subject: [PATCH 56/67] test --- src/komodo_utils.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 5691d74bb..c29339e97 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1316,6 +1316,7 @@ void komodo_args() //fprintf(stderr,"Got datadir.(%s)\n",dirname); if ( ASSETCHAINS_SYMBOL[0] != 0 ) { + int32_t komodo_baseid(char *origbase); extern int COINBASE_MATURITY; komodo_configfile(ASSETCHAINS_SYMBOL,ASSETCHAINS_PORT + 1); if ( komodo_baseid(ASSETCHAINS_SYMBOL) >= 0 ) From 18d9697a4256216e19c0e02347fa18e80e6ceed7 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 14:52:11 -0300 Subject: [PATCH 57/67] test --- src/komodo_pax.h | 17 +---------------- src/komodo_utils.h | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/src/komodo_pax.h b/src/komodo_pax.h index 71d9178d8..c65d09878 100644 --- a/src/komodo_pax.h +++ b/src/komodo_pax.h @@ -18,9 +18,7 @@ int32_t NUM_PRICES; uint32_t *PVALS; #define USD 0 #define MAX_CURRENCIES 32 -char CURRENCIES[][8] = { "USD", "EUR", "JPY", "GBP", "AUD", "CAD", "CHF", "NZD", // major currencies - "CNY", "RUB", "MXN", "BRL", "INR", "HKD", "TRY", "ZAR", "PLN", "NOK", "SEK", "DKK", "CZK", "HUF", "ILS", "KRW", "MYR", "PHP", "RON", "SGD", "THB", "BGN", "IDR", "HRK", - "KMD" }; +extern char CURRENCIES[][8]; uint64_t M1SUPPLY[] = { 3317900000000, 6991604000000, 667780000000000, 1616854000000, 331000000000, 861909000000, 584629000000, 46530000000, // major currencies 45434000000000, 16827000000000, 3473357229000, 306435000000, 27139000000000, 2150641000000, 347724099000, 1469583000000, 749543000000, 1826110000000, 2400434000000, 1123925000000, 3125276000000, 13975000000000, 317657000000, 759706000000000, 354902000000, 2797061000000, 162189000000, 163745000000, 1712000000000, 39093000000, 1135490000000000, 80317000000, @@ -233,19 +231,6 @@ void komodo_pvals(int32_t height,uint32_t *pvals,uint8_t numpvals) } } -int32_t komodo_baseid(char *origbase) -{ - int32_t i; char base[64]; - for (i=0; origbase[i]!=0&&i= '0' && c <= '9' ) From dfa036b60be2918de0cb47820b8b1a69320234ca Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 14:53:11 -0300 Subject: [PATCH 58/67] test --- src/komodo_utils.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index f2760a2d5..0adbb62e3 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -782,6 +782,7 @@ char *bitcoin_address(char *coinaddr,uint8_t addrtype,uint8_t *pubkey_or_rmd160, return(coinaddr); } +#define MAX_CURRENCIES 32 char CURRENCIES[][8] = { "USD", "EUR", "JPY", "GBP", "AUD", "CAD", "CHF", "NZD", // major currencies "CNY", "RUB", "MXN", "BRL", "INR", "HKD", "TRY", "ZAR", "PLN", "NOK", "SEK", "DKK", "CZK", "HUF", "ILS", "KRW", "MYR", "PHP", "RON", "SGD", "THB", "BGN", "IDR", "HRK", "KMD" }; From 6eaecdc132980e16e2425125605451d32f1bd327 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 14:58:36 -0300 Subject: [PATCH 59/67] test --- src/miner.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/miner.cpp b/src/miner.cpp index 49cfadfda..8637d719e 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -504,7 +504,7 @@ void static BitcoinMiner(CWallet *pwallet) try { while (true) { - if (chainparams.MiningRequiresPeers()) + if (0&&chainparams.MiningRequiresPeers()) { // Busy-wait for the network to come online so we don't waste time mining // on an obsolete chain. In regtest mode we expect to fly solo. From 65adb21e388fbdc015d1fe43163dc275a8dc78d0 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 15:02:26 -0300 Subject: [PATCH 60/67] test --- src/miner.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/miner.cpp b/src/miner.cpp index 8637d719e..49cfadfda 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -504,7 +504,7 @@ void static BitcoinMiner(CWallet *pwallet) try { while (true) { - if (0&&chainparams.MiningRequiresPeers()) + if (chainparams.MiningRequiresPeers()) { // Busy-wait for the network to come online so we don't waste time mining // on an obsolete chain. In regtest mode we expect to fly solo. From 4f0c9cecb6f0739e90dc02ec5340e00ecd8381ae Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 15:14:42 -0300 Subject: [PATCH 61/67] test --- src/komodo_utils.h | 2 +- src/miner.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 0adbb62e3..7a7b5c99b 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1338,7 +1338,7 @@ void komodo_args() extern int COINBASE_MATURITY; komodo_configfile(ASSETCHAINS_SYMBOL,ASSETCHAINS_PORT + 1); if ( komodo_baseid(ASSETCHAINS_SYMBOL) >= 0 ) - COINBASE_MATURITY = 0; + COINBASE_MATURITY = 1; } } else diff --git a/src/miner.cpp b/src/miner.cpp index 49cfadfda..8637d719e 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -504,7 +504,7 @@ void static BitcoinMiner(CWallet *pwallet) try { while (true) { - if (chainparams.MiningRequiresPeers()) + if (0&&chainparams.MiningRequiresPeers()) { // Busy-wait for the network to come online so we don't waste time mining // on an obsolete chain. In regtest mode we expect to fly solo. From 65195b3ed724444a169b2d34eafef027cc6913b9 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 15:17:51 -0300 Subject: [PATCH 62/67] test --- src/wallet/wallet.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 41eb352ab..df9b8ee43 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -771,6 +771,11 @@ void CWallet::DecrementNoteWitnesses() } // TODO: If nWitnessCache is zero, we need to regenerate the caches (#1302) assert(nWitnessCacheSize > 0); + if ( nWitnessCacheSize <= 0 ) + { + extern char ASSETCHAINS_SYMBOL[16]; + fprintf(stderr,"%s nWitnessCacheSize.%d\n",ASSETCHAINS_SYMBOL,(int32_t)nWitnessCacheSize); + } if (fFileBacked) { CWalletDB walletdb(strWalletFile); WriteWitnessCache(walletdb); From 4955e0e02b9f9281e7845a067197c349bda91d21 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 15:27:24 -0300 Subject: [PATCH 63/67] test --- src/miner.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/miner.cpp b/src/miner.cpp index 8637d719e..49cfadfda 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -504,7 +504,7 @@ void static BitcoinMiner(CWallet *pwallet) try { while (true) { - if (0&&chainparams.MiningRequiresPeers()) + if (chainparams.MiningRequiresPeers()) { // Busy-wait for the network to come online so we don't waste time mining // on an obsolete chain. In regtest mode we expect to fly solo. From 73efed766109028217142633ad8db5d23f4a51a0 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 15:44:58 -0300 Subject: [PATCH 64/67] test --- src/fiat-cli | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/fiat-cli diff --git a/src/fiat-cli b/src/fiat-cli new file mode 100644 index 000000000..6e29daa70 --- /dev/null +++ b/src/fiat-cli @@ -0,0 +1,32 @@ +echo aud; fiat/aud $1 $2 $3 $4 +echo bgn; fiat/bgn $1 $2 $3 $4 +echo cad; fiat/cad $1 $2 $3 $4 +echo chf; fiat/chf $1 $2 $3 $4 +echo cny; fiat/cny $1 $2 $3 $4 +echo czk; fiat/czk $1 $2 $3 $4 +echo dkk; fiat/dkk $1 $2 $3 $4 +echo eur; fiat/eur $1 $2 $3 $4 +echo gbp; fiat/gbp $1 $2 $3 $4 +echo hkd; fiat/hkd $1 $2 $3 $4 +echo hrk; fiat/hrk $1 $2 $3 $4 +echo huf; fiat/huf $1 $2 $3 $4 +echo idr; fiat/idr $1 $2 $3 $4 +echo ils; fiat/ils $1 $2 $3 $4 +echo inr; fiat/inr $1 $2 $3 $4 +echo jpy; fiat/jpy $1 $2 $3 $4 +echo krw; fiat/krw $1 $2 $3 $4 +echo mxn; fiat/mxn $1 $2 $3 $4 +echo myr; fiat/myr $1 $2 $3 $4 +echo nok; fiat/nok $1 $2 $3 $4 +echo nzd; fiat/nzd $1 $2 $3 $4 +echo php; fiat/php $1 $2 $3 $4 +echo pln; fiat/pln $1 $2 $3 $4 +echo rbl; fiat/rbl $1 $2 $3 $4 +echo ron; fiat/ron $1 $2 $3 $4 +echo rub; fiat/rub $1 $2 $3 $4 +echo sek; fiat/sek $1 $2 $3 $4 +echo sgd; fiat/sgd $1 $2 $3 $4 +echo thb; fiat/thb $1 $2 $3 $4 +echo try; fiat/try $1 $2 $3 $4 +echo usd; fiat/usd $1 $2 $3 $4 +echo zar; fiat/zar $1 $2 $3 $4 From 256ca4ae43c956ce2ceebbd7c14b6d0674d5c7b2 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 15:45:54 -0300 Subject: [PATCH 65/67] test --- src/fiat-cli | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 src/fiat-cli diff --git a/src/fiat-cli b/src/fiat-cli old mode 100644 new mode 100755 From 9722d705c962f62a6c418d951e120f32fd97429e Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 15:51:37 -0300 Subject: [PATCH 66/67] test --- src/assetchains | 2 +- src/clearassets | 2 +- src/fiat-cli | 2 +- src/fiat/brl | 1 + src/fiat/rbl | 1 - 5 files changed, 4 insertions(+), 4 deletions(-) create mode 100755 src/fiat/brl delete mode 100755 src/fiat/rbl diff --git a/src/assetchains b/src/assetchains index ed7656f03..32700d0da 100755 --- a/src/assetchains +++ b/src/assetchains @@ -9,7 +9,7 @@ ./komodod -ac_name=CNY -addnode=78.47.196.146 & ./komodod -ac_name=RUB -addnode=78.47.196.146 & ./komodod -ac_name=MXN -addnode=78.47.196.146 & -./komodod -ac_name=RBL -addnode=78.47.196.146 & +./komodod -ac_name=BRL -addnode=78.47.196.146 & ./komodod -ac_name=INR -addnode=78.47.196.146 & ./komodod -ac_name=HKD -addnode=78.47.196.146 & ./komodod -ac_name=TRY -addnode=78.47.196.146 & diff --git a/src/clearassets b/src/clearassets index b09a5c6b5..6c37fb95d 100755 --- a/src/clearassets +++ b/src/clearassets @@ -9,7 +9,7 @@ rm -rf ~/.komodo/NZD rm -rf ~/.komodo/CNY rm -rf ~/.komodo/RUB rm -rf ~/.komodo/MXN -rm -rf ~/.komodo/RBL +rm -rf ~/.komodo/BRL rm -rf ~/.komodo/INR rm -rf ~/.komodo/HKD rm -rf ~/.komodo/TRY diff --git a/src/fiat-cli b/src/fiat-cli index 6e29daa70..5d1469be8 100755 --- a/src/fiat-cli +++ b/src/fiat-cli @@ -21,7 +21,7 @@ echo nok; fiat/nok $1 $2 $3 $4 echo nzd; fiat/nzd $1 $2 $3 $4 echo php; fiat/php $1 $2 $3 $4 echo pln; fiat/pln $1 $2 $3 $4 -echo rbl; fiat/rbl $1 $2 $3 $4 +echo brl; fiat/brl $1 $2 $3 $4 echo ron; fiat/ron $1 $2 $3 $4 echo rub; fiat/rub $1 $2 $3 $4 echo sek; fiat/sek $1 $2 $3 $4 diff --git a/src/fiat/brl b/src/fiat/brl new file mode 100755 index 000000000..aa9c8b571 --- /dev/null +++ b/src/fiat/brl @@ -0,0 +1 @@ +./komodo-cli -ac_name=BRL $1 $2 $3 $4 diff --git a/src/fiat/rbl b/src/fiat/rbl deleted file mode 100755 index fce4e2d18..000000000 --- a/src/fiat/rbl +++ /dev/null @@ -1 +0,0 @@ -./komodo-cli -ac_name=RBL $1 $2 $3 $4 From 1911ff1acd67fb035cd93199afa94e3124bc6f73 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 16:04:11 -0300 Subject: [PATCH 67/67] test --- src/miner.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index 49cfadfda..0cce3e779 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -101,6 +101,7 @@ void UpdateTime(CBlockHeader* pblock, const Consensus::Params& consensusParams, int32_t komodo_pax_opreturn(uint8_t *opret,int32_t maxsize); extern int32_t KOMODO_INITDONE; extern uint64_t KOMODO_DEPOSIT; +extern char ASSETCHAINS_SYMBOL[16]; CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) { @@ -110,7 +111,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) if(!pblocktemplate.get()) return NULL; CBlock *pblock = &pblocktemplate->block; // pointer for convenience - while ( chainActive.Tip()->nHeight > 10 && mempool.GetTotalTxSize() <= 0 ) + while ( ASSETCHAINS_SYMBOL[0] != 0 && chainActive.Tip()->nHeight > 10 && mempool.GetTotalTxSize() <= 0 ) { sleep(10); if ( KOMODO_INITDONE == 0 || time(NULL) < KOMODO_INITDONE+60 ) @@ -475,7 +476,6 @@ static bool ProcessBlockFound(CBlock* pblock, CWallet& wallet, CReserveKey& rese void static BitcoinMiner(CWallet *pwallet) { - extern char ASSETCHAINS_SYMBOL[16]; LogPrintf("ZcashMiner started\n"); SetThreadPriority(THREAD_PRIORITY_LOWEST); RenameThread("zcash-miner");