Browse Source

test

release/v0.1
jl777 8 years ago
parent
commit
17bed86b8b
  1. 22
      iguana/iguana_blocks.c
  2. 11
      iguana/iguana_realtime.c

22
iguana/iguana_blocks.c

@ -653,7 +653,8 @@ struct iguana_block *_iguana_chainlink(struct supernet_info *myinfo,struct iguan
//iguana_walkchain(coin);
}
struct iguana_bundle *bp; int32_t hdrsi;
if ( (block->height % coin->chain->bundlesize) == 0 )
bundlei = (block->height % coin->chain->bundlesize);
if ( bundlei == 0 )
{
if ( (hdrsi= block->height/coin->chain->bundlesize) < coin->bundlescount )
{
@ -674,16 +675,19 @@ struct iguana_block *_iguana_chainlink(struct supernet_info *myinfo,struct iguan
{
if ( (bp= coin->bundles[block->height / coin->chain->bundlesize]) != 0 )
{
if ( memcmp(bp->hashes[block->height % coin->chain->bundlesize].bytes,block->RO.hash2.bytes,sizeof(bits256)) != 0 || block != bp->blocks[block->height % coin->chain->bundlesize] )
if ( memcmp(bp->hashes[bundlei].bytes,block->RO.hash2.bytes,sizeof(bits256)) != 0 || block != bp->blocks[bundlei] )
{
if ( bits256_nonz(bp->hashes[block->height % coin->chain->bundlesize]) != 0 )
if ( bits256_nonz(bp->hashes[bundlei]) != 0 )
{
if ( bp->blocks[block->height % coin->chain->bundlesize] == 0 && block != 0 )
bp->blocks[block->height % coin->chain->bundlesize] = block;
if ( bp->blocks[bundlei] == 0 && block != 0 )
bp->blocks[bundlei] = block;
else
{
char str[65],str2[65];
printf("ERROR: need to fix up bundle for height.%d (%p %p) (%s %s)\n",block->height,block,bp->blocks[block->height % coin->chain->bundlesize],bits256_str(str,block->RO.hash2),bits256_str(str2,bp->hashes[block->height % coin->chain->bundlesize]));
printf("ERROR: need to fix up bundle for height.%d (%p %p) (%s %s)\n",block->height,block,bp->blocks[bundlei],bits256_str(str,block->RO.hash2),bits256_str(str2,bp->hashes[bundlei]));
bp->blocks[bundlei] = block;
bp->hashes[bundlei] = block->RO.hash2;
//if ( bp == coin->current && coin->RTheight > 0 )
// coin->RTdatabad = 1;
//iguana_bundleremove(coin,bp->hdrsi,0);
@ -691,10 +695,10 @@ struct iguana_block *_iguana_chainlink(struct supernet_info *myinfo,struct iguan
//getchar();
}
}
iguana_blockunmark(coin,block,bp,block->height % coin->chain->bundlesize,0);
iguana_bundlehash2add(coin,0,bp,block->height % coin->chain->bundlesize,block->RO.hash2);
iguana_blockunmark(coin,block,bp,bundlei,0);
iguana_bundlehash2add(coin,0,bp,bundlei,block->RO.hash2);
}
if ( coin->started != 0 && (block->height % coin->chain->bundlesize) == coin->minconfirms && (block->height > coin->longestchain-coin->chain->bundlesize*2 || ((block->height / coin->chain->bundlesize) % 100) == 9) )
if ( coin->started != 0 && bundlei == coin->minconfirms && (block->height > coin->longestchain-coin->chain->bundlesize*2 || ((block->height / coin->chain->bundlesize) % 100) == 9) )
{
//printf("savehdrs.[%d] ht.%d\n",bp->hdrsi,block->height);
iguana_savehdrs(coin);

11
iguana/iguana_realtime.c

@ -153,7 +153,7 @@ void iguana_RTcoinaddr(struct iguana_info *coin,struct iguana_RTtxid *RTptr,stru
coin->RTcredits += polarity * value;
if ( polarity > 0 )
{
//printf("unspent[%d] <- %p\n",RTaddr->numunspents,unspent);
printf("lastunspent[%d] <- %p\n",RTaddr->numunspents,unspent);
RTaddr->numunspents++;
unspent->prevunspent = RTaddr->lastunspent;
RTaddr->lastunspent = unspent;
@ -214,7 +214,12 @@ void iguana_RTunspent(struct iguana_info *coin,struct iguana_RTtxid *RTptr,struc
}
}
if ( (unspent->spend == 0 && polarity < 0) || (unspent->spend != 0 && polarity > 0) )
printf("unspent spend.%p opposite when polarity.%lld\n",unspent->spend,(long long)polarity);
{
if ( unspent->parent != 0 )
bits256_str(str,unspent->parent->txid);
else str[0] = 0;
printf("unspent spend.%p opposite when polarity.%lld %s/v%d\n",unspent->spend,(long long)polarity,str,unspent->vout);
}
iguana_RTcoinaddr(coin,RTptr,block,polarity,coinaddr,unspent->rmd160,0,value,unspent);
if ( polarity < 0 )
RTptr->unspents[vout] = 0;
@ -799,7 +804,7 @@ void iguana_RTnewblock(struct supernet_info *myinfo,struct iguana_info *coin,str
printf("iguana_RTnewblock illegal blockheight.%d\n",block->height);
return;
}
if ( block != 0 && coin->RTheight > 0 && coin->RTheight <= coin->blocks.hwmchain.height )
if ( block != 0 && coin->RTheight > 0 )//&& coin->RTheight <= coin->blocks.hwmchain.height )
{
portable_mutex_lock(&coin->RTmutex);
if ( block->height > coin->lastRTheight )

Loading…
Cancel
Save