Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
a028453c81
  1. 7
      iguana/iguana_unspents.c

7
iguana/iguana_unspents.c

@ -275,7 +275,6 @@ int32_t iguana_spentflag(struct iguana_info *coin,int64_t *RTspendp,int32_t *spe
*spentheightp = 0; *spentheightp = 0;
numunspents = ramchain->H.data->numunspents; numunspents = ramchain->H.data->numunspents;
memset(&utxo,0,sizeof(utxo)); memset(&utxo,0,sizeof(utxo));
*RTspendp = 0;
val = ((uint64_t)spent_hdrsi << 32) | spent_unspentind; val = ((uint64_t)spent_hdrsi << 32) | spent_unspentind;
if ( spent_unspentind != 0 && spent_unspentind < numunspents ) 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; utxo = hhutxo->u;
if ( utxo.spentflag != 0 ) 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; *depositsp = ACCTS[pkind].total;
*lastunspentindp = ACCTS[pkind].lastunspentind; *lastunspentindp = ACCTS[pkind].lastunspentind;
*p = P[pkind]; *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); return(p);
} }
else if ( pkind != 0 ) else if ( pkind != 0 )
@ -860,6 +859,7 @@ int64_t iguana_pkhashbalance(struct iguana_info *coin,cJSON *array,int64_t *spen
unspentind = lastunspentind; unspentind = lastunspentind;
U = (void *)(long)((long)rdata + rdata->Uoffset); U = (void *)(long)((long)rdata + rdata->Uoffset);
T = (void *)(long)((long)rdata + rdata->Toffset); T = (void *)(long)((long)rdata + rdata->Toffset);
RTspend = 0;
while ( unspentind > 0 ) while ( unspentind > 0 )
{ {
(*nump)++; (*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)); 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; (*spentp) = spent;
printf("spent %.8f, RTspent %.8f deposits %.8f\n",dstr(spent),dstr(RTspend),dstr(deposits));
return(deposits - spent); return(deposits - spent);
} }

Loading…
Cancel
Save