Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
c9644aa745
  1. 22
      iguana/iguana_blocks.c
  2. 33
      iguana/iguana_bundles.c
  3. 1
      iguana/iguana_ramchain.c
  4. 2
      iguana/iguana_unspents.c

22
iguana/iguana_blocks.c

@ -318,8 +318,18 @@ int32_t iguana_walkchain(struct iguana_info *coin)
printf("walk error [%d:%d] vs [%d:%d]\n",hdrsi,bundlei,block->hdrsi,block->bundlei);
break;
}
n++;
height--;
if ( (height % coin->chain->bundlesize) == 0 )
{
if ( bp->ramchain.H.data == 0 )
printf("NULL RAMCHAIN.[%d]\n",bp->hdrsi);
n += coin->chain->bundlesize;
height -= coin->chain->bundlesize;
}
else
{
n++;
height--;
}
}
printf("walkd n.%d hwm.%d %s\n",n,coin->blocks.hwmchain.height,bits256_str(str,coin->blocks.hwmchain.RO.hash2));
return(n);
@ -397,8 +407,11 @@ struct iguana_block *_iguana_chainlink(struct iguana_info *coin,struct iguana_bl
else str2[0] = 0;
if ( block->height+1 > coin->longestchain )
coin->longestchain = block->height+1;
if ( 0 && (block->height % 1000) == 0 )
printf("EXTENDMAIN %s %d <- (%s) n.%u max.%u PoW %f numtx.%d valid.%d\n",str,block->height,str2,hwmchain->height+1,coin->blocks.maxblocks,block->PoW,block->RO.txn_count,block->valid);
if ( 1 && (block->height % 1000) == 0 )
{
//printf("EXTENDMAIN %s %d <- (%s) n.%u max.%u PoW %f numtx.%d valid.%d\n",str,block->height,str2,hwmchain->height+1,coin->blocks.maxblocks,block->PoW,block->RO.txn_count,block->valid);
iguana_walkchain(coin);
}
struct iguana_bundle *bp; int32_t hdrsi;
if ( (block->height % coin->chain->bundlesize) == 0 )
{
@ -444,7 +457,6 @@ struct iguana_block *_iguana_chainlink(struct iguana_info *coin,struct iguana_bl
//iguana_blockQ("mainchain",coin,bp,block->height % coin->chain->bundlesize,block->RO.hash2,0);
}
block->mainchain = 1;
iguana_walkchain(coin);
return(block);
}
}

33
iguana/iguana_bundles.c

@ -475,7 +475,7 @@ int32_t iguana_blocksmissing(struct iguana_info *coin,int32_t *nonzp,uint8_t mis
if ( lag > IGUANA_DEFAULTLAG )
lag = IGUANA_DEFAULTLAG * 8;
memset(missings,0,IGUANA_MAXBUNDLESIZE/8+1);
if ( bp->emitfinish == 0 )
//if ( bp->emitfinish == 0 )
{
for (i=0; i<bp->n; i++)
{
@ -486,9 +486,9 @@ int32_t iguana_blocksmissing(struct iguana_info *coin,int32_t *nonzp,uint8_t mis
}
if ( (block= iguana_bundleblock(coin,&hash2,bp,i)) != 0 )
{
if ( block->txvalid != 0 || block->fpos < 0 || block->fpipbits != 0 || block->RO.recvlen != 0 )
if ( block->txvalid != 0 && block->fpos >= 0 && block->fpipbits != 0 )//block->RO.recvlen != 0 )
{
//printf("[%d:%d].block ",bp->hdrsi,i);
//printf("[%d:%d].have ",bp->hdrsi,i);
continue;
}
}
@ -773,21 +773,26 @@ int64_t iguana_bundlecalcs(struct iguana_info *coin,struct iguana_bundle *bp,int
if ( bits256_nonz(bp->hashes[bundlei]) > 0 )
{
numhashes++;
if ( (block= bp->blocks[bundlei]) != 0 && bits256_cmp(block->RO.hash2,bp->hashes[bundlei]) == 0 )
if ( (block= bp->blocks[bundlei]) != 0 )
{
//if ( bp->minrequests == 0 || (block->numrequests > 0 && block->numrequests < bp->minrequests) )
// bp->minrequests = block->numrequests;
if ( block->fpipbits != 0 && block->fpos >= 0 )
numsaved++;
if ( block->RO.recvlen != 0 )
if ( bits256_cmp(block->RO.hash2,bp->hashes[bundlei]) == 0 )
{
numrecv++;
datasize += block->RO.recvlen;
}
}
//if ( bp->minrequests == 0 || (block->numrequests > 0 && block->numrequests < bp->minrequests) )
// bp->minrequests = block->numrequests;
if ( block->txvalid != 0 && block->fpipbits != 0 && block->fpos >= 0 )
numsaved++;
if ( block->RO.recvlen != 0 )
{
numrecv++;
datasize += block->RO.recvlen;
}
} else printf("hash mismatch [%d:%d]\n",bp->hdrsi,bundlei);
} else printf("[null %d:%d] ",bp->hdrsi,bundlei);
}
}
bp->numcached = bp->n - iguana_blocksmissing(coin,&avail,missings,0,1.,bp,0);
bp->numcached = bp->n - iguana_blocksmissing(coin,&avail,missings,0,0,bp,0);
if ( 0 && bp->numcached != numsaved )
printf("[%d] emit.%u ramchain.%p numcached.%d vs numsaved.%d numhashes.%d\n",bp->hdrsi,bp->emitfinish,bp->ramchain.H.data,bp->numcached,numsaved,numhashes);
bp->datasize = datasize;
bp->numhashes = numhashes;
bp->numsaved = numsaved;

1
iguana/iguana_ramchain.c

@ -2181,6 +2181,7 @@ struct iguana_ramchain *iguana_bundleload(struct iguana_info *coin,struct iguana
if ( (block= bp->blocks[i]) != 0 || (block= iguana_blockhashset("bundleload",coin,bp->bundleheight+i,bp->hashes[i],1)) != 0 )
{
block->queued = 1;
block->txvalid = 1;
block->height = bp->bundleheight + i;
block->hdrsi = bp->hdrsi;
block->bundlei = i;

2
iguana/iguana_unspents.c

@ -1932,7 +1932,7 @@ int32_t iguana_realtime_update(struct iguana_info *coin)
B = (void *)(long)((long)rdata + rdata->Boffset);
bundlei = (coin->RTheight % coin->chain->bundlesize);
block = iguana_bundleblock(coin,&hash2,bp,bundlei);
char str[65]; printf("RT.%d vs hwm.%d starti.%d bp->n %d block.%p/%p prev %s\n",coin->RTheight,coin->blocks.hwmchain.height,coin->RTstarti,bp->n,block,bp->blocks[bundlei],bits256_str(str,block->RO.prev_block));
printf("RT.%d vs hwm.%d starti.%d bp->n %d block.%p/%p ramchain.%p\n",coin->RTheight,coin->blocks.hwmchain.height,coin->RTstarti,bp->n,block,bp->blocks[bundlei],dest->H.data);
if ( block != 0 && bits256_nonz(block->RO.prev_block) != 0 )
{
iguana_blocksetcounters(coin,block,dest);

Loading…
Cancel
Save