Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
33be845bb5
  1. 35
      iguana/iguana_ramchain.c
  2. 4
      iguana/iguana_recv.c

35
iguana/iguana_ramchain.c

@ -1271,7 +1271,7 @@ int32_t iguana_ramchain_alloc(struct iguana_info *coin,struct iguana_ramchain *r
long iguana_ramchain_save(struct iguana_info *coin,RAMCHAIN_FUNC,uint32_t ipbits,bits256 hash2,bits256 prevhash2,int32_t bundlei,struct iguana_bundle *bp)
{
struct iguana_ramchaindata *rdata,tmp; char fname[1024]; long fpos = -1; int32_t c,i,hdrsi,checki; FILE *fp; uint8_t *destoffset,*srcoffset;
struct iguana_ramchaindata *rdata,tmp; char fname[1024]; long fpos = -1; int32_t c,i,hdrsi,checki; FILE *fp;
if ( (rdata= ramchain->H.data) == 0 )
{
printf("ramchainsave no data ptr\n");
@ -1298,17 +1298,6 @@ long iguana_ramchain_save(struct iguana_info *coin,RAMCHAIN_FUNC,uint32_t ipbits
if ( fp != 0 )
{
fpos = ftell(fp);
if ( ramchain->expanded != 0 )
{
destoffset = &Kspace[ramchain->H.scriptoffset];
srcoffset = &Kspace[ramchain->H.data->scriptspace - ramchain->H.stacksize];
if ( 0 && destoffset != srcoffset )
{
for (i=0; i<ramchain->H.stacksize; i++)
c = *srcoffset++, *destoffset++ = c;
}
printf("SAVE: Koffset.%d scriptoffset.%d stacksize.%d allocsize.%d\n",(int32_t)ramchain->H.data->Koffset,ramchain->H.scriptoffset,ramchain->H.stacksize,(int32_t)ramchain->H.data->allocsize);
}
iguana_ramchain_lhashes(RAMCHAIN_ARG,rdata,rdata,bp!=0?bp->n:1,ramchain->H.scriptoffset+ramchain->H.stacksize);
tmp = *rdata;
iguana_ramchain_compact(RAMCHAIN_ARG,&tmp,rdata,bp!=0?bp->n:1);
@ -1965,7 +1954,7 @@ int32_t iguana_ramchain_scriptspace(struct iguana_info *coin,int32_t *sigspacep,
}
}
}
scriptspace += tx->numvins * 16; // for metascripts
scriptspace += tx->numvins * 16 + 65536; // for metascripts
}
*sigspacep = sigspace, *pubkeyspacep = pubkeyspace;
printf("numvouts.%d numvins.%d scriptspace.%d p2shspace.%d sigspace.%d pubkeyspace.%d\n",tx->numvouts,tx->numvins,scriptspace,p2shspace,sigspace,pubkeyspace);
@ -2209,11 +2198,27 @@ void iguana_bundlemapfree(struct OS_memspace *mem,struct OS_memspace *hashmem,ui
int32_t iguana_ramchain_expandedsave(struct iguana_info *coin,RAMCHAIN_FUNC,struct iguana_ramchain *newchain,struct OS_memspace *hashmem,int32_t cmpflag,struct iguana_bundle *bp)
{
static bits256 zero;
bits256 firsthash2,lasthash2; int32_t err,bundlei,hdrsi,numblocks,firsti,height,retval = -1;
bits256 firsthash2,lasthash2; int32_t err,i,c,bundlei,hdrsi,numblocks,firsti,height,retval = -1;
struct iguana_ramchain checkR,*mapchain; char fname[1024]; uint32_t scriptoffset,stacksize;
uint8_t *destoffset,*srcoffset;
firsthash2 = ramchain->H.data->firsthash2, lasthash2 = ramchain->H.data->lasthash2;
height = ramchain->height, firsti = ramchain->H.data->firsti, hdrsi = ramchain->H.hdrsi, numblocks = ramchain->numblocks, scriptoffset = ramchain->H.scriptoffset, stacksize = ramchain->H.stacksize;
height = ramchain->height, firsti = ramchain->H.data->firsti, hdrsi = ramchain->H.hdrsi, numblocks = ramchain->numblocks;
//printf("B[] %p\n",B);
if ( ramchain->expanded != 0 )
{
destoffset = &Kspace[ramchain->H.scriptoffset];
srcoffset = &Kspace[ramchain->H.data->scriptspace - ramchain->H.stacksize];
if ( 1 && destoffset != srcoffset )
{
for (i=0; i<ramchain->H.stacksize; i++)
c = *srcoffset++, *destoffset++ = c;
}
printf("SAVE: Koffset.%d scriptoffset.%d stacksize.%d allocsize.%d\n",(int32_t)ramchain->H.data->Koffset,ramchain->H.scriptoffset,ramchain->H.stacksize,(int32_t)ramchain->H.data->allocsize);
}
scriptoffset = ramchain->H.scriptoffset;
stacksize = ramchain->H.stacksize;
ramchain->H.scriptoffset = ramchain->H.data->scriptspace = scriptoffset;
ramchain->H.stacksize = ramchain->H.data->stackspace = stacksize;
iguana_ramchain_setsize(ramchain,ramchain->H.data,bp->n);
//printf("Apresave T.%d U.%d S.%d P.%d X.%d -> size.%ld firsti.%d scriptoffset.%d stacksize.%d\n",ramchain->H.data->numtxids,ramchain->H.data->numunspents,ramchain->H.data->numspends,ramchain->H.data->numpkinds,ramchain->H.data->numexternaltxids,(long)ramchain->H.data->allocsize,firsti,ramchain->H.scriptoffset,ramchain->H.stacksize);
*newchain = *ramchain;

4
iguana/iguana_recv.c

@ -595,7 +595,7 @@ struct iguana_bundlereq *iguana_recvblock(struct iguana_info *coin,struct iguana
{
struct iguana_bundle *bp=0; int32_t bundlei = -2; struct iguana_block *block;
bp = iguana_bundleset(coin,&block,&bundlei,origblock);
static int total; char str[65]; fprintf(stderr,"RECV %s [%d:%d] block.%08x | %d\n",bits256_str(str,origblock->RO.hash2),bp!=0?bp->hdrsi:-1,bundlei,block->fpipbits,total++);
//static int total; char str[65]; fprintf(stderr,"RECV %s [%d:%d] block.%08x | %d\n",bits256_str(str,origblock->RO.hash2),bp!=0?bp->hdrsi:-1,bundlei,block->fpipbits,total++);
if ( block != 0 )
{
if ( bp != 0 && bundlei > 0 && bits256_nonz(block->RO.prev_block) > 0 )
@ -651,7 +651,7 @@ int32_t iguana_processbundlesQ(struct iguana_info *coin,int32_t *newhwmp) // sin
while ( flag < IGUANA_BUNDLELOOP && (req= queue_dequeue(&coin->bundlesQ,0)) != 0 )
{
flag++;
fprintf(stderr,"%s bundlesQ.%p type.%c n.%d\n",req->addr != 0 ? req->addr->ipaddr : "0",req,req->type,req->n);
//fprintf(stderr,"%s bundlesQ.%p type.%c n.%d\n",req->addr != 0 ? req->addr->ipaddr : "0",req,req->type,req->n);
//if ( req->type == 'B' )
// continue;
if ( req->type == 'B' ) // one block with all txdata

Loading…
Cancel
Save