From 6adb8783b8b3ee572874e828ddac6f7d5d116b3d Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 30 Mar 2017 03:12:46 +0300 Subject: [PATCH] Test --- iguana/iguana_ramchain.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/iguana/iguana_ramchain.c b/iguana/iguana_ramchain.c index a2cb07fdc..2926906b9 100755 --- a/iguana/iguana_ramchain.c +++ b/iguana/iguana_ramchain.c @@ -258,7 +258,9 @@ uint32_t iguana_ramchain_addpkhash(struct iguana_info *coin,RAMCHAIN_FUNC,uint8_ P[pkind].firstunspentind = unspentind; printf("%p P[%d] <- firstunspent.%d\n",&P[pkind],pkind,unspentind); }*/ - memcpy(P[pkind].rmd160,rmd160,sizeof(P[pkind].rmd160)); + //memcpy(P[pkind].rmd160,rmd160,sizeof(P[pkind].rmd160)); + for (i=0; i<20; i++) + P[pkind].rmd160[i] = rmd160[i]; //for (i=0; i<20; i++) // printf("%02x",rmd160[i]); //printf(" -> rmd160 pkind.%d \n",pkind); @@ -276,7 +278,7 @@ uint32_t iguana_ramchain_addpkhash(struct iguana_info *coin,RAMCHAIN_FUNC,uint8_ uint32_t iguana_ramchain_addunspent20(struct iguana_info *coin,struct iguana_peer *addr,RAMCHAIN_FUNC,uint64_t value,uint8_t *script,int32_t scriptlen,bits256 txid,int32_t vout,int8_t type,struct iguana_bundle *bp,uint8_t rmd160[20]) { - uint32_t unspentind; struct iguana_unspent20 *u; long scriptpos; struct vin_info V; char asmstr[IGUANA_MAXSCRIPTSIZE*2+1]; + uint32_t unspentind,i; struct iguana_unspent20 *u; long scriptpos; struct vin_info V; char asmstr[IGUANA_MAXSCRIPTSIZE*2+1]; unspentind = ramchain->H.unspentind++; u = &U[unspentind]; if ( scriptlen > 0 ) @@ -287,14 +289,16 @@ uint32_t iguana_ramchain_addunspent20(struct iguana_info *coin,struct iguana_pee type = iguana_calcrmd160(coin,asmstr,&V,script,scriptlen,txid,vout,0xffffffff); if ( (type == 12 && scriptlen == 0) || (type == 1 && bitcoin_pubkeylen(script+1) <= 0) ) { - int32_t i; for (i=0; iH.ROflag != 0 ) @@ -309,7 +313,9 @@ uint32_t iguana_ramchain_addunspent20(struct iguana_info *coin,struct iguana_pee { u->value = value; u->type = type; - memcpy(u->rmd160,rmd160,sizeof(u->rmd160)); + //memcpy(u->rmd160,rmd160,sizeof(u->rmd160)); + for (i=0; i<20; i++) + u->rmd160[i] = rmd160[i]; if ( type == IGUANA_SCRIPT_76AC ) { static uint64_t totalsize; @@ -693,7 +699,7 @@ void *iguana_ramchain_offset(char *fname,void *dest,uint8_t *lhash,FILE *fp,uint int32_t iguana_ramchain_prefetch(struct iguana_info *coin,struct iguana_ramchain *ramchain,int32_t flag) { RAMCHAIN_DECLARE; RAMCHAIN_ZEROES; - struct iguana_pkhash p; struct iguana_unspent u; struct iguana_txid txid; uint32_t i,numpkinds,numtxids,numunspents,numexternal,tlen,plen,nonz=0; uint8_t *ptr; struct iguana_ramchaindata *rdata; + struct iguana_pkhash p; struct iguana_unspent u; struct iguana_txid txid; uint32_t i,j,numpkinds,numtxids,numunspents,numexternal,tlen,plen,nonz=0; uint8_t *ptr; struct iguana_ramchaindata *rdata; //return(0); if ( (rdata= ramchain->H.data) != 0 ) { @@ -716,7 +722,9 @@ int32_t iguana_ramchain_prefetch(struct iguana_info *coin,struct iguana_ramchain tlen = (rdata->numtxsparse * rdata->txsparsebits) >> 3; for (i=0; i