Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
05d25a2c90
  1. 14
      basilisk/basilisk.c
  2. 6
      gecko/gecko_miner.c
  3. 8
      iguana/iguana_realtime.c

14
basilisk/basilisk.c

@ -86,7 +86,7 @@ uint8_t *basilisk_jsondata(int32_t extraoffset,uint8_t **ptrp,uint8_t *space,int
if ( (hexstr= jstr(sendjson,"data")) != 0 ) if ( (hexstr= jstr(sendjson,"data")) != 0 )
{ {
hexdata = get_dataptr(0,&allocptr,&hexlen,hexspace,sizeof(hexspace),hexstr); hexdata = get_dataptr(0,&allocptr,&hexlen,hexspace,sizeof(hexspace),hexstr);
printf("jsondata.%s from sendjson\n",hexstr); //printf("jsondata.%s from sendjson\n",hexstr);
jdelete(sendjson,"data"); jdelete(sendjson,"data");
} }
*ptrp = 0; *ptrp = 0;
@ -105,9 +105,9 @@ uint8_t *basilisk_jsondata(int32_t extraoffset,uint8_t **ptrp,uint8_t *space,int
free(sendstr); free(sendstr);
if ( hexlen > 0 ) if ( hexlen > 0 )
{ {
int32_t i; for (i=0; i<hexlen; i++) //int32_t i; for (i=0; i<hexlen; i++)
printf("%02x",hexdata[i]); // printf("%02x",hexdata[i]);
printf(" <- hexdata\n"); //printf(" <- hexdata\n");
memcpy(&data[datalen],hexdata,hexlen); memcpy(&data[datalen],hexdata,hexlen);
datalen += hexlen; datalen += hexlen;
} }
@ -805,9 +805,9 @@ void basilisk_p2p(void *_myinfo,void *_addr,char *senderip,uint8_t *data,int32_t
else else
{ {
len += iguana_rwnum(0,data,sizeof(basilisktag),&basilisktag); len += iguana_rwnum(0,data,sizeof(basilisktag),&basilisktag);
int32_t i; for (i=0; i<datalen-len; i++) //int32_t i; for (i=0; i<datalen-len; i++)
printf("%02x",data[len+i]); // printf("%02x",data[len+i]);
printf(" ->received.%d basilisk_p2p.(%s) from %s tag.%d\n",datalen,type,senderip!=0?senderip:"?",basilisktag); //printf(" ->received.%d basilisk_p2p.(%s) from %s tag.%d\n",datalen,type,senderip!=0?senderip:"?",basilisktag);
basilisk_msgprocess(myinfo,_addr,ipbits,type,basilisktag,&data[len],datalen - len); basilisk_msgprocess(myinfo,_addr,ipbits,type,basilisktag,&data[len],datalen - len);
} }
if ( ptr != 0 ) if ( ptr != 0 )

6
gecko/gecko_miner.c

@ -81,13 +81,13 @@ uint32_t gecko_nBits(struct iguana_info *virt,uint32_t *prevtimestampp,struct ig
targetval = bits256_from_compact(nBits); targetval = bits256_from_compact(nBits);
if ( diff > est ) if ( diff > est )
{ {
targetval = bits256_ave(targetval,bits256_ave(targetval,bits256_lshift(targetval))); targetval = bits256_ave(targetval,bits256_ave(targetval,bits256_rshift(targetval)));
} }
else if ( diff < est ) else if ( diff < est )
{ {
targetval = bits256_ave(targetval,bits256_ave(targetval,bits256_rshift(targetval))); targetval = bits256_ave(targetval,bits256_ave(targetval,bits256_lshift(targetval)));
} }
//printf("diff.%d est.%d nBits.%08x <- %08x\n",endtime - starttime,virt->chain->estblocktime * i,bits256_to_compact(targetval),nBits); printf("diff.%d est.%d nBits.%08x <- %08x\n",diff,virt->chain->estblocktime * i,bits256_to_compact(targetval),nBits);
nBits = bits256_to_compact(targetval); nBits = bits256_to_compact(targetval);
} }
if ( nBits > GECKO_EASIESTDIFF ) if ( nBits > GECKO_EASIESTDIFF )

8
iguana/iguana_realtime.c

@ -221,7 +221,7 @@ int32_t iguana_realtime_update(struct supernet_info *myinfo,struct iguana_info *
} }
if ( coin->spendvectorsaved <= 1 ) if ( coin->spendvectorsaved <= 1 )
{ {
printf("spendvectorsaved not yet\n"); //printf("spendvectorsaved not yet\n");
usleep(100000); usleep(100000);
return(0); return(0);
} }
@ -283,7 +283,7 @@ printf("spendvectorsaved not yet\n");
bp->lastRT = (uint32_t)time(NULL); bp->lastRT = (uint32_t)time(NULL);
iguana_RTramchainalloc("RTbundle",coin,bp); iguana_RTramchainalloc("RTbundle",coin,bp);
bp->isRT = 1; bp->isRT = 1;
printf("RTheight.%d hwm.%d\n",coin->RTheight,coin->blocks.hwmchain.height); //printf("RTheight.%d hwm.%d\n",coin->RTheight,coin->blocks.hwmchain.height);
while ( (rdata= coin->RTramchain.H.data) != 0 && coin->RTheight <= coin->blocks.hwmchain.height-offset && coin->RTdatabad == 0 ) while ( (rdata= coin->RTramchain.H.data) != 0 && coin->RTheight <= coin->blocks.hwmchain.height-offset && coin->RTdatabad == 0 )
{ {
dest = &coin->RTramchain; dest = &coin->RTramchain;
@ -291,7 +291,7 @@ printf("spendvectorsaved not yet\n");
bundlei = (coin->RTheight % coin->chain->bundlesize); bundlei = (coin->RTheight % coin->chain->bundlesize);
if ( (block= iguana_bundleblock(coin,&hash2,bp,bundlei)) != 0 ) if ( (block= iguana_bundleblock(coin,&hash2,bp,bundlei)) != 0 )
iguana_bundlehashadd(coin,bp,bundlei,block); iguana_bundlehashadd(coin,bp,bundlei,block);
printf("RT.%d vs hwm.%d starti.%d bp->n %d block.%p/%p ramchain.%p databad.%d prevnonz.%d\n",coin->RTheight,coin->blocks.hwmchain.height,coin->RTstarti,bp->n,block,bp->blocks[bundlei],dest->H.data,coin->RTdatabad,bits256_nonz(block->RO.prev_block)); //printf("RT.%d vs hwm.%d starti.%d bp->n %d block.%p/%p ramchain.%p databad.%d prevnonz.%d\n",coin->RTheight,coin->blocks.hwmchain.height,coin->RTstarti,bp->n,block,bp->blocks[bundlei],dest->H.data,coin->RTdatabad,bits256_nonz(block->RO.prev_block));
if ( coin->RTdatabad == 0 && block != 0 && (block->height == 0 || bits256_nonz(block->RO.prev_block) != 0) ) if ( coin->RTdatabad == 0 && block != 0 && (block->height == 0 || bits256_nonz(block->RO.prev_block) != 0) )
{ {
//printf("bundlei.%d blockht.%d RTheight.%d\n",bundlei,block->height,coin->RTheight); //printf("bundlei.%d blockht.%d RTheight.%d\n",bundlei,block->height,coin->RTheight);
@ -331,7 +331,7 @@ printf("spendvectorsaved not yet\n");
flag++; flag++;
//coin->blocks.RO[bp->bundleheight+bundlei] = block->RO; //coin->blocks.RO[bp->bundleheight+bundlei] = block->RO;
coin->RTheight++; coin->RTheight++;
printf(">>>> RT.%d hwm.%d L.%d T.%d U.%d S.%d P.%d X.%d -> size.%ld\n",coin->RTheight,coin->blocks.hwmchain.height,coin->longestchain,dest->H.txidind,dest->H.unspentind,dest->H.spendind,dest->pkind,dest->externalind,(long)dest->H.data->allocsize); //printf(">>>> RT.%d hwm.%d L.%d T.%d U.%d S.%d P.%d X.%d -> size.%ld\n",coin->RTheight,coin->blocks.hwmchain.height,coin->longestchain,dest->H.txidind,dest->H.unspentind,dest->H.spendind,dest->pkind,dest->externalind,(long)dest->H.data->allocsize);
if ( coin->RTramchain.H.data != 0 ) if ( coin->RTramchain.H.data != 0 )
coin->RTramchain.H.data->numblocks = bundlei + 1; coin->RTramchain.H.data->numblocks = bundlei + 1;
else break; else break;

Loading…
Cancel
Save