Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
ccc5d621c1
  1. 10
      iguana/iguana777.c
  2. 8
      iguana/iguana_realtime.c
  3. 10
      iguana/iguana_unspents.c

10
iguana/iguana777.c

@ -415,7 +415,7 @@ int32_t iguana_helperB(struct iguana_info *coin,int32_t helperid,struct iguana_b
void iguana_update_balances(struct iguana_info *coin) void iguana_update_balances(struct iguana_info *coin)
{ {
int32_t i,hdrsi,max; struct iguana_bundle *bp; int32_t i,hdrsi,max; struct iguana_bundle *bp; char fname[1024];
max = coin->bundlescount; max = coin->bundlescount;
if ( coin->bundles[max-1] != 0 && coin->bundles[max-1]->emitfinish <= 1 && coin->RTheight == 0 ) if ( coin->bundles[max-1] != 0 && coin->bundles[max-1]->emitfinish <= 1 && coin->RTheight == 0 )
max--; max--;
@ -428,9 +428,13 @@ void iguana_update_balances(struct iguana_info *coin)
if ( (bp= coin->bundles[i]) != 0 && bp != coin->current ) if ( (bp= coin->bundles[i]) != 0 && bp != coin->current )
{ {
iguana_volatilespurge(coin,&bp->ramchain); iguana_volatilespurge(coin,&bp->ramchain);
iguana_volatilesalloc(coin,&bp->ramchain,1);//i < hdrsi); sprintf(fname,"%s/%s/accounts/debits.%d",GLOBAL_DBDIR,coin->symbol,bp->bundleheight);
OS_removefile(fname,0);
sprintf(fname,"%s/%s/accounts/lastspends.%d",GLOBAL_DBDIR,coin->symbol,bp->bundleheight);
OS_removefile(fname,0);
iguana_volatilesalloc(coin,&bp->ramchain,0);//i < hdrsi);
} }
for (; hdrsi<max; hdrsi++) for (hdrsi=0; hdrsi<max; hdrsi++)
{ {
if ( (bp= coin->bundles[hdrsi]) != 0 ) if ( (bp= coin->bundles[hdrsi]) != 0 )
{ {

8
iguana/iguana_realtime.c

@ -226,7 +226,13 @@ int32_t iguana_realtime_update(struct supernet_info *myinfo,struct iguana_info *
{ {
printf("RT edge case couldnt link\n"); printf("RT edge case couldnt link\n");
} }
else printf("RT edge case.%d\n",block->height); else
{
printf("RT edge case.%d\n",block->height);
if ( (bp= coin->bundles[coin->RTheight / coin->chain->bundlesize]) != 0 )
iguana_spendvectors(myinfo,coin,bp,&bp->ramchain,0,bp->n,0,0);
iguana_update_balances(coin);
}
} }
if ( coin->spendvectorsaved <= 1 ) if ( coin->spendvectorsaved <= 1 )
{ {

10
iguana/iguana_unspents.c

@ -1079,6 +1079,7 @@ int32_t iguana_utxoaddr_map(struct iguana_info *coin,char *fname)
int32_t iguana_utxoaddr_check(struct supernet_info *myinfo,struct iguana_info *coin,int32_t lastheight,int64_t *unspents,int32_t max,struct iguana_utxoaddr *utxoaddr) int32_t iguana_utxoaddr_check(struct supernet_info *myinfo,struct iguana_info *coin,int32_t lastheight,int64_t *unspents,int32_t max,struct iguana_utxoaddr *utxoaddr)
{ {
static int32_t good,bad;
char coinaddr[64]; int64_t sum,checkbalance; int32_t iter,i,numunspents = 0; char coinaddr[64]; int64_t sum,checkbalance; int32_t iter,i,numunspents = 0;
sum = 0; sum = 0;
for (iter=0; iter<2; iter++) for (iter=0; iter<2; iter++)
@ -1093,8 +1094,9 @@ int32_t iguana_utxoaddr_check(struct supernet_info *myinfo,struct iguana_info *c
break; break;
} }
} }
if ( sum != utxoaddr->histbalance ) if ( sum != utxoaddr->histbalance || checkbalance != sum )
{ {
bad++;
for (i=0; i<numunspents; i++) for (i=0; i<numunspents; i++)
printf("(%lld %lld %.8f) ",(long long)(unspents[i<<1]>>32)&0xffffffff,(long long)unspents[i<<1]&0xffffffff,dstr(unspents[(i<<1)+1])); printf("(%lld %lld %.8f) ",(long long)(unspents[i<<1]>>32)&0xffffffff,(long long)unspents[i<<1]&0xffffffff,dstr(unspents[(i<<1)+1]));
for (i=0; i<20; i++) for (i=0; i<20; i++)
@ -1102,7 +1104,11 @@ int32_t iguana_utxoaddr_check(struct supernet_info *myinfo,struct iguana_info *c
bitcoin_address(coinaddr,coin->chain->pubtype,utxoaddr->rmd160,sizeof(utxoaddr->rmd160)); bitcoin_address(coinaddr,coin->chain->pubtype,utxoaddr->rmd160,sizeof(utxoaddr->rmd160));
printf(" %s: sum %.8f != %.8f numunspents.%d diff %.8f\n",coinaddr,dstr(sum),dstr(utxoaddr->histbalance),numunspents,dstr(utxoaddr->histbalance)-dstr(sum)); printf(" %s: sum %.8f != %.8f numunspents.%d diff %.8f\n",coinaddr,dstr(sum),dstr(utxoaddr->histbalance),numunspents,dstr(utxoaddr->histbalance)-dstr(sum));
return(-1); return(-1);
} else return(0); }
good++;
if ( ((good + bad) % 1000) == 0 )
printf("utxoaddr validate good.%d bad.%d\n",good,bad);
return(0);
} }
int32_t iguana_utxoaddr_validate(struct supernet_info *myinfo,struct iguana_info *coin,int32_t lastheight) int32_t iguana_utxoaddr_validate(struct supernet_info *myinfo,struct iguana_info *coin,int32_t lastheight)

Loading…
Cancel
Save