From a1dd6ce46b2f03ce724e0b1fbf2d8e2def433e36 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 1 Apr 2016 15:11:23 -0600 Subject: [PATCH] test --- iguana/iguana777.h | 2 +- iguana/iguana_ramchain.c | 20 ++++++++++---------- iguana/iguana_unspents.c | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/iguana/iguana777.h b/iguana/iguana777.h index 1346c5991..08b6f583a 100755 --- a/iguana/iguana777.h +++ b/iguana/iguana777.h @@ -823,7 +823,7 @@ int32_t iguana_volatileinit(struct iguana_info *coin); int64_t iguana_ramchainopen(struct iguana_info *coin,struct iguana_ramchain *ramchain,struct OS_memspace *mem,struct OS_memspace *hashmem,int32_t bundleheight,bits256 hash2); int32_t iguana_ramchain_free(struct iguana_info *coin,struct iguana_ramchain *ramchain,int32_t deleteflag); void iguana_blocksetcounters(struct iguana_info *coin,struct iguana_block *block,struct iguana_ramchain * ramchain); -int32_t iguana_ramchain_iterate(struct iguana_info *coin,struct iguana_ramchain *dest,struct iguana_ramchain *ramchain,struct iguana_bundle *bp); +int32_t iguana_ramchain_iterate(struct iguana_info *coin,struct iguana_ramchain *dest,struct iguana_ramchain *ramchain,struct iguana_bundle *bp,int16_t bundlei); void *iguana_bundlefile(struct iguana_info *coin,char *fname,long *filesizep,struct iguana_bundle *bp,int32_t bundlei); int32_t iguana_mapchaininit(struct iguana_info *coin,struct iguana_ramchain *mapchain,struct iguana_bundle *bp,int32_t bundlei,struct iguana_block *block,void *ptr,long filesize); void iguana_autoextend(struct iguana_info *coin,struct iguana_bundle *bp); diff --git a/iguana/iguana_ramchain.c b/iguana/iguana_ramchain.c index 0c95d444e..7d9e06190 100755 --- a/iguana/iguana_ramchain.c +++ b/iguana/iguana_ramchain.c @@ -1442,7 +1442,7 @@ int32_t iguana_ramchain_cmp(struct iguana_ramchain *A,struct iguana_ramchain *B, return(-1); } -int32_t iguana_ramchain_iterate(struct iguana_info *coin,struct iguana_ramchain *dest,struct iguana_ramchain *ramchain,struct iguana_bundle *bp) +int32_t iguana_ramchain_iterate(struct iguana_info *coin,struct iguana_ramchain *dest,struct iguana_ramchain *ramchain,struct iguana_bundle *bp,int16_t bundlei) { RAMCHAIN_DECLARE; RAMCHAIN_DESTDECLARE; int32_t j,hdrsi,prevout,scriptlen; uint32_t scriptpos,sequenceid,destspendind=0,desttxidind=0; uint16_t fileid; @@ -1475,14 +1475,14 @@ int32_t iguana_ramchain_iterate(struct iguana_info *coin,struct iguana_ramchain if ( 0 && ramchain->expanded == 0 && dest != 0 ) printf("ITER [%d] TXID.%d -> dest.%p desttxid.%d dest->hashmem.%p numtxids.%d\n",ramchain->H.data->height,ramchain->H.txidind,dest,dest!=0?dest->H.txidind:0,dest!=0?dest->hashmem:0,rdata->numtxids); tx = &T[ramchain->H.txidind]; - if ( iguana_ramchain_addtxid(coin,RAMCHAIN_ARG,tx->txid,tx->numvouts,tx->numvins,tx->locktime,tx->version,tx->timestamp) == 0 ) + if ( iguana_ramchain_addtxid(coin,RAMCHAIN_ARG,tx->txid,tx->numvouts,tx->numvins,tx->locktime,tx->version,tx->timestamp,bundlei) == 0 ) return(-1); if ( dest != 0 ) { //char str[65]; if ( 0 && ramchain->expanded == 0 ) printf("ITER [%d] TXID.%d -> dest.%p desttxid.%d dest->hashmem.%p numtxids.%d\n",ramchain->H.data->height,ramchain->H.txidind,dest,dest!=0?dest->H.txidind:0,dest!=0?dest->hashmem:0,rdata->numtxids); - if ( iguana_ramchain_addtxid(coin,RAMCHAIN_DESTARG,tx->txid,tx->numvouts,tx->numvins,tx->locktime,tx->version,tx->timestamp) == 0 ) + if ( iguana_ramchain_addtxid(coin,RAMCHAIN_DESTARG,tx->txid,tx->numvouts,tx->numvins,tx->locktime,tx->version,tx->timestamp,bundlei) == 0 ) return(-2); } for (j=0; jnumvouts; j++) @@ -1748,7 +1748,7 @@ long iguana_ramchain_data(struct iguana_info *coin,struct iguana_peer *addr,stru for (i=0; iH.txidind++) { tx = &txarray[i]; - iguana_ramchain_addtxid(coin,RAMCHAIN_ARG,tx->txid,tx->tx_out,tx->tx_in,tx->lock_time,tx->version,tx->timestamp); + iguana_ramchain_addtxid(coin,RAMCHAIN_ARG,tx->txid,tx->tx_out,tx->tx_in,tx->lock_time,tx->version,tx->timestamp,bundlei); for (j=0; jtx_out; j++) { memset(rmd160,0,sizeof(rmd160)); @@ -1826,7 +1826,7 @@ long iguana_ramchain_data(struct iguana_info *coin,struct iguana_peer *addr,stru else { iguana_ramchain_extras(coin,&R,0,0); - if ( (err= iguana_ramchain_iterate(coin,0,&R,bp)) != 0 ) + if ( (err= iguana_ramchain_iterate(coin,0,&R,bp,bundlei)) != 0 ) printf("err.%d iterate ",err); //printf("SUCCESS REMAP\n"); bp->numtxids += ramchain->H.data->numtxids; @@ -2037,7 +2037,7 @@ int32_t iguana_ramchain_expandedsave(struct iguana_info *coin,RAMCHAIN_FUNC,stru memset(ramchain->A,0,sizeof(*ramchain->A) * ramchain->H.data->numpkinds); //printf("presave T.%d U.%d S.%d P.%d X.%d -> size.%ld firsti.%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); //printf("0 preSAVE: 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); - if ( (err= iguana_ramchain_iterate(coin,0,ramchain,bp)) != 0 ) + if ( (err= iguana_ramchain_iterate(coin,0,ramchain,bp,-1)) != 0 ) printf("ERROR.%d iterating presave ramchain hdrsi.%d\n",err,hdrsi); else { @@ -2069,7 +2069,7 @@ int32_t iguana_ramchain_expandedsave(struct iguana_info *coin,RAMCHAIN_FUNC,stru iguana_ramchain_link(mapchain,firsthash2,lasthash2,hdrsi,height,0,numblocks,firsti,1); iguana_ramchain_extras(coin,mapchain,hashmem,0); //printf("expSAVE: Koffset.%d scriptoffset.%d stacksize.%d allocsize.%d\n",(int32_t)mapchain->H.data->Koffset,mapchain->H.scriptoffset,mapchain->H.stacksize,(int32_t)mapchain->H.data->allocsize); - if ( (err= iguana_ramchain_iterate(coin,0,mapchain,bp)) != 0 ) + if ( (err= iguana_ramchain_iterate(coin,0,mapchain,bp,bundlei)) != 0 ) printf("err.%d iterate mapped dest\n",err); else if ( cmpflag != 0 ) { @@ -2341,7 +2341,7 @@ int32_t iguana_bundlesaveHT(struct iguana_info *coin,struct OS_memspace *mem,str coin->blocks.RO[bp->bundleheight+bundlei] = block->RO; destB[bundlei] = block->RO; //fprintf(stderr,"(%d %d).%d ",R[bundlei].H.data->numtxids,dest->H.txidind,bundlei); - if ( (err= iguana_ramchain_iterate(coin,dest,&R[bundlei],bp)) != 0 ) + if ( (err= iguana_ramchain_iterate(coin,dest,&R[bundlei],bp,bundlei)) != 0 ) { if ( (block= bp->blocks[bundlei]) != 0 ) { @@ -2455,9 +2455,9 @@ int32_t iguana_bundlemergeHT(struct iguana_info *coin,struct OS_memspace *mem,st iguana_ramchain_extras(coin,dest,&HASHMEM,0); dest->H.txidind = dest->H.unspentind = dest->H.spendind = dest->pkind = dest->H.data->firsti; dest->externalind = 0; - if ( (err= iguana_ramchain_iterate(coin,dest,A,bp)) != 0 ) + if ( (err= iguana_ramchain_iterate(coin,dest,A,bp,-1)) != 0 ) printf("error.%d ramchain_iterate A.%d\n",err,A->height); - else if ( (err= iguana_ramchain_iterate(coin,dest,B,nextbp)) != 0 ) + else if ( (err= iguana_ramchain_iterate(coin,dest,B,nextbp,-1)) != 0 ) printf("error.%d ramchain_iterate B.%d\n",err,B->height); else if ( iguana_ramchain_expandedsave(coin,RAMCHAIN_DESTARG,&newchain,&HASHMEM,0,0) == 0 ) { diff --git a/iguana/iguana_unspents.c b/iguana/iguana_unspents.c index 48da387db..61c26cf83 100755 --- a/iguana/iguana_unspents.c +++ b/iguana/iguana_unspents.c @@ -1261,7 +1261,7 @@ int32_t iguana_realtime_update(struct iguana_info *coin) if ( iguana_mapchaininit(coin,&blockR,bp,bundlei,block,ptr,filesize) == 0 ) { double startmillis0 = OS_milliseconds(); static double totalmillis0; static int32_t num0; - if ( (err= iguana_ramchain_iterate(coin,dest,&blockR,bp)) != 0 || bits256_cmp(blockR.H.data->firsthash2,block->RO.hash2) != 0 ) + if ( (err= iguana_ramchain_iterate(coin,dest,&blockR,bp,bundlei)) != 0 || bits256_cmp(blockR.H.data->firsthash2,block->RO.hash2) != 0 ) { printf("ERROR [%d:%d] %s vs ",bp->hdrsi,bundlei,bits256_str(str,block->RO.hash2)); printf("mapped.%s\n",bits256_str(str,blockR.H.data->firsthash2));