From 7c10f153b7e5059b92a7b86aff22b1a7d72dd949 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 8 Apr 2016 03:11:11 -0500 Subject: [PATCH] test --- iguana/iguana_blocks.c | 14 +++++++------- iguana/iguana_recv.c | 2 +- iguana/iguana_unspents.c | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/iguana/iguana_blocks.c b/iguana/iguana_blocks.c index dcbca51c8..d23058079 100755 --- a/iguana/iguana_blocks.c +++ b/iguana/iguana_blocks.c @@ -297,20 +297,20 @@ int32_t iguana_walkchain(struct iguana_info *coin) { char str[65]; int32_t height,hdrsi,bundlei,n = 0; struct iguana_bundle *bp; struct iguana_block *block; height = coin->blocks.hwmchain.height; - while ( (block= iguana_blockfind("main",coin,iguana_blockhash(coin,height))) != 0 ) + while ( 1 ) //(block= iguana_blockfind("main",coin,iguana_blockhash(coin,height))) != 0 ) { hdrsi = (height / coin->chain->bundlesize); bundlei = (height % coin->chain->bundlesize); - if ( block->height >= 0 && block->height != height ) - printf("walkchain height mismatch %d vs %d\n",block->height,height); - if ( bits256_cmp(iguana_blockhash(coin,height),block->RO.hash2) != 0 ) + if ( (bp= coin->bundles[hdrsi]) == 0 || (block= bp->blocks[bundlei]) == 0 ) { - printf("walk error blockhash error at %d %s\n",height,bits256_str(str,block->RO.hash2)); + printf("walk error [%d:%d] %p vs %p\n",hdrsi,bundlei,block,bp->blocks[bundlei]); break; } - else if ( (bp= coin->bundles[hdrsi]) == 0 || block != bp->blocks[bundlei] ) + else if ( block->height >= 0 && block->height != height ) + printf("walkchain height mismatch %d vs %d\n",block->height,height); + if ( bits256_cmp(iguana_blockhash(coin,height),block->RO.hash2) != 0 ) { - printf("walk error [%d:%d] %p vs %p\n",hdrsi,bundlei,block,bp->blocks[bundlei]); + printf("walk error blockhash error at %d %s\n",height,bits256_str(str,block->RO.hash2)); break; } else if ( bits256_cmp(bp->hashes[bundlei],block->RO.hash2) != 0 ) diff --git a/iguana/iguana_recv.c b/iguana/iguana_recv.c index b08336a6e..efc08beee 100755 --- a/iguana/iguana_recv.c +++ b/iguana/iguana_recv.c @@ -1157,7 +1157,7 @@ int32_t iguana_reqblocks(struct iguana_info *coin) iguana_blockQ("mainchain",coin,0,-1,hash2,1);//lag > threshold); flag++; char str[65]; - if ( 1 && (rand() % 10000) == 0 )//|| bp->bundleheight > coin->longestchain-coin->chain->bundlesize ) + if ( 1 && (rand() % 100000) == 0 )//|| bp->bundleheight > coin->longestchain-coin->chain->bundlesize ) printf("%s %s MAIN.%d t %.3f lag %.3f\n",coin->symbol,bits256_str(str,hash2),coin->blocks.hwmchain.height+1,threshold,lag); } if ( 0 && bp != 0 && bundlei < bp->n-1 && (bits256_nonz(bp->hashes[bundlei+1]) != 0 || (bp->speculative != 0 && bits256_nonz(bp->speculative[bundlei+1]) != 0)) ) diff --git a/iguana/iguana_unspents.c b/iguana/iguana_unspents.c index 7e4e6e022..e30a3d268 100755 --- a/iguana/iguana_unspents.c +++ b/iguana/iguana_unspents.c @@ -1851,8 +1851,8 @@ int32_t iguana_realtime_update(struct iguana_info *coin) { for (i=bundlei; in; i++) { - block = iguana_bundleblock(coin,&hash2,bp,bundlei+i); - if ( i == 0 || (bits256_nonz(hash2) != 0 && (block == 0 || block->txvalid == 0)) ) + block = iguana_bundleblock(coin,&hash2,bp,i); + if ( bits256_nonz(hash2) != 0 && (block == 0 || block->txvalid == 0) ) { uint8_t serialized[512]; int32_t len; struct iguana_peer *addr; char str[65]; printf("RT error [%d:%d] %s %p\n",bp->hdrsi,i,bits256_str(str,hash2),block);