From 0bd458b88f012cefd781f288e181d257b4d748ef Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 23 Mar 2016 23:00:31 -0300 Subject: [PATCH] test --- iguana/iguana777.h | 2 +- iguana/iguana_unspents.c | 14 ++++++++++---- iguana/main.c | 3 ++- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/iguana/iguana777.h b/iguana/iguana777.h index 9004491d2..3057c64bb 100755 --- a/iguana/iguana777.h +++ b/iguana/iguana777.h @@ -797,7 +797,7 @@ int32_t iguana_Xspendmap(struct iguana_info *coin,struct iguana_ramchain *ramcha void iguana_balancesQ(struct iguana_info *coin,struct iguana_bundle *bp); int32_t iguana_balanceflush(struct iguana_info *coin,int32_t refhdrsi,int32_t purgedist); int32_t iguana_bundleissue(struct iguana_info *coin,struct iguana_bundle *bp,int32_t starti,int32_t max); -int32_t iguana_balancecalc(struct iguana_info *coin,struct iguana_bundle *bp,int32_t incremental); +int32_t iguana_balancecalc(struct iguana_info *coin,struct iguana_bundle *bp,int32_t startheight,int32_t endheight); int32_t iguana_sendblockreqPT(struct iguana_info *coin,struct iguana_peer *addr,struct iguana_bundle *bp,int32_t bundlei,bits256 hash2,int32_t iamthreadsafe); int32_t iguana_blockreq(struct iguana_info *coin,int32_t height,int32_t priority); int64_t iguana_bundlecalcs(struct iguana_info *coin,struct iguana_bundle *bp); diff --git a/iguana/iguana_unspents.c b/iguana/iguana_unspents.c index b72d8a5bc..6a0066e9d 100755 --- a/iguana/iguana_unspents.c +++ b/iguana/iguana_unspents.c @@ -20,8 +20,6 @@ int32_t iguana_utxoupdate(struct iguana_info *coin,uint16_t spent_hdrsi,uint32_t { struct iguana_hhutxo *hhutxo,*tmputxo; struct iguana_hhaccount *hhacct,*tmpacct; uint8_t buf[sizeof(spent_hdrsi) + sizeof(uint32_t)]; - printf("unexpected utxoupdate\n"); - exit(-1); if ( spent_hdrsi < 0 ) { if ( coin->utxotable != 0 ) @@ -44,6 +42,8 @@ int32_t iguana_utxoupdate(struct iguana_info *coin,uint16_t spent_hdrsi,uint32_t } return(0); } + printf("unexpected utxoupdate\n"); + exit(-1); memcpy(&buf[sizeof(uint32_t)],(void *)&spent_hdrsi,sizeof(spent_hdrsi)); memcpy(buf,(void *)&spent_unspentind,sizeof(spent_unspentind)); HASH_FIND(hh,coin->utxotable,buf,sizeof(buf),hhutxo); @@ -440,9 +440,15 @@ int32_t iguana_balancegen(struct iguana_info *coin,struct iguana_bundle *bp,int3 numtxid++; } if ( refheight < startheight ) + { + printf("balancegen: refheight.%d < startheight.%d\n",refheight,startheight); continue; + } if ( refheight > endheight ) + { + printf("balancegen: refheight.%d > endheight.%d\n",refheight,endheight); break; + } s = &S[spendind]; u = 0; unspentind = 0; @@ -803,7 +809,7 @@ int32_t iguana_balanceflush(struct iguana_info *coin,int32_t refhdrsi,int32_t pu return(coin->balanceswritten); } -int32_t iguana_balancecalc(struct iguana_info *coin,struct iguana_bundle *bp,int32_t incremental) +int32_t iguana_balancecalc(struct iguana_info *coin,struct iguana_bundle *bp,int32_t startheight,int32_t endheight) { uint32_t starttime,j,flag = 0; struct iguana_bundle *prevbp; if ( bp->balancefinish > 1 ) @@ -824,7 +830,7 @@ int32_t iguana_balancecalc(struct iguana_info *coin,struct iguana_bundle *bp,int starttime = (uint32_t)time(NULL); for (j=0; j<=bp->hdrsi; j++) iguana_allocvolatile(coin,&coin->bundles[j]->ramchain); - if ( iguana_balancegen(coin,bp,bp->bundleheight,bp->bundleheight+bp->n-1) < 0 ) + if ( iguana_balancegen(coin,bp,startheight,endheight) < 0 ) { printf("GENERATE BALANCES ERROR ht.%d\n",bp->bundleheight); exit(-1); diff --git a/iguana/main.c b/iguana/main.c index 26840841d..1c095dd44 100755 --- a/iguana/main.c +++ b/iguana/main.c @@ -358,7 +358,8 @@ void mainloop(struct supernet_info *myinfo) iguana_realtime_update(coin); if ( (ptr= queue_dequeue(&balancesQ,0)) != 0 ) { - iguana_balancecalc(ptr->coin,ptr->bp,0); + if ( ptr->coin != 0 && (bp= ptr->bp) != 0 ) + iguana_balancecalc(ptr->coin,bp,bp->bundleheight,bp->bundleheight+bp->n-1); myfree(ptr,ptr->allocsize); } }