From 4c93b55ffa2fb150bdfe27423cba69c0e1584a20 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 25 Mar 2016 16:13:16 -0300 Subject: [PATCH] test --- iguana/iguana777.h | 2 +- iguana/iguana_bundles.c | 2 +- iguana/iguana_unspents.c | 19 ++++++++++++++++--- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/iguana/iguana777.h b/iguana/iguana777.h index d581cb2bc..ec0b9e360 100755 --- a/iguana/iguana777.h +++ b/iguana/iguana777.h @@ -23,7 +23,7 @@ typedef int32_t (*blockhashfunc)(uint8_t *blockhashp,uint8_t *serialized,int32_t len); #define IGUANA_MAXSCRIPTSIZE 10001 -//#define IGUANA_SERIALIZE_BALANCEGEN +#define IGUANA_SERIALIZE_BALANCEGEN //#define IGUANA_DISABLEPEERS #define IGUANA_MAXCOINS 64 diff --git a/iguana/iguana_bundles.c b/iguana/iguana_bundles.c index bee5113f2..824ed9a57 100755 --- a/iguana/iguana_bundles.c +++ b/iguana/iguana_bundles.c @@ -769,7 +769,7 @@ int64_t iguana_bundlecalcs(struct iguana_info *coin,struct iguana_bundle *bp) int32_t iguana_bundlefinish(struct iguana_info *coin,struct iguana_bundle *bp) { struct iguana_bundle *prevbp; int32_t i,retval; -#ifndef IGUANA_SERIALIZE_BALANCEGEN +#ifndef IGUANA_SERIALIZE_SPENDVECTORGEN if ( coin->MAXMEM <= 4*(1024L * 1024 * 1024) ) #endif { diff --git a/iguana/iguana_unspents.c b/iguana/iguana_unspents.c index fbad8b85e..cd6e635db 100755 --- a/iguana/iguana_unspents.c +++ b/iguana/iguana_unspents.c @@ -1079,7 +1079,7 @@ int32_t iguana_balanceflush(struct iguana_info *coin,int32_t refhdrsi,int32_t pu 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; + uint32_t starttime,j=0,flag = 0; struct iguana_bundle *prevbp; if ( bp->balancefinish > 1 ) { printf("make sure DB files have this bp.%d\n",bp->hdrsi); @@ -1088,10 +1088,23 @@ int32_t iguana_balancecalc(struct iguana_info *coin,struct iguana_bundle *bp,int } if ( bp != 0 && coin != 0 && (bp->hdrsi == 0 || (prevbp= coin->bundles[bp->hdrsi-1]) != 0) ) { - for (j=0; jhdrsi; j++) +#ifdef IGUANA_SERIALIZE_BALANCEGEN + for (j=0; jbundlescount; j++) { - if ( (prevbp= coin->bundles[j]) == 0 || prevbp->utxofinish <= 1 || prevbp->balancefinish <= 1 ) + if ( (prevbp= coin->bundles[j]) == 0 || prevbp->utxofinish <= 1 ) + { + j = -1; break; + } + } +#endif + if ( j == 0 ) + { + for (; jhdrsi; j++) + { + if ( (prevbp= coin->bundles[j]) == 0 || prevbp->utxofinish <= 1 || prevbp->balancefinish <= 1 ) + break; + } } if ( bp->utxofinish > 1 && bp->balancefinish <= 1 && bp->hdrsi == j ) {