jl777 8 years ago
parent
commit
789bb196d7
  1. 14
      iguana/iguana_ramchain.c

14
iguana/iguana_ramchain.c

@ -871,7 +871,7 @@ int64_t _iguana_rdata_action(char *fname,FILE *fp,bits256 lhashes[IGUANA_NUMLHAS
int64_t iguana_ramchain_action(char *fname,RAMCHAIN_FUNC,FILE *fp,bits256 lhashes[IGUANA_NUMLHASHES],struct iguana_ramchaindata *destdata,uint64_t fpos,struct iguana_ramchaindata *srcdata,int32_t numblocks,int32_t scriptspace,uint8_t zcash)
{
if ( 0 && ramchain->expanded == 0 )
//if ( 0 && ramchain->expanded == 0 )
printf("action.%p (%p %p %p) %ld allocated.%ld [%d:%d %d:%d]\n",srcdata,fp,lhashes,destdata,(long)fpos,(long)srcdata->allocsize,srcdata->txsparsebits,srcdata->numtxsparse,srcdata->pksparsebits,srcdata->numpksparse);
return(_iguana_rdata_action(fname,fp,lhashes,destdata,fpos,ramchain->expanded,srcdata->numtxids,srcdata->numunspents,srcdata->numspends,srcdata->numpkinds,srcdata->numexternaltxids,scriptspace,srcdata->txsparsebits,srcdata->numtxsparse,srcdata->pksparsebits,srcdata->numpksparse,srcdata->allocsize,RAMCHAIN_ARG,numblocks,zcash));
}
@ -882,7 +882,7 @@ int64_t iguana_ramchain_size(char *fname,RAMCHAIN_FUNC,int32_t numblocks,int32_t
if ( (rdata= ramchain->H.data) != 0 )
{
allocsize = iguana_ramchain_action(fname,RAMCHAIN_ARG,0,0,0,0,rdata,numblocks,scriptspace,zcash);
if ( 0 && ramchain->expanded != 0 )
//if ( 0 && ramchain->expanded != 0 )
printf("%p iguana_ramchain_size.expanded.%d %u: Koffset.%u scriptoffset.%u stacksize.%u stackspace.%u [%u]\n",ramchain,ramchain->expanded,(int32_t)allocsize,(int32_t)rdata->Koffset,(int32_t)ramchain->H.scriptoffset,(int32_t)ramchain->H.stacksize,(int32_t)rdata->stackspace,scriptspace);
}
return(allocsize);
@ -902,7 +902,7 @@ long iguana_ramchain_setsize(char *fname,struct iguana_ramchain *ramchain,struct
rdata->scriptspace = ramchain->H.scriptoffset;
rdata->stackspace = ramchain->H.stacksize;
rdata->allocsize = iguana_ramchain_size(fname,RAMCHAIN_ARG,numblocks,rdata->scriptspace,zcash);
if ( 0 && rdata->scriptspace != 0 )
//if ( 0 && rdata->scriptspace != 0 )
printf("iguana_ramchain_setsize: Koffset.%d scriptspace.%d stackspace.%d (scriptoffset.%d stacksize.%d) allocsize.%d\n",(int32_t)rdata->Koffset,(int32_t)rdata->scriptspace,(int32_t)rdata->stackspace,(int32_t)ramchain->H.scriptoffset,(int32_t)ramchain->H.stacksize,(int32_t)rdata->allocsize);
ramchain->datasize = rdata->allocsize;
return((long)rdata->allocsize);
@ -929,7 +929,7 @@ int64_t iguana_ramchain_saveaction(char *fname,RAMCHAIN_FUNC,FILE *fp,struct igu
before = ftell(fp);
iguana_ramchain_action(fname,RAMCHAIN_ARG,fp,0,rdata,0,rdata,numblocks,scriptspace,zcash);
after = ftell(fp);
if ( 0 && ramchain->expanded == 0 )
//if ( 0 && ramchain->expanded == 0 )
{
int32_t i; for (i=0; i<scriptspace&&i<25; i++)
printf("%02x",Kspace[i]);
@ -964,7 +964,7 @@ int64_t iguana_ramchain_init(char *fname,struct iguana_ramchain *ramchain,struct
numpkinds = numunspents;
_iguana_rdata_action(fname,0,0,rdata,0,expanded,numtxids,numunspents,numspends,numpkinds,numexternaltxids,scriptspace,0,0,0,0,0,RAMCHAIN_ARG,numblocks,zcash);
offset += rdata->allocsize;
if ( 0 && expanded != 0 )
//if ( 0 && expanded != 0 )
printf("init T.%d U.%d S.%d P.%d X.%d -> %ld\n",numtxids,numunspents,numspends,numpkinds,numexternaltxids,(long)offset);
if ( rdata->allocsize != iguana_ramchain_size(fname,RAMCHAIN_ARG,numblocks,scriptspace,zcash) )
{
@ -997,7 +997,7 @@ int32_t iguana_ramchain_alloc(char *fname,struct iguana_info *coin,struct iguana
memset(ramchain,0,sizeof(*ramchain));
ramchain->height = height;
allocsize = _iguana_rdata_action(fname,0,0,0,0,1,numtxids,numunspents,numspends,numpkinds,numexternaltxids,scriptspace,0,0,0,0,0,RAMCHAIN_ARG,numblocks,zcash);
if ( 0 && ramchain->expanded != 0 )
//if ( 0 && ramchain->expanded != 0 )
printf("T.%d U.%d S.%d P.%d X.%d -> %ld\n",numtxids,numunspents,numspends,numpkinds,numexternaltxids,(long)allocsize);
memset(mem,0,sizeof(*mem));
memset(hashmem,0,sizeof(*hashmem));
@ -1045,7 +1045,7 @@ long iguana_ramchain_save(struct iguana_info *coin,RAMCHAIN_FUNC,uint32_t ipbits
iguana_ramchain_lhashes(fname,RAMCHAIN_ARG,rdata,rdata,bp!=0?bp->n:1,ramchain->H.scriptoffset,zcash);
tmp = *rdata;
iguana_ramchain_compact(fname,RAMCHAIN_ARG,&tmp,rdata,bp!=0?bp->n:1,zcash);
if ( 0 && ramchain->expanded != 0 )
//if ( 0 && ramchain->expanded != 0 )
printf("compact.%s: Koffset.%d scriptoffset.%d stacksize.%d allocsize.%d\n",fname,(int32_t)rdata->Koffset,ramchain->H.scriptoffset,ramchain->H.stacksize,(int32_t)rdata->allocsize);
if ( fwrite(&tmp,1,sizeof(tmp),fp) != sizeof(tmp) )
{

Loading…
Cancel
Save