Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
20b03970d6
  1. 6
      iguana/iguana_bundles.c
  2. 30
      iguana/iguana_unspents.c
  3. 3
      iguana/main.c

6
iguana/iguana_bundles.c

@ -818,7 +818,6 @@ int32_t iguana_bundlefinish(struct iguana_info *coin,struct iguana_bundle *bp)
#endif
)
break;
printf("i.%d hdrsi.%d busy.%d helpers.%d\n",i,bp->hdrsi,coin->emitbusy,IGUANA_NUMHELPERS);
if ( i == bp->hdrsi && coin->emitbusy < (IGUANA_NUMHELPERS/3) )
{
if ( bp->startutxo == 0 )
@ -869,11 +868,14 @@ int32_t iguana_bundleiters(struct iguana_info *coin,struct OS_memspace *mem,stru
iguana_bundlehdr(coin,bp,starti);
else if ( bp->emitfinish != 0 )
{
printf("ITER utxo.%u now.%u spec.%-4d bundle.%-4d h.%-4d r.%-4d s.%-4d F.%d T.%d issued.%d mb.%d/%d\n",bp->utxofinish,(uint32_t)time(NULL),bp->numspec,bp->bundleheight/coin->chain->bundlesize,bp->numhashes,bp->numrecv,bp->numsaved,bp->emitfinish,timelimit,counter,coin->MAXBUNDLES,coin->bundlescount);
//printf("ITER utxo.%u now.%u spec.%-4d bundle.%-4d h.%-4d r.%-4d s.%-4d F.%d T.%d issued.%d mb.%d/%d\n",bp->utxofinish,(uint32_t)time(NULL),bp->numspec,bp->bundleheight/coin->chain->bundlesize,bp->numhashes,bp->numrecv,bp->numsaved,bp->emitfinish,timelimit,counter,coin->MAXBUNDLES,coin->bundlescount);
if ( bp->utxofinish != 0 )
{
if ( bp->balancefinish == 0 )
{
bp->queued = 0;
iguana_balancesQ(coin,bp);
}
return(1);
}
if ( bp->emitfinish > 1 )

30
iguana/iguana_unspents.c

@ -656,6 +656,17 @@ int32_t iguana_spendvectors(struct iguana_info *coin,struct iguana_bundle *bp)
//printf("start UTXOGEN.%d max.%d ptr.%p\n",bp->bundleheight,n,ptr);
txidind = spendind = rdata->firsti;
iguana_ramchain_prefetch(coin,ramchain);
if ( bp->hdrsi > 5 )
{
for (i=1; i<5; i++)
{
if ( (spentbp= coin->bundles[bp->hdrsi - i]) != 0 )
{
iguana_ramchain_prefetch(coin,&spentbp->ramchain);
spentbp->lastprefetch = starttime;
}
}
}
for (i=0; i<bp->n; i++)
{
if ( txidind != B[i].firsttxidind || spendind != B[i].firstvin )
@ -692,9 +703,8 @@ int32_t iguana_spendvectors(struct iguana_info *coin,struct iguana_bundle *bp)
if ( 1 && now > spentbp->lastprefetch+30 )
{
//printf("prefetch[%d] from.[%d] lag.%d\n",spentbp->hdrsi,bp->hdrsi,now - spentbp->lastprefetch);
iguana_ramchain_prefetch(coin,ramchain);
iguana_ramchain_prefetch(coin,&spentbp->ramchain);
bp->lastprefetch = spentbp->lastprefetch = now;
spentbp->lastprefetch = now;
}
spentU = (void *)(long)((long)spentbp->ramchain.H.data + spentbp->ramchain.H.data->Uoffset);
u = &spentU[spent_unspentind];
@ -1460,30 +1470,30 @@ 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) )
//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) )
{
if ( bp->hdrsi >= coin->balanceswritten )
{
//printf("balancecalc for %d when %d\n",bp->hdrsi,coin->balanceswritten);
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);
printf("GENERATE BALANCES.%d ERROR ht.%d\n",bp->hdrsi,bp->bundleheight);
exit(-1);
}
printf("GENERATED BALANCES for ht.%d duration %d seconds, (%d %d).%d\n",bp->bundleheight,(uint32_t)time(NULL) - (uint32_t)starttime,bp->hdrsi,coin->longestchain/coin->chain->bundlesize-1,bp->hdrsi >= coin->longestchain/coin->chain->bundlesize-1);
printf("GENERATED BALANCES.%d for ht.%d duration %d seconds, (%d %d).%d\n",bp->hdrsi,bp->bundleheight,(uint32_t)time(NULL) - (uint32_t)starttime,bp->hdrsi,coin->blocks.hwmchain.height/coin->chain->bundlesize,bp->hdrsi >= coin->blocks.hwmchain.height/coin->chain->bundlesize);
coin->balanceswritten++;
}
bp->balancefinish = (uint32_t)time(NULL);
bp->queued = 0;
if ( bp->hdrsi >= coin->longestchain/coin->chain->bundlesize-1 )
if ( bp->hdrsi >= coin->blocks.hwmchain.height/coin->chain->bundlesize )
{
printf("TRIGGER FLUSH %d vs %d\n",bp->hdrsi,coin->longestchain/coin->chain->bundlesize-1);
printf("TRIGGER FLUSH %d vs %d\n",bp->hdrsi,coin->blocks.hwmchain.height/coin->chain->bundlesize);
sleep(1);
if ( bp->hdrsi >= coin->longestchain/coin->chain->bundlesize-1 )
if ( bp->hdrsi >= coin->blocks.hwmchain.height/coin->chain->bundlesize )
{
if ( iguana_balanceflush(coin,bp->hdrsi,3) > 0 )
printf("balanceswritten.%d flushed bp->hdrsi %d vs %d coin->longestchain/coin->chain->bundlesize\n",coin->balanceswritten,bp->hdrsi,coin->longestchain/coin->chain->bundlesize);

3
iguana/main.c

@ -366,8 +366,9 @@ void mainloop(struct supernet_info *myinfo)
bp = ptr->bp;
if ( ptr->coin != coin || bp == 0 || time(NULL) < bp->nexttime )
{
if ( 0 && bp != 0 )
//if ( 0 && bp != 0 )
printf("skip.%d lag.%ld\n",bp->hdrsi,bp->nexttime-time(NULL));
bp->nexttime = (uint32_t)time(NULL);
queue_enqueue("balanceQ",&balancesQ,&ptr->DL,0);
continue;
}

Loading…
Cancel
Save