Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
6e81929f3d
  1. 4
      iguana/iguana777.c
  2. 4
      iguana/iguana_accept.c
  3. 12
      iguana/iguana_blocks.c
  4. 4
      iguana/iguana_bundles.c
  5. 2
      iguana/iguana_msg.c
  6. 5
      iguana/iguana_recv.c
  7. 24
      iguana/iguana_spendvectors.c

4
iguana/iguana777.c

@ -550,9 +550,9 @@ int32_t iguana_utxogen(struct supernet_info *myinfo,struct iguana_info *coin,int
}
if ( helperid == 0 )
{
printf("start iguana_update_balances\n");
printf("%s start iguana_update_balances\n",coin->symbol);
iguana_update_balances(coin);
printf("iguana_update_balances completed\n");
printf("%s iguana_update_balances completed\n",coin->symbol);
if ( 1 )
{
for (i=0; i<max; i++)

4
iguana/iguana_accept.c

@ -138,7 +138,7 @@ void iguana_acceptloop(void *args)
}
else
{
printf("LAUNCH DEDICATED THREAD for %s:%u\n",ipaddr,cli_addr.sin_port);
printf("LAUNCH %s DEDICATED THREAD for %s:%u\n",coin->symbol,ipaddr,cli_addr.sin_port);
addr->usock = sock;
addr->dead = 0;
addr->A.port = cli_addr.sin_port;
@ -157,7 +157,7 @@ int32_t iguana_pendingaccept(struct iguana_info *coin)
if ( (addr= iguana_peerslot(coin,ptr->ipbits,0)) != 0 )
{
expand_ipbits(ipaddr,ptr->ipbits);
printf("iguana_pendingaccept LAUNCH DEDICATED THREAD for %s\n",ipaddr);
printf("iguana_pendingaccept %s LAUNCH DEDICATED THREAD for %s\n",coin->symbol,ipaddr);
addr->usock = ptr->sock;
strcpy(addr->symbol,coin->symbol);
iguana_launch(coin,"accept",iguana_dedicatedglue,addr,IGUANA_CONNTHREAD);

12
iguana/iguana_blocks.c

@ -431,25 +431,25 @@ int32_t iguana_walkchain(struct iguana_info *coin,int32_t skipflag)
bundlei = (height % coin->chain->bundlesize);
if ( (bp= coin->bundles[hdrsi]) == 0 || (block= bp->blocks[bundlei]) == 0 )
{
printf("walk error [%d:%d] %p vs %p\n",hdrsi,bundlei,block,bp->blocks[bundlei]);
printf("%s walk error [%d:%d] %p vs %p\n",coin->symbol,hdrsi,bundlei,block,bp->blocks[bundlei]);
break;
}
else if ( block->height >= 0 && block->height != height )
printf("walkchain height mismatch %d vs %d\n",block->height,height);
printf("%s walkchain height mismatch %d vs %d\n",coin->symbol,block->height,height);
iguana_blocksizecheck("walkchain",coin->chain->zcash,block);
if ( bits256_nonz(iguana_blockhash(coin,height)) != 0 && bits256_cmp(iguana_blockhash(coin,height),block->RO.hash2) != 0 )
{
printf("walk error blockhash error at %d %s\n",height,bits256_str(str,iguana_blockhash(coin,height)));
printf("%s walk error blockhash error at %d %s\n",coin->symbol,height,bits256_str(str,iguana_blockhash(coin,height)));
break;
}
else if ( bits256_cmp(bp->hashes[bundlei],block->RO.hash2) != 0 )
{
printf("walk error [%d:%d] %s vs %s\n",hdrsi,bundlei,bits256_str(str,bp->hashes[bundlei]),bits256_str(str,block->RO.hash2));
printf("%s walk error [%d:%d] %s vs %s\n",coin->symbol,hdrsi,bundlei,bits256_str(str,bp->hashes[bundlei]),bits256_str(str,block->RO.hash2));
break;
}
else if ( block->hdrsi != hdrsi || block->bundlei != bundlei )
{
printf("walk error [%d:%d] vs [%d:%d]\n",hdrsi,bundlei,block->hdrsi,block->bundlei);
printf("%s walk error [%d:%d] vs [%d:%d]\n",coin->symbol,hdrsi,bundlei,block->hdrsi,block->bundlei);
break;
}
if ( height == 0 )
@ -494,7 +494,7 @@ struct iguana_block *iguana_fastlink(struct iguana_info *coin,int32_t hwmheight)
if ( prev != 0 && bits256_nonz(block->RO.prev_block) == 0 )
{
block->RO.prev_block = prev->RO.hash2;
printf("PATCH.[%d:%d] prev is null\n",bp->hdrsi,bundlei);
printf("%s PATCH.[%d:%d] prev is null\n",coin->symbol,bp->hdrsi,bundlei);
break;
}
bp->blocks[bundlei] = block;

4
iguana/iguana_bundles.c

@ -146,7 +146,7 @@ int32_t iguana_hash2set(struct iguana_info *coin,char *debugstr,struct iguana_bu
{
char str2[65],str3[65];
bits256_str(str2,*orighash2p), bits256_str(str3,newhash2);
printf("WARNING iguana_hash2set overwrite avoided [%s] %s with %s [%d:%d]\n",debugstr,str2,str3,bp->hdrsi,bundlei);
printf("WARNING iguana_hash2set overwrite %s [%s] %s with %s [%d:%d]\n",coin->symbol,debugstr,str2,str3,bp->hdrsi,bundlei);
}
return(-1);
//*orighash2p = newhash2;
@ -1444,7 +1444,7 @@ void iguana_bundlestats(struct supernet_info *myinfo,struct iguana_info *coin,ch
{
if ( bp != coin->current )
{
printf("new 1st.%d\n",bp->hdrsi);
printf("%s new 1st.%d\n",coin->symbol,bp->hdrsi);
iguana_bundleissuemissing(myinfo,coin,bp,1 + (rand() % 3),1.);
if ( bp->queued == 0 )
iguana_bundleQ(myinfo,coin,bp,0);

2
iguana/iguana_msg.c

@ -440,7 +440,7 @@ int32_t iguana_send_ping(struct supernet_info *myinfo,struct iguana_info *coin,s
int32_t len; uint64_t nonce; uint8_t serialized[sizeof(struct iguana_msghdr) + sizeof(nonce)];
if ( addr->msgcounts.verack == 0 )
{
printf("send version instead of ping to %s\n",addr->ipaddr);
printf("%s send version instead of ping to %s\n",coin->symbol,addr->ipaddr);
return(iguana_send_version(coin,addr,coin->myservices));
}
if ( (nonce= addr->pingnonce) == 0 )

5
iguana/iguana_recv.c

@ -817,7 +817,7 @@ void iguana_gotblockM(struct supernet_info *myinfo,struct iguana_info *coin,stru
if ( time(NULL) > lastdisp+30 )
{
lastdisp = (uint32_t)time(NULL);
printf("ramchaindata have %d:%d at %d | %d blocks %s redundant xfers total %s %.2f%% wasted\n",bp->hdrsi,bundlei,block->fpos,numredundant,mbstr(str,redundantsize),mbstr(str2,totalrecv),100.*redundantsize/totalrecv);
printf("%s have %d:%d at %d | %d blocks %s redundant xfers total %s %.2f%% wasted\n",coin->symbol,bp->hdrsi,bundlei,block->fpos,numredundant,mbstr(str,redundantsize),mbstr(str2,totalrecv),100.*redundantsize/totalrecv);
}
if ( bundlei > 1 )
{
@ -895,7 +895,7 @@ int32_t iguana_gotheadersM(struct iguana_info *coin,struct iguana_peer *addr,str
uint32_t i,sum = 0;
for (i=0; i<sizeof(hdrsreceived)/sizeof(*hdrsreceived); i++)
sum += hdrsreceived[i];
printf("TOTAL HDRS RECEIVED %u -> %s\n",sum,mbstr(str,sum*80));
printf("%s TOTAL HDRS RECEIVED %u -> %s\n",coin->symbol,sum,mbstr(str,sum*80));
}
addr->recvhdrs++;
if ( addr->pendhdrs > 0 )
@ -1729,7 +1729,6 @@ int32_t iguana_reqblocks(struct supernet_info *myinfo,struct iguana_info *coin)
{
if ( (block= iguana_blockfind("hwmcheckb",coin,coin->blocks.hwmchain.RO.prev_block)) != 0 )
{
printf("decrement HWM\n");
iguana_blockzcopy(coin->chain->zcash,(struct iguana_block *)&coin->blocks.hwmchain,block);
return(0);
}

24
iguana/iguana_spendvectors.c

@ -441,7 +441,7 @@ int32_t iguana_spendvectors(struct supernet_info *myinfo,struct iguana_info *coi
if ( ptr != 0 )
myfree(ptr,sizeof(*ptr) * n);
//if ( bp != coin->current )
printf("UTXO [%4d].%-6d dur.%-2d [milli %8.3f] vectors %-6d err.%d [%5.2f%%] %7d %9s of %d\n",bp->hdrsi,bp->numtmpspends,(uint32_t)time(NULL)-starttime,OS_milliseconds()-startmillis,spendind,errs,100.*(double)emitted/(total+1),emit,mbstr(str,sizeof(*ptr) * emit),n);
printf("%s UTXO [%4d].%-6d dur.%-2d [%8.3f] vec %-6d err.%d [%5.2f%%] %7d %9s of %d\n",coin->symbol,bp->hdrsi,bp->numtmpspends,(uint32_t)time(NULL)-starttime,OS_milliseconds()-startmillis,spendind,errs,100.*(double)emitted/(total+1),emit,mbstr(str,sizeof(*ptr) * emit),n);
return(-errs);
}
@ -661,7 +661,7 @@ int32_t iguana_volatilesinit(struct supernet_info *myinfo,struct iguana_info *co
fclose(fp);
}
if ( filecrc != 0 )
printf("have filecrc.%08x for %s milli.%.0f from_ro.%d\n",filecrc,bits256_str(str,balancehash),OS_milliseconds(),from_ro);
printf("%s have filecrc.%08x for %s milli.%.0f from_ro.%d\n",coin->symbol,filecrc,bits256_str(str,balancehash),OS_milliseconds(),from_ro);
if ( from_ro == 0 || filecrc == 0 )
{
if ( filecrc == 0 )
@ -690,16 +690,16 @@ int32_t iguana_volatilesinit(struct supernet_info *myinfo,struct iguana_info *co
} //else printf("missing hdrs.[%d] data.%p num.(%u %d) %p %p\n",i,bp->ramchain.H.data,numpkinds,numunspents,Aptr,Uptr);
}
} else crc = filecrc;
printf("millis %.0f from_ro.%d written.%d crc.%08x/%08x balancehash.(%s) vs (%s)\n",OS_milliseconds(),from_ro,coin->balanceswritten,crc,filecrc,bits256_str(str,balancehash),bits256_str(str2,coin->balancehash));
printf("%s millis %.0f from_ro.%d written.%d crc.%08x/%08x balancehash.(%s) vs (%s)\n",coin->symbol,OS_milliseconds(),from_ro,coin->balanceswritten,crc,filecrc,bits256_str(str,balancehash),bits256_str(str2,coin->balancehash));
if ( (filecrc != 0 && filecrc != crc) || memcmp(balancehash.bytes,coin->balancehash.bytes,sizeof(balancehash)) != 0 || memcmp(allbundles.bytes,coin->allbundles.bytes,sizeof(allbundles)) != 0 )
{
printf("balancehash or crc.(%x %x) mismatch or allbundles.(%llx %llx) mismatch\n",crc,filecrc,(long long)allbundles.txid,(long long)coin->allbundles.txid);
printf("%s balancehash or crc.(%x %x) mismatch or allbundles.(%llx %llx) mismatch\n",coin->symbol,crc,filecrc,(long long)allbundles.txid,(long long)coin->allbundles.txid);
iguana_truncatebalances(coin);
OS_removefile(crcfname,0);
}
else
{
printf("MATCHED balancehash numhdrsi.%d crc.%08x\n",coin->balanceswritten,crc);
printf("%s MATCHED balancehash numhdrsi.%d crc.%08x\n",coin->symbol,coin->balanceswritten,crc);
if ( (fp= fopen(crcfname,"wb")) != 0 )
{
if ( fwrite(&crc,1,sizeof(crc),fp) != sizeof(crc) || fwrite(&balancehash,1,sizeof(balancehash),fp) != sizeof(balancehash) || fwrite(&allbundles,1,sizeof(allbundles),fp) != sizeof(allbundles) )
@ -736,7 +736,7 @@ int32_t iguana_volatilesinit(struct supernet_info *myinfo,struct iguana_info *co
iguana_update_balances(coin);*/
iguana_datachain_scan(myinfo,coin,CRYPTO777_RMD160);
//iguana_utxoaddr_gen(myinfo,coin,(coin->bundlescount - 1) * coin->chain->bundlesize);*/
printf("end volatilesinit\n");
printf("end %s volatilesinit\n",coin->symbol);
return(coin->bundlescount);
}
@ -746,14 +746,13 @@ void iguana_initfinal(struct supernet_info *myinfo,struct iguana_info *coin,bits
if ( bits256_nonz(lastbundle) > 0 )
{
init_hexbytes_noT(hashstr,lastbundle.bytes,sizeof(bits256));
printf("req lastbundle.(%s)\n",hashstr);
queue_enqueue("hdrsQ",&coin->hdrsQ,queueitem(hashstr),1);
}
for (i=0; i<coin->bundlescount-1; i++)
{
if ( (bp= coin->bundles[i]) == 0 || bp->emitfinish <= 1 )
{
printf("initfinal break.[%d]: bp.%p or emit.%u utxofinish.%u\n",i,bp,bp!=0?bp->emitfinish:-1,bp!=0?bp->utxofinish:-1);
printf("%s initfinal break.[%d]: bp.%p or emit.%u utxofinish.%u\n",coin->symbol,i,bp,bp!=0?bp->emitfinish:-1,bp!=0?bp->utxofinish:-1);
break;
}
if ( i == 0 )
@ -761,7 +760,7 @@ void iguana_initfinal(struct supernet_info *myinfo,struct iguana_info *coin,bits
}
if ( i < coin->bundlescount-1 )
{
printf("spendvectors.[%d] max.%d missing, will regen all of them\n",i,coin->bundlescount-1);
printf("%s spendvectors.[%d] max.%d missing, will regen all of them\n",coin->symbol,i,coin->bundlescount-1);
for (i=0; i<coin->bundlescount-1; i++)
{
if ( (bp= coin->bundles[i]) != 0 )
@ -776,7 +775,7 @@ void iguana_initfinal(struct supernet_info *myinfo,struct iguana_info *coin,bits
bp->converted = (uint32_t)time(NULL);
}
}
printf("i.%d bundlescount.%d\n",i,coin->bundlescount);
printf("%s i.%d bundlescount.%d\n",coin->symbol,i,coin->bundlescount);
if ( coin->balanceswritten > 1 )
coin->balanceswritten = iguana_volatilesinit(myinfo,coin);
/*if ( coin->balanceswritten > 1 )
@ -790,7 +789,7 @@ void iguana_initfinal(struct supernet_info *myinfo,struct iguana_info *coin,bits
//iguana_validateQ(coin,coin->bundles[i]);
}
}*/
printf("i.%d balanceswritten.%d\n",i,coin->balanceswritten);
printf("%s i.%d balanceswritten.%d\n",coin->symbol,i,coin->balanceswritten);
if ( coin->balanceswritten < coin->bundlescount )
{
for (i=0*coin->balanceswritten; i<coin->bundlescount; i++)
@ -807,7 +806,6 @@ void iguana_initfinal(struct supernet_info *myinfo,struct iguana_info *coin,bits
iguana_volatilesinit(myinfo,coin);
iguana_savehdrs(coin);
iguana_fastlink(coin,coin->balanceswritten * coin->chain->bundlesize - 1);
printf("walkchain\n");
iguana_walkchain(coin,0);
hash2 = iguana_blockhash(coin,coin->balanceswritten * coin->chain->bundlesize);
if ( bits256_nonz(hash2) != 0 && (block= iguana_blockfind("initfinal",coin,hash2)) != 0 )
@ -994,7 +992,7 @@ int32_t iguana_spendvectorsaves(struct iguana_info *coin)
for (j=0; j<bp->numtmpspends; j++)
if ( bp->tmpspends[j].tmpflag != 0 )
{
printf("vectorsave.[%d] vec.%d still has tmpflag\n",i,j);
printf("%s vectorsave.[%d] vec.%d still has tmpflag\n",coin->symbol,i,j);
return(-1);
}
}

Loading…
Cancel
Save