diff --git a/iguana/iguana_unspents.c b/iguana/iguana_unspents.c index 86074879b..9dcf38816 100755 --- a/iguana/iguana_unspents.c +++ b/iguana/iguana_unspents.c @@ -275,7 +275,6 @@ int32_t iguana_spentflag(struct iguana_info *coin,int64_t *RTspendp,int32_t *spe *spentheightp = 0; numunspents = ramchain->H.data->numunspents; memset(&utxo,0,sizeof(utxo)); - *RTspendp = 0; val = ((uint64_t)spent_hdrsi << 32) | spent_unspentind; if ( spent_unspentind != 0 && spent_unspentind < numunspents ) { @@ -288,7 +287,7 @@ int32_t iguana_spentflag(struct iguana_info *coin,int64_t *RTspendp,int32_t *spe { utxo = hhutxo->u; if ( utxo.spentflag != 0 ) - *RTspendp = amount; + (*RTspendp) += amount; } } } @@ -803,7 +802,7 @@ struct iguana_pkhash *iguana_pkhashfind(struct iguana_info *coin,struct iguana_r *depositsp = ACCTS[pkind].total; *lastunspentindp = ACCTS[pkind].lastunspentind; *p = P[pkind]; - //printf("return pkind.%u %.8f\n",pkind,dstr(*balancep)); + printf("[%d] return pkind.%u %.8f\n",i,pkind,dstr(*depositsp)); return(p); } else if ( pkind != 0 ) @@ -860,6 +859,7 @@ int64_t iguana_pkhashbalance(struct iguana_info *coin,cJSON *array,int64_t *spen unspentind = lastunspentind; U = (void *)(long)((long)rdata + rdata->Uoffset); T = (void *)(long)((long)rdata + rdata->Toffset); + RTspend = 0; while ( unspentind > 0 ) { (*nump)++; @@ -889,6 +889,7 @@ int64_t iguana_pkhashbalance(struct iguana_info *coin,cJSON *array,int64_t *spen printf("spend checkerr: [%d] deposits %.8f spent %.8f check %.8f (%.8f) vs A2[%u] %.8f\n",hdrsi,dstr(deposits),dstr(spent),dstr(checkval)+dstr(RTspend),dstr(*spentp),pkind,dstr(A2[pkind].total)); } (*spentp) = spent; + printf("spent %.8f, RTspent %.8f deposits %.8f\n",dstr(spent),dstr(RTspend),dstr(deposits)); return(deposits - spent); }