jl777 8 years ago
parent
commit
868c6371f8
  1. 7
      iguana/dpow/dpow_fsm.c
  2. 37
      iguana/iguana777.c
  3. 4
      iguana/iguana_ramchain.c
  4. 12
      iguana/iguana_spendvectors.c

7
iguana/dpow/dpow_fsm.c

@ -273,7 +273,7 @@ int32_t dpow_update(struct supernet_info *myinfo,struct dpow_info *dp,struct dpo
}
if ( ep->masks[src_or_dest][bp->bestk] == 0 )
dpow_signedtxgen(myinfo,dp,(src_or_dest != 0) ? bp->destcoin : bp->srccoin,bp,bp->bestk,bp->bestmask,myind,DPOW_SIGBTCCHANNEL,src_or_dest);
else if ( bp->bestk >= 0 && (rand() % 100) == 0 )
if ( bp->bestk >= 0 )//&& (rand() % 100) == 0 )
dpow_sigsend(myinfo,dp,bp,myind,bp->bestk,bp->bestmask,srchash,DPOW_SIGBTCCHANNEL);
} else sendutxo = 1;
if ( sendutxo != 0 )
@ -285,7 +285,7 @@ int32_t dpow_update(struct supernet_info *myinfo,struct dpow_info *dp,struct dpo
}
if ( bp->bestk >= 0 && ep->masks[src_or_dest][bp->bestk] == 0 )
dpow_signedtxgen(myinfo,dp,(src_or_dest != 0) ? bp->destcoin : bp->srccoin,bp,bp->bestk,bp->bestmask,myind,DPOW_SIGBTCCHANNEL,src_or_dest);
else if ( bp->bestk >= 0 && (rand() % 100) == 0 )
if ( bp->bestk >= 0 )
dpow_sigsend(myinfo,dp,bp,myind,bp->bestk,bp->bestmask,srchash,DPOW_SIGBTCCHANNEL);
}
else if ( bp->state != 0xffffffff )
@ -293,7 +293,8 @@ int32_t dpow_update(struct supernet_info *myinfo,struct dpow_info *dp,struct dpo
src_or_dest = 0;
if ( bp->bestk >= 0 && ep->masks[src_or_dest][bp->bestk] == 0 )
dpow_signedtxgen(myinfo,dp,(src_or_dest != 0) ? bp->destcoin : bp->srccoin,bp,bp->bestk,bp->bestmask,myind,DPOW_SIGCHANNEL,src_or_dest);
//else dpow_sigsend(myinfo,bp,myind,bp->bestk,bp->bestmask,srchash,sigchannel);
if ( bp->bestk >= 0 )
dpow_sigsend(myinfo,dp,bp,myind,bp->bestk,bp->bestmask,srchash,DPOW_SIGCHANNEL);
}
if ( (rand() % 10) == 0 || bp->isratify != 0 )
{

37
iguana/iguana777.c

@ -386,7 +386,7 @@ int32_t iguana_validated(struct iguana_info *coin)
int32_t iguana_helperA(struct supernet_info *myinfo,struct iguana_info *coin,int32_t helperid,struct iguana_bundle *bp,int32_t convertflag)
{
int32_t retval,num = 0;
int32_t retval,numXspends,num = 0;
if ( bp == 0 )
{
printf("iguana_helperA unexpected null bp\n");
@ -400,7 +400,8 @@ int32_t iguana_helperA(struct supernet_info *myinfo,struct iguana_info *coin,int
{
if ( retval > 0 )
{
printf("GENERATED UTXO.%d for ht.%d duration %d seconds\n",bp->hdrsi,bp->bundleheight,(uint32_t)time(NULL) - bp->startutxo);
numXspends = iguana_Xspendmap(coin,&bp->ramchain,bp);
printf("GENERATED UTXO.%d for ht.%d duration %d seconds numXspends.%d\n",bp->hdrsi,bp->bundleheight,(uint32_t)time(NULL) - bp->startutxo,numXspends);
num++;
}
bp->utxofinish = (uint32_t)time(NULL);
@ -439,7 +440,7 @@ int32_t iguana_utxogen(struct supernet_info *myinfo,struct iguana_info *coin,int
void iguana_update_balances(struct supernet_info *myinfo,struct iguana_info *coin)
{
int32_t i,hdrsi,max; struct iguana_bundle *bp; char fname[1024];
int32_t i,hdrsi,max,retval,numXspends,convertflag = 1; struct iguana_bundle *bp; char fname[1024];
if ( coin->RTheight > 0 )
{
printf("Need to restart iguana to generate new balances files\n");
@ -449,9 +450,27 @@ void iguana_update_balances(struct supernet_info *myinfo,struct iguana_info *coi
max = coin->bundlescount;
if ( coin->bundles[max-1] == coin->current || coin->bundles[max-1] == 0 || (coin->bundles[max-1] != 0 && coin->bundles[max-1]->utxofinish <= 1) )
max--;
coin->spendvectorsaved = 0;
iguana_utxogen(myinfo,coin,0,1);
if ( coin->chain->zcash != 0 )
{
coin->spendvectorsaved = 0;
for (i=0; i<coin->bundlescount-1; i++)
{
if ( (bp= coin->bundles[i]) == 0 )
continue;
if ( (retval= iguana_spendvectors(myinfo,coin,bp,&bp->ramchain,0,bp->n,convertflag,0)) >= 0 ) //bp->utxofinish > 1 ||
{
if ( retval > 0 )
{
numXspends = iguana_Xspendmap(coin,&bp->ramchain,bp);
printf("GENERATED UTXO.%d for ht.%d duration %d seconds numX.%d\n",bp->hdrsi,bp->bundleheight,(uint32_t)time(NULL) - bp->startutxo,numXspends);
}
bp->utxofinish = (uint32_t)time(NULL);
}
}
}
coin->spendvectorsaved = (uint32_t)time(NULL);
//if ( coin->chain->zcash != 0 )
// iguana_utxogen(myinfo,coin,0,1);
if ( iguana_balancefinished(coin) < max && iguana_spendvectorsaves(coin) == 0 ) //
{
if ( coin->origbalanceswritten <= 1 )
@ -516,7 +535,7 @@ int32_t iguana_utxogen(struct supernet_info *myinfo,struct iguana_info *coin,int
max = coin->bundlescount;
if ( coin->bundles[max-1] == coin->current || coin->bundles[max-1] == 0 || (coin->bundles[max-1] != 0 && coin->bundles[max-1]->utxofinish <= 1) )
max--;
printf("helperid.%d start %s utxogen bundlescount.%d max.%d\n",helperid,coin->symbol,coin->bundlescount,max);
//printf("helperid.%d start %s utxogen bundlescount.%d max.%d\n",helperid,coin->symbol,coin->bundlescount,max);
if ( helperid < incr )
{
for (hdrsi=helperid; hdrsi<max; hdrsi+=incr)
@ -716,7 +735,7 @@ void iguana_helper(void *arg)
{
if ( coin->firstRTheight == 0 )
{
if ( coin->spendvectorsaved == 1 )
if ( coin->spendvectorsaved == 1 && coin->chain->zcash == 0 )
iguana_utxogen(myinfo,coin,helperid,1);
else if ( coin->spendvectorsaved > 1 && (coin->spendvalidated & (1 << helperid)) == 0 )
{
@ -745,7 +764,7 @@ void iguana_helper(void *arg)
if ( i == j )
{
iguana_bundlevalidate(myinfo,coin,bp,0);
if ( bp->validated > 1 )
if ( bp->validated > 1 && coin->chain->zcash == 0 )
{
for (i=0; i<j; i++)
if ( coin->bundles[i] == 0 || coin->bundles[i]->utxofinish <= 1 )

4
iguana/iguana_ramchain.c

@ -1344,7 +1344,7 @@ int32_t iguana_Xspendmap(struct iguana_info *coin,struct iguana_ramchain *ramcha
printf("[%d] filesize %ld Xspendptr.%p %p num.%d\n",bp->hdrsi,filesize,ramchain->Xspendptr,ramchain->Xspendinds,ramchain->numXspends);
bp->Xvalid = 1;
}
printf("mapped utxo vector[%d] from (%s)\n",ramchain->numXspends,fname);
//printf("mapped utxo vector[%d] from (%s)\n",ramchain->numXspends,fname);
return(ramchain->numXspends);
//int32_t i; for (i=0; i<ramchain->numXspends; i++)
// printf("(%d u%d) ",ramchain->Xspendinds[i].hdrsi,ramchain->Xspendinds[i].ind);
@ -2293,7 +2293,7 @@ struct iguana_ramchain *iguana_bundleload(struct supernet_info *myinfo,struct ig
if ( (mapchain= iguana_ramchain_map(myinfo,coin,fname,bp,bp->n,ramchain,0,0,bp->hashes[0],zero,0,0,extraflag,1,zcash)) != 0 )
{
iguana_ramchain_link(mapchain,bp->hashes[0],bp->hdrsi,bp->bundleheight,0,bp->n,firsti,1);
char str[65]; printf("%s bp.%d: T.%d U.%d S.%d P%d X.%d MAPPED %s %p\n",coin->symbol,bp->hdrsi,mapchain->H.data->numtxids,mapchain->H.data->numunspents,mapchain->H.data->numspends,mapchain->H.data->numpkinds,mapchain->H.data->numexternaltxids,mbstr(str,mapchain->H.data->allocsize),mapchain->H.data);
//char str[65]; printf("%s bp.%d: T.%d U.%d S.%d P%d X.%d MAPPED %s %p\n",coin->symbol,bp->hdrsi,mapchain->H.data->numtxids,mapchain->H.data->numunspents,mapchain->H.data->numspends,mapchain->H.data->numpkinds,mapchain->H.data->numexternaltxids,mbstr(str,mapchain->H.data->allocsize),mapchain->H.data);
//ramcoder_test(mapchain->H.data,mapchain->H.data->allocsize);
firsttxidind = 1;
if ( (rdata= ramchain->H.data) != 0 )

12
iguana/iguana_spendvectors.c

@ -56,7 +56,7 @@ int32_t iguana_spendvectorsave(struct iguana_info *coin,struct iguana_bundle *bp
int32_t i,retval = -1; FILE *fp; char fname[1024],str[65]; long fsize; bits256 zero,sha256;
if ( ptr == 0 || (bp->hdrsi != 0 && ptr == bp->ramchain.Xspendinds) )
{
printf("iguana_spendvectorsave.[%d] ptr.%p Xspendinds\n",bp->hdrsi,ptr);
//printf("iguana_spendvectorsave.[%d] ptr.%p Xspendinds\n",bp->hdrsi,ptr);
return(0);
}
memset(zero.bytes,0,sizeof(zero));
@ -84,7 +84,7 @@ int32_t iguana_spendvectorsave(struct iguana_info *coin,struct iguana_bundle *bp
printf("error mapping Xspendmap.(%s)\n",fname);
else
{
printf("created.(%s) %p[%d]\n",fname,bp->ramchain.Xspendinds,bp->ramchain.numXspends);
//printf("created.(%s) %p[%d]\n",fname,bp->ramchain.Xspendinds,bp->ramchain.numXspends);
retval = 0;
}
}
@ -263,7 +263,7 @@ int32_t iguana_spendvectors(struct supernet_info *myinfo,struct iguana_info *coi
bp->numtmpspends = ramchain->numXspends;
bp->utxofinish = (uint32_t)time(NULL);
bp->balancefinish = 0;
printf("iguana_spendvectors.[%d]: already have Xspendinds[%d]\n",bp->hdrsi,ramchain->numXspends);
//printf("iguana_spendvectors.[%d]: already have Xspendinds[%d]\n",bp->hdrsi,ramchain->numXspends);
return(0);
}
bp->startutxo = (uint32_t)time(NULL);
@ -474,10 +474,10 @@ int32_t iguana_balancegen(struct iguana_info *coin,int32_t incremental,struct ig
numXspends = bp->numtmpspends;
if ( (Xspendinds= bp->tmpspends) == 0 )
{
printf("iguana_balancegen.%d: no Xspendinds[%d]\n",bp->hdrsi,numXspends);
//printf("iguana_balancegen.%d: no Xspendinds[%d]\n",bp->hdrsi,numXspends);
numXspends = iguana_Xspendmap(coin,ramchain,bp);
numXspends = ramchain->numXspends;
printf("Xspendinds.%p[%d]\n",Xspendinds,numXspends);
//printf("Xspendinds.%p[%d]\n",Xspendinds,numXspends);
//return(-1);
}
}
@ -486,7 +486,7 @@ int32_t iguana_balancegen(struct iguana_info *coin,int32_t incremental,struct ig
spendind = B[starti].firstvin;
unspentind = B[starti].firstvout;
emit = startemit;
//if ( 0 && (coin->RTheight == 0 || bp->bundleheight+bp->n < coin->RTheight) )
if ( 0 && (coin->RTheight == 0 || bp->bundleheight+bp->n < coin->RTheight) )
fprintf(stderr,"BALANCEGEN.[%d] %p[%d] starti.%d s%d <-> endi.%d s%d startemit.%d\n",bp->hdrsi,Xspendinds,numXspends,starti,spendind,endi,B[endi].firstvin+B[endi].numvins,startemit);
for (i=starti; i<=endi; i++)
{

Loading…
Cancel
Save