From 31816cf8499fae4b644a12f25800af9261b6d3a7 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 13 Jan 2016 22:50:26 -0300 Subject: [PATCH] test --- iguana/iguana_blocks.c | 6 +++--- iguana/iguana_bundles.c | 13 +++++++++---- iguana/iguana_recv.c | 1 + iguana/main.c | 2 +- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/iguana/iguana_blocks.c b/iguana/iguana_blocks.c index 4232edfbc..47ae078ce 100755 --- a/iguana/iguana_blocks.c +++ b/iguana/iguana_blocks.c @@ -56,11 +56,11 @@ struct iguana_block *iguana_blockhashset(struct iguana_info *coin,int32_t height return(0); } depth++; - //portable_mutex_lock(&coin->blocks_mutex); + portable_mutex_lock(&coin->blocks_mutex); HASH_FIND(hh,coin->blocks.hash,&hash2,sizeof(hash2),block); if ( block != 0 ) { - //portable_mutex_unlock(&coin->blocks_mutex); + portable_mutex_unlock(&coin->blocks_mutex); depth--; return(block); } @@ -88,7 +88,7 @@ struct iguana_block *iguana_blockhashset(struct iguana_info *coin,int32_t height printf("%s height.%d search error %p != %p\n",str,height,block,tmp); } } - //portable_mutex_unlock(&coin->blocks_mutex); + portable_mutex_unlock(&coin->blocks_mutex); depth--; return(block); } diff --git a/iguana/iguana_bundles.c b/iguana/iguana_bundles.c index 2f48d7844..21a087352 100755 --- a/iguana/iguana_bundles.c +++ b/iguana/iguana_bundles.c @@ -275,11 +275,16 @@ struct iguana_bundle *iguana_bundlecreate(struct iguana_info *coin,int32_t *bund bits256_str(str,bundlehash2); if ( iguana_bundlefind(coin,&bp,bundleip,bundlehash2) != 0 ) { - if ( bits256_nonz(bp->allhash) == 0 ) - bp->allhash = allhash; if ( bp->bundleheight >= 0 && bp->bundleheight != (bundleheight - *bundleip) ) + { printf("bundlecreate warning: bp->bundleheight %d != %d (bundleheight %d - %d bundlei)\n",bp->bundleheight,(bundleheight - *bundleip),bundleheight,*bundleip); - return(bp); + return(bp); + } + else if ( bits256_nonz(bp->allhash) == 0 ) + { + bp->allhash = allhash; + return(bp); + } } bp = mycalloc('b',1,sizeof(*bp)); bp->n = coin->chain->bundlesize; @@ -295,7 +300,7 @@ struct iguana_bundle *iguana_bundlecreate(struct iguana_info *coin,int32_t *bund if ( coin->bundlescount > 0 ) coin->bundles[coin->bundlescount-1]->nextbp = bp; *bundleip = 0; - printf("ht.%d alloc.[%d] new hdrs.%s %s\n",bp->bundleheight,coin->bundlescount,str,bits256_str(str2,allhash)); + printf("ht.%d alloc.[%d] new hdrs.%s %s\n",bp->bundleheight,coin->bundlescount,bits256_str(str,bundlehash2),bits256_str(str2,allhash)); iguana_bundlehash2add(coin,0,bp,0,bundlehash2); if ( issueflag != 0 ) { diff --git a/iguana/iguana_recv.c b/iguana/iguana_recv.c index de8623fb9..5c685a5b1 100755 --- a/iguana/iguana_recv.c +++ b/iguana/iguana_recv.c @@ -292,6 +292,7 @@ uint32_t iguana_allhashcmp(struct iguana_info *coin,struct iguana_bundle *bp,bit block->mainchain = 1; if ( prev != 0 ) { + //block->RO.prev_block = prev->RO.hash2; prev->hh.next = block; block->hh.prev = prev; } diff --git a/iguana/main.c b/iguana/main.c index 411ddc7da..708eecf59 100644 --- a/iguana/main.c +++ b/iguana/main.c @@ -37,7 +37,7 @@ static int32_t initflag; #ifdef __linux__ int32_t IGUANA_NUMHELPERS = 8; #else -int32_t IGUANA_NUMHELPERS = 4; +int32_t IGUANA_NUMHELPERS = 1; #endif char *hash_parser(struct supernet_info *myinfo,char *hashname,cJSON *json,char *remoteaddr)