From e06b2819c20f650f110b5cf9fddc4b4c3d4d2359 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 25 Mar 2016 22:49:38 -0300 Subject: [PATCH] test --- iguana/iguana_bundles.c | 2 +- iguana/iguana_recv.c | 9 ++++----- iguana/iguana_unspents.c | 13 ++++++++----- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/iguana/iguana_bundles.c b/iguana/iguana_bundles.c index e56ae56cc..0a4974a5f 100755 --- a/iguana/iguana_bundles.c +++ b/iguana/iguana_bundles.c @@ -415,7 +415,7 @@ int32_t iguana_bundleissue(struct iguana_info *coin,struct iguana_bundle *bp,int { for (j=0; jpeers.ranked[j]) != 0 && addr->dead == 0 && addr->usock >= 0 ) + if ( (addr= coin->peers.ranked[j]) != 0 && addr->dead == 0 && addr->usock >= 0 && addr->msgcounts.verack != 0 ) { now = (uint32_t)time(NULL); for (i=j,k=doneval=maxval=0; in&&krecvQ\n"); + int32_t newhwm = 0,hwmheight,flag = 0; + hwmheight = coin->blocks.hwmchain.height; flag += iguana_processrecvQ(coin,&newhwm); - //fprintf(stderr,"iguana_reqhdrs\n"); flag += iguana_reqhdrs(coin); - //fprintf(stderr,"iguana_reqblocks\n"); - //flag += iguana_reqblocks(coin); + if ( hwmheight != coin->blocks.hwmchain.height ) + flag = 1; return(flag); } diff --git a/iguana/iguana_unspents.c b/iguana/iguana_unspents.c index 54342d58d..378dbe852 100755 --- a/iguana/iguana_unspents.c +++ b/iguana/iguana_unspents.c @@ -856,15 +856,15 @@ void iguana_RTramchainfree(struct iguana_info *coin) void iguana_RTramchainalloc(struct iguana_info *coin,struct iguana_bundle *bp) { uint32_t i,changed = 0; struct iguana_ramchain *dest = &coin->RTramchain; struct iguana_blockRO *B; - if ( coin->RTramchain.H.data != 0 ) + if ( dest->H.data != 0 ) { i = 0; - if ( coin->RTheight != bp->bundleheight + coin->RTramchain.H.data->numblocks ) + if ( coin->RTheight != bp->bundleheight + dest->H.data->numblocks ) changed++; else { - B = (void *)(long)((long)coin->RTramchain.H.data + coin->RTramchain.H.data->Boffset); - for (i=0; iRTramchain.H.data->numblocks; i++) + B = (void *)(long)((long)dest->H.data + dest->H.data->Boffset); + for (i=0; iH.data->numblocks; i++) if ( bits256_cmp(B[i].hash2,bp->hashes[i]) != 0 ) { char str[65],str2[65]; printf("mismatched hash2 at %d %s vs %s\n",bp->bundleheight+i,bits256_str(str,B[i].hash2),bits256_str(str2,bp->hashes[i])); @@ -874,7 +874,7 @@ void iguana_RTramchainalloc(struct iguana_info *coin,struct iguana_bundle *bp) } if ( changed != 0 ) { - printf("RTramchain changed %d bundlei.%d | coin->RTheight %d != %d bp->bundleheight + %d coin->RTramchain.H.data->numblocks\n",coin->RTheight,i,coin->RTheight,bp->bundleheight, coin->RTramchain.H.data->numblocks); + printf("RTramchain changed %d bundlei.%d | coin->RTheight %d != %d bp->bundleheight + %d coin->RTramchain.H.data->numblocks\n",coin->RTheight,i,coin->RTheight,bp->bundleheight,dest->H.data->numblocks); //coin->RTheight = coin->balanceswritten * coin->chain->bundlesize; iguana_RTramchainfree(coin); } @@ -886,6 +886,7 @@ void iguana_RTramchainalloc(struct iguana_info *coin,struct iguana_bundle *bp) dest->H.txidind = dest->H.unspentind = dest->H.spendind = dest->pkind = dest->H.data->firsti; dest->externalind = dest->H.stacksize = 0; dest->H.scriptoffset = 1; + printf("ALLOC RTramchain %p\n"); } } @@ -897,6 +898,7 @@ int32_t iguana_realtime_update(struct iguana_info *coin) if ( (bp= coin->current) != 0 && bp->hdrsi == coin->longestchain/coin->chain->bundlesize && bp->hdrsi == coin->balanceswritten && coin->RTheight >= bp->bundleheight && coin->RTheight < bp->bundleheight+bp->n ) { iguana_RTramchainalloc(coin,bp); + printf("RTheight.%d rdata.%p\n",coin->RTheight,dest->H.data); while ( (rdata= coin->RTramchain.H.data) != 0 && coin->RTheight <= coin->blocks.hwmchain.height) { dest = &coin->RTramchain; @@ -929,6 +931,7 @@ int32_t iguana_realtime_update(struct iguana_info *coin) flag++; if ( iguana_RTutxo(coin,bp,dest,bundlei) < 0 ) { + printf("RTutxo error -> RTramchainfree\n"); iguana_RTramchainfree(coin); return(-1); }