Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
f5841c1038
  1. 3
      iguana/iguana777.c
  2. 35
      iguana/iguana_init.c
  3. 30
      iguana/iguana_unspents.c
  4. 9
      iguana/main.c

3
iguana/iguana777.c

@ -414,7 +414,8 @@ void iguana_helper(void *arg)
{
if ( ptr->bp != 0 && (coin= ptr->coin) != 0 && coin->active != 0 )
flag += iguana_bundlevalidate(ptr->coin,ptr->bp);
else printf("helper validate missing param? %p %p\n",ptr->coin,ptr->bp);
else if ( coin->active != 0 )
printf("helper validate missing param? %p %p\n",ptr->coin,ptr->bp);
myfree(ptr,ptr->allocsize);
flag++;
}

35
iguana/iguana_init.c

@ -372,24 +372,29 @@ void iguana_blockspurge(struct iguana_info *coin)
void iguana_coinpurge(struct iguana_info *coin)
{
int32_t i; struct iguana_bundle *bp; char *hashstr; struct iguana_bundlereq *req; struct iguana_blockreq *breq;
int32_t i; struct iguana_bundle *bp; char *hashstr; struct iguana_bundlereq *req; struct iguana_blockreq *breq; struct iguana_helper *ptr;
coin->started = 0; coin->active = 0;
coin->RTgenesis = 0;
while ( (hashstr= queue_dequeue(&coin->hdrsQ,1)) != 0 )
free_queueitem(hashstr);
while ( (breq= queue_dequeue(&coin->blocksQ,0)) != 0 )
myfree(breq,sizeof(*breq));
while ( (breq= queue_dequeue(&coin->priorityQ,0)) != 0 )
myfree(breq,sizeof(*breq));
while ( (req= queue_dequeue(&coin->cacheQ,0)) != 0 )
myfree(req,req->allocsize);
while ( (req= queue_dequeue(&coin->recvQ,0)) != 0 )
while ( (ptr= queue_dequeue(&bundlesQ,0)) != 0 )
myfree(ptr,ptr->allocsize);
if ( 0 )
{
if ( req->blocks != 0 )
myfree(req->blocks,sizeof(*req->blocks) * req->n), req->blocks = 0;
if ( req->hashes != 0 )
myfree(req->hashes,sizeof(*req->hashes) * req->n), req->hashes = 0;
myfree(req,req->allocsize);
while ( (hashstr= queue_dequeue(&coin->hdrsQ,1)) != 0 )
free_queueitem(hashstr);
while ( (breq= queue_dequeue(&coin->blocksQ,0)) != 0 )
myfree(breq,sizeof(*breq));
while ( (breq= queue_dequeue(&coin->priorityQ,0)) != 0 )
myfree(breq,sizeof(*breq));
while ( (req= queue_dequeue(&coin->cacheQ,0)) != 0 )
myfree(req,req->allocsize);
while ( (req= queue_dequeue(&coin->recvQ,0)) != 0 )
{
if ( req->blocks != 0 )
myfree(req->blocks,sizeof(*req->blocks) * req->n), req->blocks = 0;
if ( req->hashes != 0 )
myfree(req->hashes,sizeof(*req->hashes) * req->n), req->hashes = 0;
myfree(req,req->allocsize);
}
}
while ( coin->idletime == 0 && coin->emitbusy > 0 )
{

30
iguana/iguana_unspents.c

@ -485,7 +485,7 @@ int32_t iguana_spendvectors(struct iguana_info *coin,struct iguana_bundle *bp)
printf("unexpected spendbp: height.%d bp.[%d] U%d <- S%d.[%d] [ext.%d %s prev.%d]\n",bp->bundleheight+i,spentbp->hdrsi,spent_unspentind,spendind,bp->hdrsi,s->external,bits256_str(str,prevhash),s->prevout);
errs++;
}
if ( now > spentbp->lastprefetch+10 )
if ( now > spentbp->lastprefetch+1 )
{
//printf("prefetch[%d] from.[%d] lag.%d\n",spentbp->hdrsi,bp->hdrsi,now - spentbp->lastprefetch);
iguana_ramchain_prefetch(coin,&spentbp->ramchain);
@ -589,6 +589,13 @@ int32_t iguana_balancegen(struct iguana_info *coin,struct iguana_bundle *bp,int3
txidind = spendind = rdata->firsti;
for (i=0; i<bp->n; i++)
{
now = (uint32_t)time(NULL);
if ( now > bp->lastprefetch+1 )
{
//printf("RT prefetch[%d] from.[%d] lag.%d\n",spentbp->hdrsi,bp->hdrsi,now - spentbp->lastprefetch);
iguana_ramchain_prefetch(coin,&bp->ramchain);
bp->lastprefetch = now;
}
//printf("hdrs.[%d] B[%d] 1st txidind.%d txn_count.%d firstvin.%d firstvout.%d\n",bp->hdrsi,i,B[i].firsttxidind,B[i].txn_count,B[i].firstvin,B[i].firstvout);
if ( txidind != B[i].firsttxidind || spendind != B[i].firstvin )
{
@ -1251,19 +1258,24 @@ int32_t iguana_balancecalc(struct iguana_info *coin,struct iguana_bundle *bp,int
// printf("B [%d] j.%d u.%u b.%u\n",bp->hdrsi,j,bp->utxofinish,bp->balancefinish);
if ( bp->bundleheight+bp->n < coin->blocks.hwmchain.height && bp->utxofinish > 1 && bp->balancefinish <= 1 && (bp->hdrsi == 0 || bp->hdrsi == j) )
{
starttime = (uint32_t)time(NULL);
for (j=0; j<=bp->hdrsi; j++)
iguana_allocvolatile(coin,&coin->bundles[j]->ramchain);
if ( iguana_balancegen(coin,bp,startheight,endheight) < 0 )
if ( bp->hdrsi >= coin->balanceswritten )
{
printf("GENERATE BALANCES ERROR ht.%d\n",bp->bundleheight);
exit(-1);
printf("balancecalc for %d when %d\n",bp->hdrsi,coin->balanceswritten);
starttime = (uint32_t)time(NULL);
for (j=0; j<=bp->hdrsi; j++)
iguana_allocvolatile(coin,&coin->bundles[j]->ramchain);
if ( iguana_balancegen(coin,bp,startheight,endheight) < 0 )
{
printf("GENERATE BALANCES ERROR ht.%d\n",bp->bundleheight);
exit(-1);
}
printf("GENERATED BALANCES for ht.%d duration %d seconds\n",bp->bundleheight,(uint32_t)time(NULL) - (uint32_t)starttime);
coin->balanceswritten++;
}
bp->balancefinish = (uint32_t)time(NULL);
printf("GENERATED BALANCES for ht.%d duration %d seconds\n",bp->bundleheight,bp->balancefinish - (uint32_t)starttime);
bp->queued = 0;
iguana_validateQ(coin,bp);
if ( bp->hdrsi >= coin->longestchain/coin->chain->bundlesize-1 && bp->hdrsi >= coin->balanceswritten )
if ( bp->hdrsi >= coin->longestchain/coin->chain->bundlesize-1 )
{
iguana_balanceflush(coin,bp->hdrsi,3);
printf("balanceswritten.%d flushed bp->hdrsi %d vs %d coin->longestchain/coin->chain->bundlesize\n",coin->balanceswritten,bp->hdrsi,coin->longestchain/coin->chain->bundlesize);

9
iguana/main.c

@ -363,10 +363,15 @@ void mainloop(struct supernet_info *myinfo)
flag++;
if ( (ptr= queue_dequeue(&balancesQ,0)) != 0 )
{
if ( ptr->coin != coin )
{
queue_enqueue("balanceQ",&balancesQ,&ptr->DL,0);
continue;
}
flag++;
if ( ptr->coin != 0 && (bp= ptr->bp) != 0 )
if ( coin != 0 && (bp= ptr->bp) != 0 )
{
iguana_balancecalc(ptr->coin,bp,bp->bundleheight,bp->bundleheight+bp->n-1);
iguana_balancecalc(coin,bp,bp->bundleheight,bp->bundleheight+bp->n-1);
if ( coin->active == 0 )
{
printf("detected autopurge after account filecreation. restarting.%s\n",coin->symbol);

Loading…
Cancel
Save