Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
5b701028cd
  1. 17
      iguana/iguana_unspents.c
  2. 1
      iguana/tests/listunspentB

17
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] = ((uint64_t)hdrsi << 32) | unspentind;
unspents[(*nump << 1) + 1] = U[unspentind].value; unspents[(*nump << 1) + 1] = U[unspentind].value;
} }
printf("%.8f ",dstr(U[unspentind].value));
(*nump)++; (*nump)++;
if ( array != 0 ) if ( array != 0 )
jaddi(array,iguana_unspentjson(myinfo,coin,hdrsi,unspentind,T,&U[unspentind],rmd160,coinaddr,pubkey33)); 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 ) 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); 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 ) if ( uheight < lastheight )
{ {
checkval += U[unspentind].value; 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; 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 ) if ( (bp= coin->bundles[i]) == 0 )
continue; continue;
if ( lastheight > 0 && bp->bundleheight > lastheight ) if ( lastheight > 0 && bp->bundleheight+bp->n > lastheight )
break; break;
if ( (coin->blocks.hwmchain.height - (bp->bundleheight + bp->n - 1)) > maxconf ) if ( (coin->blocks.hwmchain.height - (bp->bundleheight + bp->n - 1)) > maxconf )
continue; continue;
@ -285,13 +291,16 @@ int32_t iguana_pkhasharray(struct supernet_info *myinfo,struct iguana_info *coin
} }
else 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; total += netbalance;
n++; n++;
} }
if ( maxunspents > 0 )
{
maxunspents -= m; maxunspents -= m;
if ( maxunspents <= 0 ) if ( maxunspents <= 0 )
break; break;
}
numunspents += m; numunspents += m;
//printf("%d: balance %.8f, lastunspent.%u m.%d num.%d max.%d\n",i,dstr(total),lastunspentind,m,numunspents,maxunspents); //printf("%d: balance %.8f, lastunspent.%u m.%d num.%d max.%d\n",i,dstr(total),lastunspentind,m,numunspents,maxunspents);
} }

1
iguana/tests/listunspentB

@ -0,0 +1 @@
curl --url "http://127.0.0.1:7778" --data "{\"method\":\"listunspent\",\"params\":[1, 9999999, [\"RVQV5spiARDTqfwBCxstWnMbrT6Q8mhRYz\"]]}"
Loading…
Cancel
Save