Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
ebf3fb6e90
  1. 23
      iguana/iguana777.c
  2. 11
      iguana/iguana_bundles.c
  3. 15
      iguana/iguana_unspents.c
  4. 2
      iguana/main.c

23
iguana/iguana777.c

@ -459,15 +459,10 @@ void iguana_helper(void *arg)
myfree(ptr,ptr->allocsize);
} else break;
}
if ( (ptr= queue_dequeue(&convertQ,0)) != 0 )
{
coin = ptr->coin;
if ( (bp= ptr->bp) != 0 && coin != 0 )
iguana_convert(coin,bp);
myfree(ptr,ptr->allocsize);
}
}
if ( (type & (1 << 1)) != 0 && (ptr= queue_dequeue(&spendvectorsQ,0)) != 0 )
if ( (type & (1 << 1)) != 0 )
{
if ( (ptr= queue_dequeue(&spendvectorsQ,0)) != 0 )
{
//printf("spendvectorsQ size.%d\n",queue_size(&spendvectorsQ));
coin = ptr->coin;
@ -492,6 +487,18 @@ void iguana_helper(void *arg)
else if ( coin->active != 0 )
printf("helper missing param? %p %p\n",coin,bp);
myfree(ptr,ptr->allocsize);
}
n = queue_size(&convertQ);
for (iter=0; iter<n; iter++)
if ( (ptr= queue_dequeue(&convertQ,0)) != 0 )
{
coin = ptr->coin;
if ( (bp= ptr->bp) != 0 && coin != 0 && coin->active != 0 )
iguana_convert(coin,bp);
myfree(ptr,ptr->allocsize);
}
n = queue_size(&validateQ);
for (iter=0; iter<n; iter++)
if ( (ptr= queue_dequeue(&validateQ,0)) != 0 )
{
if ( ptr->bp != 0 && (coin= ptr->coin) != 0 && coin->active != 0 )

11
iguana/iguana_bundles.c

@ -654,7 +654,8 @@ void iguana_bundleissuemissing(struct iguana_info *coin,struct iguana_bundle *bp
int32_t iguana_bundlehdr(struct iguana_info *coin,struct iguana_bundle *bp,int32_t starti)
{
uint8_t missings[IGUANA_MAXBUNDLESIZE/8+1]; int32_t avail,dist,counter=0;
//uint8_t missings[IGUANA_MAXBUNDLESIZE/8+1]; int32_t avail;
int32_t dist,counter=0;
if ( 0 && bp->isRT == 0 && (bp->hdrsi == coin->bundlescount-1 || bp == coin->current) )
printf("hdr ITERATE.%d bundle.%d vs %d: h.%d n.%d r.%d s.%d c.%d finished.%d spec.%p[%d]\n",bp->hdrsi,bp->bundleheight,coin->longestchain-coin->chain->bundlesize,bp->numhashes,bp->n,bp->numrecv,bp->numsaved,bp->numcached,bp->emitfinish,bp->speculative,bp->numspec);
dist = 30 + (coin->current != 0 ? bp->hdrsi - coin->current->hdrsi : 0);
@ -667,8 +668,8 @@ int32_t iguana_bundlehdr(struct iguana_info *coin,struct iguana_bundle *bp,int32
if ( bp == coin->current && bp->speculative != 0 )
{
//printf("iguana_bundlehdr.[%d] %d %s\n",bp->hdrsi,bp->numspec,bits256_str(str,bp->hashes[0]));
if ( iguana_blocksmissing(coin,&avail,missings,0,bp,0,7) > 0 )
iguana_bundleissuemissing(coin,bp,missings,3);
//if ( iguana_blocksmissing(coin,&avail,missings,0,bp,0,7) > 0 )
// iguana_bundleissuemissing(coin,bp,missings,3);
}
queue_enqueue("hdrsQ",&coin->hdrsQ,queueitem(bits256_str(str,bp->hashes[0])),1);
}
@ -677,8 +678,8 @@ int32_t iguana_bundlehdr(struct iguana_info *coin,struct iguana_bundle *bp,int32
if ( time(NULL) > (bp->issued[1] + 10 + dist) )
{
//printf("request speculative[1] numspec.%d for bp.[%d] bp->speculative.%p enable.%d\n",bp->numspec,bp->hdrsi,bp->speculative,coin->enableCACHE);
iguana_blockQ("getnexthdr",coin,bp,-1,bp->speculative[1],1);
bp->issued[1] = (uint32_t)time(NULL);
//iguana_blockQ("getnexthdr",coin,bp,-1,bp->speculative[1],1);
//bp->issued[1] = (uint32_t)time(NULL);
}
}
return(counter);

15
iguana/iguana_unspents.c

@ -1358,7 +1358,8 @@ void iguana_RTramchainalloc(struct iguana_info *coin,struct iguana_bundle *bp)
if ( coin->PREFETCHLAG != 0 )
{
iguana_ramchain_prefetch(coin,&coin->RTramchain,0);
iguana_prefetch(coin,bp,3,0);
iguana_prefetch(coin,bp,7,0);
iguana_prefetch(coin,bp,22,1);
}
}
}
@ -1714,6 +1715,9 @@ int32_t iguana_spendvectorsaves(struct iguana_info *coin)
int32_t iguana_spendvectorconvs(struct iguana_info *coin,struct iguana_bundle *spentbp)
{
struct iguana_bundle *bp; int16_t spent_hdrsi; uint32_t numpkinds; struct iguana_unspent *spentU; struct iguana_spendvector *vec; int32_t i,converted,j,n = coin->bundlescount;
if ( spentbp->converted != 0 )
return(-1);
spentbp->converted = 1;
spent_hdrsi = spentbp->hdrsi;
numpkinds = spentbp->ramchain.H.data->numpkinds;
iguana_ramchain_prefetch(coin,&spentbp->ramchain,0);
@ -1750,9 +1754,9 @@ int32_t iguana_spendvectorconvs(struct iguana_info *coin,struct iguana_bundle *s
void iguana_convert(struct iguana_info *coin,struct iguana_bundle *bp)
{
static int64_t total;
static int64_t total,depth;
int32_t i,n,m,converted; int64_t total_tmpspends; double startmillis = OS_milliseconds();
printf("start conversion.[%d]\n",bp->hdrsi);
depth++;
if ( (converted= iguana_spendvectorconvs(coin,bp)) < 0 )
printf("error ram balancecalc.[%d]\n",bp->hdrsi);
else
@ -1763,15 +1767,16 @@ void iguana_convert(struct iguana_info *coin,struct iguana_bundle *bp)
if ( coin->bundles[i] != 0 )
{
total_tmpspends += coin->bundles[i]->numtmpspends;
if ( coin->bundles[i]->converted != 0 )
if ( coin->bundles[i]->converted > 1 )
m++;
}
}
total += converted;
printf("[%4d] millis %7.3f converted.%-7d balance calc.%-4d of %4d | total.%llu of %llu\n",bp->hdrsi,OS_milliseconds()-startmillis,converted,m,n,(long long)total,(long long)total_tmpspends);
printf("[%4d] millis %7.3f converted.%-7d balance calc.%-4d of %4d | total.%llu of %llu depth.%d\n",bp->hdrsi,OS_milliseconds()-startmillis,converted,m,n,(long long)total,(long long)total_tmpspends,(int32_t)depth);
if ( m == n-1 )
iguana_spendvectorsaves(coin);
}
depth--;
}
int32_t iguana_balancecalc(struct iguana_info *coin,struct iguana_bundle *bp,int32_t startheight,int32_t endheight)

2
iguana/main.c

@ -46,7 +46,7 @@ cJSON *API_json;
#ifdef __linux__
int32_t IGUANA_NUMHELPERS = 16;
#else
int32_t IGUANA_NUMHELPERS = 4;
int32_t IGUANA_NUMHELPERS = 8;
#endif
struct iguana_jsonitem { struct queueitem DL; struct supernet_info *myinfo; uint32_t fallback,expired,allocsize; char **retjsonstrp; char remoteaddr[64]; uint16_t port; char jsonstr[]; };

Loading…
Cancel
Save