Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
592fbc7d2e
  1. 2
      iguana/iguana777.h
  2. 20
      iguana/iguana_unspents.c

2
iguana/iguana777.h

@ -373,7 +373,7 @@ struct iguana_ramchain_hdr
struct iguana_ramchain
{
struct iguana_ramchain_hdr H; bits256 lasthash2; uint64_t datasize;
struct iguana_ramchain_hdr H; bits256 lasthash2; uint64_t datasize,allocatedA,allocatedU;
uint32_t numblocks:31,expanded:1,pkind,externalind,height,numXspends;
struct iguana_kvitem *txids,*pkhashes;
struct OS_memspace *hashmem; long filesize,sigsfilesize,debitsfilesize,lastspendsfilesize;

20
iguana/iguana_unspents.c

@ -648,8 +648,16 @@ void iguana_allocvolatile(struct iguana_info *coin,struct iguana_ramchain *ramch
{
if ( ramchain != 0 && ramchain->H.data != 0 )
{
ramchain->A = calloc(sizeof(*ramchain->A),ramchain->H.data->numpkinds + 16);
ramchain->Uextras = calloc(sizeof(*ramchain->Uextras),ramchain->H.data->numunspents + 16);
if ( ramchain->allocatedA == 0 )
{
ramchain->A = calloc(sizeof(*ramchain->A),ramchain->H.data->numpkinds + 16);
ramchain->allocatedA = sizeof(*ramchain->A) * ramchain->H.data->numpkinds;
}
if ( ramchain->allocatedU == 0 )
{
ramchain->Uextras = calloc(sizeof(*ramchain->Uextras),ramchain->H.data->numunspents + 16);
ramchain->allocatedU = sizeof(*ramchain->Uextras) * ramchain->H.data->numunspents;
}
if ( ramchain->debitsfileptr != 0 )
{
memcpy(ramchain->A,(void *)((long)ramchain->debitsfileptr + sizeof(int32_t) + sizeof(bits256)),sizeof(*ramchain->A) * ramchain->H.data->numpkinds);
@ -770,9 +778,17 @@ int32_t iguana_balanceflush(struct iguana_info *coin,int32_t refhdrsi,int32_t pu
if ( (bp= coin->bundles[hdrsi]) == 0 )
{
if ( bp->ramchain.A != 0 )
{
free(bp->ramchain.A);
bp->ramchain.A = 0;
bp->ramchain.allocatedA = 0;
}
if ( bp->ramchain.Uextras != 0 )
{
free(bp->ramchain.Uextras);
bp->ramchain.Uextras = 0;
bp->ramchain.allocatedU = 0;
}
if ( iguana_mapvolatiles(coin,&bp->ramchain) != 0 )
printf("error mapping bundle.[%d]\n",hdrsi);
}

Loading…
Cancel
Save