Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
9b01f6d39f
  1. 45
      iguana/iguana777.c
  2. 3
      iguana/iguana777.h
  3. 15
      iguana/iguana_bundles.c
  4. 2
      iguana/main.c

45
iguana/iguana777.c

@ -283,10 +283,23 @@ void iguana_bundleQ(struct iguana_info *coin,struct iguana_bundle *bp,int32_t ti
ptr->timelimit = timelimit;
coin->numbundlesQ++;
if ( bp->hdrsi > 170 )
printf("%s %p bundle.%d[%d] ht.%d emitfinish.%u\n",coin->symbol,bp,ptr->hdrsi,bp->n,bp->bundleheight,bp->emitfinish);
printf("%s %p bundle.%d[%d] ht.%d emitfinish.%u\n",coin->symbol,bp,ptr->hdrsi,bp->n,bp->bundleheight,bp->emitfinish);
queue_enqueue("bundlesQ",&bundlesQ,&ptr->DL,0);
}
void iguana_spendvectorsQ(struct iguana_info *coin,struct iguana_bundle *bp)
{
struct iguana_helper *ptr;
bp->queued = (uint32_t)time(NULL);
ptr = mycalloc('i',1,sizeof(*ptr));
ptr->allocsize = sizeof(*ptr);
ptr->coin = coin;
ptr->bp = bp, ptr->hdrsi = bp->hdrsi;
ptr->type = 's';
ptr->starttime = (uint32_t)time(NULL);
queue_enqueue("spendvectorsQ",&spendvectorsQ,&ptr->DL,0);
}
void iguana_validateQ(struct iguana_info *coin,struct iguana_bundle *bp)
{
struct iguana_helper *ptr;
@ -362,7 +375,7 @@ void iguana_balancesQ(struct iguana_info *coin,struct iguana_bundle *bp)
void iguana_helper(void *arg)
{
cJSON *argjson=0; int32_t type,helperid=rand(),flag,allcurrent,idle=0;
cJSON *argjson=0; int32_t retval,type,helperid=rand(),flag,allcurrent,idle=0;
struct iguana_helper *ptr; struct iguana_info *coin; struct OS_memspace MEM,*MEMB; struct iguana_bundle *bp;
if ( arg != 0 && (argjson= cJSON_Parse(arg)) != 0 )
helperid = juint(argjson,"helperid");
@ -413,13 +426,35 @@ void iguana_helper(void *arg)
else //if ( coin->active != 0 )
printf("helper missing param? %p %p %u\n",ptr->coin,bp,ptr->timelimit);
myfree(ptr,ptr->allocsize);
flag++;
}
if ( (helperid % IGUANA_NUMHELPERS) == (1 % IGUANA_NUMHELPERS) && (ptr= queue_dequeue(&validateQ,0)) != 0 )
if ( (helperid % IGUANA_NUMHELPERS) == (1 % IGUANA_NUMHELPERS) && (ptr= queue_dequeue(&spendvectorsQ,0)) != 0 )
{
printf("spendvectorsQ size.%d\n",queue_size(&spendvectorsQ));
coin = ptr->coin;
if ( (bp= ptr->bp) != 0 && coin != 0 )
{
if ( (retval= iguana_spendvectors(coin,bp)) >= 0 )
{
flag++;
if ( retval > 0 )
{
printf("GENERATED UTXO.%d for ht.%d duration %d seconds\n",bp->hdrsi,bp->bundleheight,(uint32_t)time(NULL)-bp->startutxo);
bp->utxofinish = (uint32_t)time(NULL);
bp->balancefinish = 0;
}
if ( bp->balancefinish == 0 )
iguana_balancesQ(coin,bp);
} else printf("UTXO gen.[%d] utxo error\n",bp->hdrsi);
}
else if ( coin->active != 0 )
printf("helper missing param? %p %p\n",coin,bp);
myfree(ptr,ptr->allocsize);
}
if ( (helperid % IGUANA_NUMHELPERS) == (2 % IGUANA_NUMHELPERS) && (ptr= queue_dequeue(&validateQ,0)) != 0 )
{
if ( ptr->bp != 0 && (coin= ptr->coin) != 0 && coin->active != 0 )
flag += iguana_bundlevalidate(ptr->coin,ptr->bp);
else //if ( coin->active != 0 )
else if ( coin->active != 0 )
printf("helper validate missing param? %p %p\n",ptr->coin,ptr->bp);
myfree(ptr,ptr->allocsize);
flag++;

3
iguana/iguana777.h

@ -830,10 +830,11 @@ int32_t iguana_setmaxbundles(struct iguana_info *coin);
void iguana_bundlepurgefiles(struct iguana_info *coin,struct iguana_bundle *bp);
uint32_t iguana_sparseaddtx(uint8_t *bits,int32_t width,uint32_t tablesize,bits256 txid,struct iguana_txid *T,uint32_t txidind,struct iguana_ramchain *ramchain);
void iguana_launchpeer(struct iguana_info *coin,char *ipaddr);
void iguana_spendvectorsQ(struct iguana_info *coin,struct iguana_bundle *bp);
extern int32_t HDRnet,netBLOCKS;
extern queue_t bundlesQ,validateQ,emitQ,balancesQ,TerminateQ;
extern queue_t bundlesQ,validateQ,emitQ,balancesQ,TerminateQ,spendvectorsQ;
extern char GLOBALTMPDIR[];
#include "../includes/iguana_api.h"

15
iguana/iguana_bundles.c

@ -816,25 +816,14 @@ int32_t iguana_bundlefinish(struct iguana_info *coin,struct iguana_bundle *bp)
if ( bp->startutxo == 0 )
{
bp->startutxo = (uint32_t)time(NULL);
if ( (retval= iguana_spendvectors(coin,bp)) >= 0 )
{
if ( retval > 0 )
{
printf("GENERATED UTXO.%d for ht.%d duration %d seconds\n",bp->hdrsi,bp->bundleheight,(uint32_t)time(NULL)-bp->startutxo);
bp->utxofinish = (uint32_t)time(NULL);
bp->balancefinish = 0;
}
if ( bp->balancefinish == 0 )
iguana_balancesQ(coin,bp);
return(1);
} else printf("UTXO gen.[%d] utxo error\n",bp->hdrsi);
iguana_spendvectorsQ(coin,bp);
}
else if ( bp->utxofinish != 0 )
{
if ( bp->balancefinish == 0 )
iguana_balancesQ(coin,bp);
return(1);
}
return(1);
} // else printf("%u notready postfinish.%d startutxo.%u prevbp.%d %u current.%d\n",(uint32_t)time(NULL),bp->hdrsi,bp->startutxo,prevbp!=0?prevbp->hdrsi:-1,prevbp!=0?prevbp->emitfinish:0,coin->current!=0?coin->current->hdrsi:-1);
return(0);
}

2
iguana/main.c

@ -38,7 +38,7 @@ struct iguana_info *Coins[IGUANA_MAXCOINS];
char Userhome[512],GLOBALTMPDIR[512] = "tmp";
int32_t USE_JAY,FIRST_EXTERNAL,IGUANA_disableNXT,Debuglevel;
uint32_t prices777_NXTBLOCK,MAX_DEPTH = 100;
queue_t helperQ,jsonQ,finishedQ,bundlesQ,validateQ,emitQ,balancesQ,TerminateQ;
queue_t helperQ,jsonQ,finishedQ,bundlesQ,validateQ,emitQ,balancesQ,TerminateQ,spendvectorsQ;
struct supernet_info MYINFO,**MYINFOS;
static int32_t initflag;
int32_t HDRnet,netBLOCKS;

Loading…
Cancel
Save