Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
000ce16c6f
  1. 10
      iguana/iguana_bundles.c
  2. 8
      iguana/iguana_ramchain.c

10
iguana/iguana_bundles.c

@ -182,8 +182,7 @@ int32_t iguana_hash2set(struct iguana_info *coin,char *debugstr,struct iguana_bu
//printf("set [%d] <- %s\n",bundlei,bits256_str(str,newhash2)); //printf("set [%d] <- %s\n",bundlei,bits256_str(str,newhash2));
if ( bits256_cmp(*orighash2p,newhash2) != 0 ) if ( bits256_cmp(*orighash2p,newhash2) != 0 )
{ {
*orighash2p = newhash2; if ( bits256_nonz(*orighash2p) != 0 && bp->bundleheight+bundlei <= coin->blocks.hwmchain.height )
if ( bp->bundleheight+bundlei <= coin->blocks.hwmchain.height )
{ {
printf("changing [%d:%d] -> %d < hwmheight %d\n",bp->hdrsi,bundlei,bp->bundleheight+bundlei,coin->blocks.hwmchain.height); printf("changing [%d:%d] -> %d < hwmheight %d\n",bp->hdrsi,bundlei,bp->bundleheight+bundlei,coin->blocks.hwmchain.height);
if ( bp->bundleheight+bundlei > 0 ) if ( bp->bundleheight+bundlei > 0 )
@ -191,6 +190,7 @@ int32_t iguana_hash2set(struct iguana_info *coin,char *debugstr,struct iguana_bu
printf("REORG %d blocks\n",coin->blocks.hwmchain.height - (bp->bundleheight+bundlei)); printf("REORG %d blocks\n",coin->blocks.hwmchain.height - (bp->bundleheight+bundlei));
} }
} }
*orighash2p = newhash2;
} }
return(retval); return(retval);
} }
@ -643,7 +643,7 @@ int32_t iguana_bundletweak(struct iguana_info *coin,struct iguana_bundle *bp)
int64_t iguana_bundlecalcs(struct iguana_info *coin,struct iguana_bundle *bp) int64_t iguana_bundlecalcs(struct iguana_info *coin,struct iguana_bundle *bp)
{ {
int32_t bundlei,checki,hdrsi,numhashes,numsaved,numcached,numrecv,minrequests; //FILE *fp; int32_t bundlei,checki,hdrsi,numhashes,numsaved,numcached,numrecv,minrequests; FILE *fp;
int64_t datasize; struct iguana_block *block; char fname[1024]; static bits256 zero; int64_t datasize; struct iguana_block *block; char fname[1024]; static bits256 zero;
if ( bp->emitfinish > coin->startutc ) if ( bp->emitfinish > coin->startutc )
{ {
@ -662,7 +662,7 @@ int64_t iguana_bundlecalcs(struct iguana_info *coin,struct iguana_bundle *bp)
printf("iguana_bundlecalcs.(%s) illegal hdrsi.%d bundlei.%d checki.%d\n",fname,hdrsi,bundlei,checki); printf("iguana_bundlecalcs.(%s) illegal hdrsi.%d bundlei.%d checki.%d\n",fname,hdrsi,bundlei,checki);
continue; continue;
} }
/*if ( 1 && bp->checkedtmp < bp->n && (fp= fopen(fname,"rb")) != 0 ) if ( coin->current == bp && (fp= fopen(fname,"rb")) != 0 )
{ {
fseek(fp,0,SEEK_END); fseek(fp,0,SEEK_END);
if ( block->RO.recvlen == 0 ) if ( block->RO.recvlen == 0 )
@ -673,7 +673,7 @@ int64_t iguana_bundlecalcs(struct iguana_info *coin,struct iguana_bundle *bp)
//printf("[%d:%d] len.%d\n",hdrsi,bundlei,block->RO.recvlen); //printf("[%d:%d] len.%d\n",hdrsi,bundlei,block->RO.recvlen);
} }
fclose(fp); fclose(fp);
}*/ }
//bp->blocks[bundlei] = block; //bp->blocks[bundlei] = block;
block->hdrsi = bp->hdrsi, block->bundlei = bundlei; block->hdrsi = bp->hdrsi, block->bundlei = bundlei;
if ( bp->minrequests == 0 || (block->numrequests > 0 && block->numrequests < bp->minrequests) ) if ( bp->minrequests == 0 || (block->numrequests > 0 && block->numrequests < bp->minrequests) )

8
iguana/iguana_ramchain.c

@ -254,10 +254,6 @@ int32_t iguana_peerfname(struct iguana_info *coin,int32_t *hdrsip,char *dirname,
// printf("illegal ipbits.%d\n",ipbits), getchar(); // printf("illegal ipbits.%d\n",ipbits), getchar();
if ( (bp= iguana_bundlefind(coin,&bp,&bundlei,hash2)) == 0 ) if ( (bp= iguana_bundlefind(coin,&bp,&bundlei,hash2)) == 0 )
{ {
int32_t i;
if ( (bp= coin->bundles[0]) != 0 && bp->speculative != 0 )
for (i=0; i<100; i++)
printf("(%d %d %d).%d ",bits256_nonz(bp->hashes[i]),bits256_nonz(bp->speculative[i]),bits256_cmp(bp->hashes[i],bp->speculative[i]),bits256_cmp(hash2,bp->hashes[i]));
if ( bits256_nonz(prevhash2) == 0 || (bp= iguana_bundlefind(coin,&bp,&bundlei,prevhash2)) == 0 || bundlei >= coin->chain->bundlesize-1 ) if ( bits256_nonz(prevhash2) == 0 || (bp= iguana_bundlefind(coin,&bp,&bundlei,prevhash2)) == 0 || bundlei >= coin->chain->bundlesize-1 )
{ {
printf("iguana_peerfname error finding.(%s) spec.%p bp.%p\n",bits256_str(str,hash2),bp!=0?bp->speculative:0,bp); printf("iguana_peerfname error finding.(%s) spec.%p bp.%p\n",bits256_str(str,hash2),bp!=0?bp->speculative:0,bp);
@ -269,7 +265,7 @@ int32_t iguana_peerfname(struct iguana_info *coin,int32_t *hdrsip,char *dirname,
if ( numblocks == 1 ) if ( numblocks == 1 )
{ {
if ( bits256_nonz(bp->hashes[bundlei]) != 0 ) if ( bits256_nonz(bp->hashes[bundlei]) != 0 )
sprintf(fname,"%s/%s/%d/%s_%u.%d",dirname,coin->symbol,bp->bundleheight,bits256_str(str,bp->hashes[bundlei]),ipbits!=0?ipbits:*hdrsip,bundlei); sprintf(fname,"%s/%s/%d/%s_%u.%d",dirname,coin->symbol,bp->bundleheight,bits256_str(str,bp->hashes[bundlei]),ipbits>1?ipbits:*hdrsip,bundlei);
else else
{ {
printf("no hash for [%d:%d]\n",bp->hdrsi,bundlei); printf("no hash for [%d:%d]\n",bp->hdrsi,bundlei);
@ -277,7 +273,7 @@ int32_t iguana_peerfname(struct iguana_info *coin,int32_t *hdrsip,char *dirname,
} }
} }
else if ( strcmp("DB",dirname) == 0 ) else if ( strcmp("DB",dirname) == 0 )
sprintf(fname,"%s/%s/%s_%d.%u",dirname,coin->symbol,bits256_str(str,hash2),numblocks,ipbits!=0?ipbits:*hdrsip); sprintf(fname,"%s/%s/%s_%d.%u",dirname,coin->symbol,bits256_str(str,hash2),numblocks,ipbits>1?ipbits:*hdrsip);
else sprintf(fname,"%s/%s.%u",dirname,bits256_str(str,hash2),bp->bundleheight); else sprintf(fname,"%s/%s.%u",dirname,bits256_str(str,hash2),bp->bundleheight);
OS_compatible_path(fname); OS_compatible_path(fname);
return(bundlei); return(bundlei);

Loading…
Cancel
Save