diff --git a/iguana/iguana_unspents.c b/iguana/iguana_unspents.c index dcc1bb206..d8650584f 100755 --- a/iguana/iguana_unspents.c +++ b/iguana/iguana_unspents.c @@ -218,10 +218,16 @@ int64_t iguana_pkhashbalance(struct supernet_info *myinfo,struct iguana_info *co unspents[*nump << 1] = ((uint64_t)hdrsi << 32) | unspentind; unspents[(*nump << 1) + 1] = U[unspentind].value; } + printf("%.8f ",dstr(U[unspentind].value)); (*nump)++; if ( array != 0 ) jaddi(array,iguana_unspentjson(myinfo,coin,hdrsi,unspentind,T,&U[unspentind],rmd160,coinaddr,pubkey33)); - } else spent += U[unspentind].value; + } + else + { + printf("-%.8f ",dstr(U[unspentind].value)); + spent += U[unspentind].value; + } if ( p->pkind != U[unspentind].pkind ) printf("warning: [%d] p->pkind.%u vs U->pkind.%u for u%d\n",hdrsi,p->pkind,U[unspentind].pkind,unspentind); } @@ -240,7 +246,7 @@ int64_t iguana_pkhashbalance(struct supernet_info *myinfo,struct iguana_info *co if ( uheight < lastheight ) { checkval += U[unspentind].value; - //printf("u%u %.8f spentflag.%d prev.%u fromheight.%d\n",unspentind,dstr(U[unspentind].value),U2[unspentind].spentflag,U2[unspentind].prevunspentind,U2[unspentind].fromheight); + printf("u%u %.8f spentflag.%d prev.%u fromheight.%d\n",unspentind,dstr(U[unspentind].value),U2[unspentind].spentflag,U2[unspentind].prevunspentind,U2[unspentind].fromheight); } unspentind = U2[unspentind].prevunspentind; } @@ -269,7 +275,7 @@ int32_t iguana_pkhasharray(struct supernet_info *myinfo,struct iguana_info *coin { if ( (bp= coin->bundles[i]) == 0 ) continue; - if ( lastheight > 0 && bp->bundleheight > lastheight ) + if ( lastheight > 0 && bp->bundleheight+bp->n > lastheight ) break; if ( (coin->blocks.hwmchain.height - (bp->bundleheight + bp->n - 1)) > maxconf ) continue; @@ -285,13 +291,16 @@ int32_t iguana_pkhasharray(struct supernet_info *myinfo,struct iguana_info *coin } else { - //printf("%s pkhash balance.[%d] from m.%d check %.8f vs %.8f spent %.8f [%.8f]\n",coinaddr,i,m,dstr(netbalance),dstr(deposits),dstr(spent),dstr(deposits)-dstr(spent)); + printf("%s pkhash balance.[%d] from m.%d check %.8f vs %.8f spent %.8f [%.8f]\n",coinaddr,i,m,dstr(netbalance),dstr(deposits),dstr(spent),dstr(deposits)-dstr(spent)); total += netbalance; n++; } - maxunspents -= m; - if ( maxunspents <= 0 ) - break; + if ( maxunspents > 0 ) + { + maxunspents -= m; + if ( maxunspents <= 0 ) + break; + } numunspents += m; //printf("%d: balance %.8f, lastunspent.%u m.%d num.%d max.%d\n",i,dstr(total),lastunspentind,m,numunspents,maxunspents); } diff --git a/iguana/tests/listunspentB b/iguana/tests/listunspentB new file mode 100755 index 000000000..e7fbcc744 --- /dev/null +++ b/iguana/tests/listunspentB @@ -0,0 +1 @@ +curl --url "http://127.0.0.1:7778" --data "{\"method\":\"listunspent\",\"params\":[1, 9999999, [\"RVQV5spiARDTqfwBCxstWnMbrT6Q8mhRYz\"]]}"