diff --git a/basilisk/basilisk.c b/basilisk/basilisk.c index 16705170f..8c2335457 100755 --- a/basilisk/basilisk.c +++ b/basilisk/basilisk.c @@ -916,12 +916,14 @@ void basilisks_loop(void *arg) valsobj = cJSON_CreateObject(); if ( btcd->RELAYNODE == 0 && btcd->VALIDATENODE == 0 ) { + fprintf(stderr,"e"); jaddnum(valsobj,"BTCD",btcd->SEQ.BTCD.numstamps+GECKO_FIRSTPOSSIBLEBTCD); basilisk_standardservice("SEQ",myinfo,GENESIS_PUBKEY,valsobj,0,0); flag++; } if ( (done & 2) == 0 ) { + fprintf(stderr,"f"); free_json(valsobj); valsobj = cJSON_CreateObject(); jaddnum(valsobj,"BTC",btcd->SEQ.BTC.numstamps+GECKO_FIRSTPOSSIBLEBTC); @@ -930,6 +932,7 @@ void basilisks_loop(void *arg) } free_json(valsobj); } + fprintf(stderr,"G"); if ( flag == 0 && myinfo->allcoins_numvirts > 0 ) { maxmillis = (1000 / myinfo->allcoins_numvirts) + 1; @@ -938,6 +941,7 @@ void basilisks_loop(void *arg) { if ( virt->started != 0 && virt->active != 0 && virt->virtualchain != 0 ) { + fprintf(stderr,"h"); gecko_iteration(myinfo,btcd,virt,maxmillis); flag++; } @@ -945,7 +949,7 @@ void basilisks_loop(void *arg) //portable_mutex_unlock(&Allcoins_mutex); } } - fprintf(stderr,"E "); + fprintf(stderr,"i "); //for (i=0; iRELAYNODE == 0 && coin->VALIDATENODE == 0 && coin->active != 0 && coin->chain->userpass[0] != 0 && coin->MAXPEERS == 1 ) // basilisk_bitcoinscan(coin,blockspace,&RAWMEM); diff --git a/gecko/gecko.c b/gecko/gecko.c index 90e01c308..9a68b393b 100755 --- a/gecko/gecko.c +++ b/gecko/gecko.c @@ -44,18 +44,22 @@ void gecko_iteration(struct supernet_info *myinfo,struct iguana_info *btcd,struc char mineraddr[64]; int32_t hwmhdrsi,longesthdrsi; hwmhdrsi = virt->blocks.hwmchain.height / virt->chain->bundlesize; longesthdrsi = virt->longestchain / virt->chain->bundlesize; - if ( hwmhdrsi <= longesthdrsi ) + if ( hwmhdrsi <= longesthdrsi && virt->blocks.hwmchain.height < virt->longestchain-1 ) { if ( time(NULL) > virt->hdrstime+3 ) { + if ( strcmp("BTCD",virt->symbol) == 0 ) + ; + fprintf(stderr,"r"); gecko_requesthdrs(myinfo,virt,hwmhdrsi); + fprintf(stderr,"R"); virt->hdrstime = (uint32_t)time(NULL); } } if ( btcd->RELAYNODE != 0 && virt->blocks.hwmchain.height >= virt->longestchain-1 ) { bitcoin_address(mineraddr,virt->chain->pubtype,myinfo->persistent_pubkey33,33); - //printf("mine.%s %s\n",virt->symbol,mineraddr); + fprintf(stderr,"mine.%s %s\n",virt->symbol,mineraddr); gecko_miner(myinfo,btcd,virt,maxmillis,myinfo->persistent_pubkey33); } } diff --git a/gecko/gecko_headers.c b/gecko/gecko_headers.c index 8b7e42a4a..311b2db53 100755 --- a/gecko/gecko_headers.c +++ b/gecko/gecko_headers.c @@ -40,10 +40,10 @@ int32_t basilisk_respond_geckogetheaders(struct supernet_info *myinfo,struct igu return(-1); } -void gecko_headerupdate(struct iguana_info *virt,bits256 hash2,int32_t height) +void gecko_blockhashupdate(struct iguana_info *virt,bits256 hash2,int32_t height) { int32_t bundlei; struct iguana_bundle *bp; bits256 zero; - char str[65]; printf("height.%d %s\n",height,bits256_str(str,hash2)); + char str[65]; printf("gecko_blockhashupdate height.%d %s\n",height,bits256_str(str,hash2)); memset(zero.bytes,0,sizeof(zero)); if ( (height % virt->chain->bundlesize) == 0 ) bp = iguana_bundlecreate(virt,&bundlei,height,hash2,zero,0); @@ -53,17 +53,23 @@ void gecko_headerupdate(struct iguana_info *virt,bits256 hash2,int32_t height) char *gecko_headersarrived(struct supernet_info *myinfo,struct iguana_info *virt,char *remoteaddr,uint8_t *data,int32_t datalen,bits256 firsthash2) { - bits256 hash2; struct iguana_block *block; int32_t firstheight,i,len=0,n,num; struct iguana_msgblock msgB; + bits256 hash2,prevhash2; struct iguana_block *block; int32_t height,firstheight,i,len=0,n,num; struct iguana_msgblock msgB; num = (int32_t)(datalen / 84); - char str[65]; printf("headers arrived.%d from %s\n",n,bits256_str(str,firsthash2)); + char str[65]; printf("headers arrived.%d from %s\n",num,bits256_str(str,firsthash2)); if ( (block= iguana_blockfind("geckohdrs",virt,firsthash2)) != 0 && (firstheight= block->height) >= 0 ) { - gecko_headerupdate(virt,firsthash2,firstheight); + gecko_blockhashupdate(virt,firsthash2,firstheight); + prevhash2 = firsthash2; for (i=0; isymbol,virt->chain->zcash,virt->chain->auxpow,virt->chain->hashalgo,0,&hash2,&data[len],&msgB,datalen-len)) > 0 ) { - gecko_headerupdate(virt,hash2,firstheight + i + 1); + if ( bits256_cmp(msgB.H.prev_block,prevhash2) == 0 ) + { + height = (firstheight + i + 1); + gecko_blockhashupdate(virt,hash2,height); + printf("ht.%d %s %08x t.%u\n",height,bits256_str(str,hash2),msgB.H.bits,msgB.H.timestamp); + } else printf("ht.%d non prevhash i.%d\n",height,i); len += n; } }