From b6a7cb2ce0a77ad89cb4d5854bf8a34cbe8305ec Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 11 Nov 2016 13:03:24 -0300 Subject: [PATCH] test --- src/komodo_globals.h | 2 +- src/komodo_notary.h | 4 ++-- src/komodo_utils.h | 7 +++++-- src/miner.cpp | 6 ++++-- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/komodo_globals.h b/src/komodo_globals.h index a1a21f442..8ee8655ca 100644 --- a/src/komodo_globals.h +++ b/src/komodo_globals.h @@ -22,7 +22,7 @@ void komodo_assetchain_pubkeys(char *jsonstr); int COINBASE_MATURITY = 100; -int32_t IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,CURRENT_HEIGHT; +int32_t IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,CURRENT_HEIGHT,ASSETCHAINS_SEED; std::string NOTARY_PUBKEY,ASSETCHAINS_NOTARIES; uint8_t NOTARY_PUBKEY33[33]; diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 967b8a61b..777010982 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -271,6 +271,6 @@ void komodo_assetchain_pubkeys(char *jsonstr) } else fprintf(stderr,"komodo_assetchain_pubkeys i.%d vs n.%d\n",i,n); } else fprintf(stderr,"assetchain pubkeys n.%d\n",n); } - else if ( jsonstr != 0 ) - fprintf(stderr,"assetchain pubkeys couldnt parse.(%s)\n",jsonstr); + //else if ( jsonstr != 0 ) + // fprintf(stderr,"assetchain pubkeys couldnt parse.(%s)\n",jsonstr); } diff --git a/src/komodo_utils.h b/src/komodo_utils.h index a39a0e69c..ec11d2a2a 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1361,7 +1361,7 @@ char *iguanafmtstr = (char *)"curl --url \"http://127.0.0.1:7778\" --data \"{\\\ void komodo_args() { - std::string name; char *dirname,fname[512],magicstr[9]; uint8_t magic[4]; FILE *fp; int32_t i,len; + std::string name,addn; char *dirname,fname[512],magicstr[9]; uint8_t magic[4]; FILE *fp; int32_t i,len; IS_KOMODO_NOTARY = GetBoolArg("-notary", false); NOTARY_PUBKEY = GetArg("-pubkey", ""); if ( strlen(NOTARY_PUBKEY.c_str()) == 66 ) @@ -1370,6 +1370,9 @@ void komodo_args() if ( name.c_str()[0] != 0 ) { ASSETCHAINS_SUPPLY = GetArg("-ac_supply",10); + addn = GetArg("-addnode",""); + if ( strlen(addn.c_str()) > 6 ) + ASSETCHAINS_SEED = 1; strncpy(ASSETCHAINS_SYMBOL,name.c_str(),sizeof(ASSETCHAINS_SYMBOL)-1); ASSETCHAINS_PORT = komodo_port(ASSETCHAINS_SYMBOL,ASSETCHAINS_SUPPLY,&ASSETCHAINS_MAGIC,&ASSETCHAINS_SHORTFLAG); //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); @@ -1398,7 +1401,7 @@ void komodo_args() { fprintf(fp,iguanafmtstr,name.c_str(),name.c_str(),magicstr,ASSETCHAINS_PORT,ASSETCHAINS_PORT+1,"78.47.196.146"); fclose(fp); - printf("created (%s)\n",fname); + //printf("created (%s)\n",fname); } else printf("error creating (%s)\n",fname); } else diff --git a/src/miner.cpp b/src/miner.cpp index c30cd7bc0..4bbd6f08c 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -440,7 +440,7 @@ void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int& // Internal miner // #define ROUNDROBIN_DELAY 44 -extern int32_t IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAIN_INIT,KOMODO_INITDONE; +extern int32_t ASSETCHAINS_SEED,IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAIN_INIT,KOMODO_INITDONE; extern std::string NOTARY_PUBKEY; extern uint8_t NOTARY_PUBKEY33[33]; uint32_t Mining_start,Mining_height; @@ -546,8 +546,10 @@ void static BitcoinMiner(CWallet *pwallet) //fprintf(stderr,"try %s Mining with %s\n",ASSETCHAINS_SYMBOL,solver.c_str()); while (true) { - if (chainActive.Tip()->nHeight >= 100 && chainparams.MiningRequiresPeers()) + if (chainparams.MiningRequiresPeers()) { + if ( ASSETCHAINS_SEED != 0 && chainActive.Tip()->nHeight < 100 ) + break; // 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");