Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
d083888243
  1. 11
      iguana/iguana777.c
  2. 1
      iguana/iguana777.h
  3. 27
      iguana/iguana_unspents.c

11
iguana/iguana777.c

@ -410,7 +410,7 @@ int32_t iguana_helperB(struct iguana_info *coin,int32_t helperid,struct iguana_b
int32_t iguana_utxogen(struct iguana_info *coin,int32_t helperid,int32_t convertflag)
{
int32_t hdrsi,n,max,incr,num = 0; struct iguana_bundle *bp;
int32_t hdrsi,n,i,max,incr,num = 0; struct iguana_bundle *bp;
if ( coin->spendvectorsaved > 1 )
{
printf("skip utxogen as spendvectorsaved.%u\n",coin->spendvectorsaved);
@ -449,6 +449,9 @@ int32_t iguana_utxogen(struct iguana_info *coin,int32_t helperid,int32_t convert
if ( coin->origbalanceswritten <= 1 )
hdrsi = 0;
else hdrsi = coin->origbalanceswritten;
for (i=0; i<max; i++)
if ( (bp= coin->bundles[i]) != 0 )
iguana_volatilesalloc(coin,&bp->ramchain,i < hdrsi);
for (; hdrsi<max; hdrsi++)
{
//iguana_ramchain_prefetch(coin,&coin->bundles[hdrsi]->ramchain,3);
@ -463,6 +466,12 @@ int32_t iguana_utxogen(struct iguana_info *coin,int32_t helperid,int32_t convert
coin->balanceswritten = max;
coin->balanceflush = coin->balanceswritten;
}
for (i=0; i<max; i++)
if ( (bp= coin->bundles[i]) != 0 )
{
iguana_volatilespurge(coin,&bp->ramchain);
iguana_volatilesmap(coin,&bp->ramchain);
}
} else printf("error saving spendvectors\n");
}
//printf("helper.%d check validates\n",helperid);

1
iguana/iguana777.h

@ -886,6 +886,7 @@ bits256 iguana_merkle(struct iguana_info *coin,bits256 *tree,int32_t txn_count);
int32_t iguana_bundleready(struct iguana_info *coin,struct iguana_bundle *bp,int32_t requiredflag);
int32_t iguana_blast(struct iguana_info *coin,struct iguana_peer *addr);
int32_t iguana_validated(struct iguana_info *coin);
void iguana_volatilesalloc(struct iguana_info *coin,struct iguana_ramchain *ramchain,int32_t copyflag);
extern int32_t HDRnet,netBLOCKS;

27
iguana/iguana_unspents.c

@ -304,11 +304,11 @@ int32_t iguana_volatileupdate(struct iguana_info *coin,int32_t incremental,struc
struct iguana_account *A2; struct iguana_ramchaindata *rdata; struct iguana_utxo *utxo;
if ( (rdata= spentchain->H.data) != 0 )
{
if ( spentchain->allocatedA == 0 || spentchain->allocatedU == 0 )
/*if ( spentchain->allocatedA == 0 || spentchain->allocatedU == 0 )
{
iguana_volatilesalloc(coin,spentchain,1);
fprintf(stderr,"volatilesalloc.[%d] ",spent_hdrsi);
}
}*/
if ( incremental == 0 )
{
if ( spentchain->Uextras != 0 && (A2= spentchain->A) != 0 )
@ -1217,11 +1217,6 @@ int32_t iguana_balancegen(struct iguana_info *coin,int32_t incremental,struct ig
emit = startemit;
if ( 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);
if ( starti == 0 && endi == bp->n-1 && ramchain->A != 0 && ramchain->Uextras != 0 )
{
iguana_volatilespurge(coin,ramchain);
iguana_volatilesalloc(coin,ramchain,0);
}
for (i=starti; i<=endi; i++)
{
now = (uint32_t)time(NULL);
@ -1344,7 +1339,6 @@ int32_t iguana_volatilesinit(struct iguana_info *coin)
struct sha256_vstate vstate,bstate; int32_t i,from_ro,numpkinds,numunspents; struct iguana_bundle *bp; struct iguana_block *block;
uint32_t crc,filecrc; FILE *fp; char crcfname[512],str[65],str2[65],buf[2048];
from_ro = 1;
//printf("start volatilesinit\n");
for (i=0; i<coin->balanceswritten; i++)
{
if ( (bp= coin->bundles[i]) == 0 )
@ -1357,7 +1351,6 @@ int32_t iguana_volatilesinit(struct iguana_info *coin)
if ( bp->ramchain.from_ro == 0 || bp->ramchain.from_roX == 0 || bp->ramchain.from_roA == 0 || bp->ramchain.from_roU == 0 )
from_ro = 0;
}
//printf("volatiles i.%d\n",i);
if ( i < coin->balanceswritten )
{
printf("TRUNCATE balances written.%d -> %d\n",coin->balanceswritten,i);
@ -1726,10 +1719,6 @@ int32_t iguana_spendvectorconvs(struct iguana_info *coin,struct iguana_bundle *s
}
else
{
/*if ( vec->fromheight >= coin->current->bundleheight )
{
printf("inside [%d] RT.%d spends vec.([%d] u%d p%d) tmp.%d\n",spentbp->hdrsi,vec->fromheight,vec->hdrsi,vec->unspentind,vec->pkind,vec->tmpflag);
}*/
if ( _iguana_spendvectorconv(vec,&spentU[vec->unspentind],numpkinds,vec->hdrsi,vec->unspentind) != 0 )
converted++;
else
@ -1738,10 +1727,6 @@ int32_t iguana_spendvectorconvs(struct iguana_info *coin,struct iguana_bundle *s
return(-1);
}
}
/*if ( vec->fromheight >= coin->current->bundleheight )
{
printf("outside [%d] RT.%d spends vec.([%d] u%d p%d) tmp.%d\n",spentbp->hdrsi,vec->fromheight,vec->hdrsi,vec->unspentind,vec->pkind,vec->tmpflag);
}*/
}
}
}
@ -1827,7 +1812,7 @@ void *iguana_ramchainfile(struct iguana_info *coin,struct iguana_ramchain *dest,
void iguana_RTramchainalloc(char *fname,struct iguana_info *coin,struct iguana_bundle *bp)
{
uint32_t i,hdrsi,changed = 0; struct iguana_ramchaindata *rdata; struct iguana_ramchain *dest = &coin->RTramchain; struct iguana_blockRO *B; struct iguana_bundle *tmpbp;
uint32_t i,changed = 0; struct iguana_ramchaindata *rdata; struct iguana_ramchain *dest = &coin->RTramchain; struct iguana_blockRO *B;
if ( (rdata= dest->H.data) != 0 )
{
i = 0;
@ -1859,7 +1844,7 @@ void iguana_RTramchainalloc(char *fname,struct iguana_info *coin,struct iguana_b
dest->H.txidind = dest->H.unspentind = dest->H.spendind = dest->pkind = dest->H.data->firsti;
dest->externalind = dest->H.stacksize = 0;
dest->H.scriptoffset = 1;
for (hdrsi=0; hdrsi<=bp->hdrsi; hdrsi++)
/*for (hdrsi=0; hdrsi<=bp->hdrsi; hdrsi++)
{
if ( (tmpbp= coin->bundles[hdrsi]) != 0 )
{
@ -1867,7 +1852,7 @@ void iguana_RTramchainalloc(char *fname,struct iguana_info *coin,struct iguana_b
iguana_volatilesmap(coin,&tmpbp->ramchain);
iguana_volatilesalloc(coin,&tmpbp->ramchain,hdrsi < bp->hdrsi);
}
}
}*/
}
}
@ -1934,7 +1919,7 @@ void iguana_RTspendvectors(struct iguana_info *coin,struct iguana_bundle *bp)
num += iguana_convert(coin,IGUANA_NUMHELPERS,coin->bundles[hdrsi],1,orignumemit);
printf("spendvectors converted.%d to %d\n",num,coin->RTheight);
bp->converted = (uint32_t)time(NULL);
if ( iguana_balancegen(coin,0,bp,coin->RTstarti,coin->RTheight > 0 ? coin->RTheight-1 : bp->n-1,orignumemit) < 0 )
if ( iguana_balancegen(coin,1,bp,coin->RTstarti,coin->RTheight > 0 ? coin->RTheight-1 : bp->n-1,orignumemit) < 0 )
coin->RTdatabad = 1;
//printf("iguana_balancegen [%d] (%d to %d)\n",bp->hdrsi,coin->RTstarti,(coin->RTheight-1)%bp->n);
coin->RTstarti = (coin->RTheight % bp->n);

Loading…
Cancel
Save