Browse Source

test

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

2
iguana/iguana777.c

@ -450,7 +450,7 @@ int32_t iguana_utxogen(struct iguana_info *coin,int32_t helperid,int32_t convert
hdrsi = 0;
else hdrsi = coin->origbalanceswritten;
for (i=0; i<max; i++)
if ( (bp= coin->bundles[i]) != 0 )
if ( (bp= coin->bundles[i]) != 0 && bp != coin->current )
iguana_volatilesalloc(coin,&bp->ramchain,i < hdrsi);
for (; hdrsi<max; hdrsi++)
{

4
iguana/iguana777.h

@ -385,14 +385,14 @@ struct iguana_ramchain_hdr
struct iguana_ramchain
{
struct iguana_ramchain_hdr H; bits256 lasthash2; uint64_t datasize,allocatedA,allocatedU;
struct iguana_ramchain_hdr H; bits256 lasthash2; uint64_t datasize,allocatedA2,allocatedU2;
uint32_t numblocks:31,expanded:1,pkind,externalind,height,numXspends;
long sparseadds,sparsesearches,sparseadditers,sparsesearchiters,sparsehits,sparsemax;
struct iguana_kvitem *txids,*pkhashes;
struct OS_memspace *hashmem; long filesize,sigsfilesize,debitsfilesize,lastspendsfilesize;
void *fileptr,*sigsfileptr,*Xspendptr,*debitsfileptr,*lastspendsfileptr;
char from_ro,from_roX,from_roA,from_roU;
struct iguana_account *A,*creditsA; struct iguana_spendvector *Xspendinds;
struct iguana_account *A,*A2,*creditsA; struct iguana_spendvector *Xspendinds;
struct iguana_utxo *Uextras; uint8_t *txbits; struct iguana_txid *cacheT;
//int16_t permutation[IGUANA_MAXBUNDLES];
//struct iguana_Uextra *U2,*roU2; struct iguana_pkextra *P2,*roP2;

27
iguana/iguana_unspents.c

@ -150,15 +150,15 @@ void iguana_volatilesalloc(struct iguana_info *coin,struct iguana_ramchain *ramc
if ( ramchain != 0 && (rdata= ramchain->H.data) != 0 )
{
//printf("volatilesalloc.[%d]\n",rdata->height/coin->chain->bundlesize);
if ( ramchain->allocatedA == 0 )
if ( ramchain->allocatedA2 == 0 )
{
ramchain->A = calloc(sizeof(*ramchain->A),rdata->numpkinds + 16);
ramchain->allocatedA = sizeof(*ramchain->A) * rdata->numpkinds;
ramchain->A2 = calloc(sizeof(*ramchain->A2),rdata->numpkinds + 16);
ramchain->allocatedA2 = sizeof(*ramchain->A2) * rdata->numpkinds;
}
if ( ramchain->allocatedU == 0 )
if ( ramchain->allocatedU2 == 0 )
{
ramchain->Uextras = calloc(sizeof(*ramchain->Uextras),rdata->numunspents + 16);
ramchain->allocatedU = sizeof(*ramchain->Uextras) * rdata->numunspents;
ramchain->allocatedU2 = sizeof(*ramchain->Uextras) * rdata->numunspents;
}
if ( ramchain->debitsfileptr != 0 )
{
@ -196,13 +196,13 @@ void iguana_volatilespurge(struct iguana_info *coin,struct iguana_ramchain *ramc
struct iguana_bundle *bp;
if ( (bp= coin->current) != 0 && ramchain->height < bp->bundleheight )
{
if ( ramchain->allocatedA != 0 && ramchain->A != 0 )
free(ramchain->A);
ramchain->A = 0;
if ( ramchain->allocatedU != 0 && ramchain->Uextras != 0 )
if ( ramchain->allocatedA2 != 0 && ramchain->A2 != 0 )
free(ramchain->A2);
ramchain->A2 = 0;
if ( ramchain->allocatedU2 != 0 && ramchain->Uextras != 0 )
free(ramchain->Uextras);
ramchain->Uextras = 0;
ramchain->allocatedA = ramchain->allocatedU = 0;
ramchain->allocatedA2 = ramchain->allocatedU2 = 0;
if ( ramchain->debitsfileptr != 0 )
{
munmap(ramchain->debitsfileptr,ramchain->debitsfilesize);
@ -313,11 +313,6 @@ 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 )
{
iguana_volatilesalloc(coin,spentchain,1);
fprintf(stderr,"volatilesalloc.[%d] ",spent_hdrsi);
}*/
if ( incremental == 0 )
{
if ( spentchain->Uextras != 0 && (A2= spentchain->A) != 0 )
@ -1602,7 +1597,7 @@ int32_t iguana_balanceflush(struct iguana_info *coin,int32_t refhdrsi)
OS_removefile(fname,0);
OS_removefile(fname2,0);
}
if ( bp->ramchain.allocatedA == 0 || bp->ramchain.allocatedU == 0 )
if ( bp->ramchain.allocatedA2 == 0 || bp->ramchain.allocatedU2 == 0 )
break;
}
else if ( hdrsi > 0 )

Loading…
Cancel
Save