From cbd01fd2ca211f250c3dc91d006a05d5d60f0887 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 17 Aug 2016 00:03:26 -0300 Subject: [PATCH] test --- iguana/iguana_realtime.c | 21 +++++++++++++++++++++ iguana/iguana_recv.c | 9 +-------- iguana/tests/ahloop | 9 +++++++++ includes/iguana_funcs.h | 1 + 4 files changed, 32 insertions(+), 8 deletions(-) create mode 100755 iguana/tests/ahloop diff --git a/iguana/iguana_realtime.c b/iguana/iguana_realtime.c index f8f368055..20cc6629f 100755 --- a/iguana/iguana_realtime.c +++ b/iguana/iguana_realtime.c @@ -492,6 +492,27 @@ void iguana_RTpurge(struct iguana_info *coin,int32_t lastheight) } } +void *iguana_RTrawdata(struct iguana_info *coin,bits256 hash2,uint8_t *data,int32_t *recvlenp) +{ + FILE *fp; char fname[1024],str[65]; long filesize; + sprintf(fname,"%s/%s/%s.raw",GLOBAL_TMPDIR,coin->symbol,bits256_str(str,hash2)); + OS_compatible_path(fname); + if ( *recvlenp > 0 ) + { + if ( (fp= fopen(fname,"wb")) != 0 ) + { + if ( fwrite(data,1,*recvlenp,fp) != recvlen ) + printf("error writing %s len.%d\n",bits256_str(str,hash2),*recvlenp); + fclose(fp); + } + } + else + { + if ( (coin->utxoaddrfileptr= OS_mapfile(fname,&coin->utxoaddrfilesize,0)) != 0 && coin->utxoaddrfilesize > sizeof(bits256)+0x10000*sizeof(*coin->utxoaddroffsets) ) + + } +} + void iguana_RTtxid(struct iguana_info *coin,struct iguana_block *block,int64_t polarity,int32_t txi,int32_t txn_count,bits256 txid,int32_t numvouts,int32_t numvins,uint32_t locktime,uint32_t version,uint32_t timestamp) { //char str[65]; diff --git a/iguana/iguana_recv.c b/iguana/iguana_recv.c index 64e1eaf58..63429065d 100755 --- a/iguana/iguana_recv.c +++ b/iguana/iguana_recv.c @@ -495,14 +495,7 @@ void iguana_gotblockM(struct iguana_info *coin,struct iguana_peer *addr,struct i }*/ } //else printf("cant save block\n"); } - portable_mutex_lock(&coin->RTmutex); - if ( txdata->zblock.serialized == 0 ) - { - txdata->zblock.serialized = calloc(1,recvlen); - memcpy(txdata->zblock.serialized,data,recvlen); - txdata->zblock.datalen = recvlen; - } - portable_mutex_unlock(&coin->RTmutex); + iguana_RTrawdata(coin,block->RO.hash2,data,recvlen); req->zblock = txdata->zblock; if ( coin->virtualchain != 0 ) printf("%s recvlen.%d ipbits.%x prev.(%s)\n",coin->symbol,req->zblock.RO.recvlen,req->zblock.fpipbits,bits256_str(str,txdata->zblock.RO.prev_block)); diff --git a/iguana/tests/ahloop b/iguana/tests/ahloop new file mode 100755 index 000000000..e9f287381 --- /dev/null +++ b/iguana/tests/ahloop @@ -0,0 +1,9 @@ +ind=0 +one=1 +while true +do +./activehandle +ind=`expr $ind + $one` +echo $ind +done + diff --git a/includes/iguana_funcs.h b/includes/iguana_funcs.h index 85d500e10..e9eb5074c 100755 --- a/includes/iguana_funcs.h +++ b/includes/iguana_funcs.h @@ -544,6 +544,7 @@ void iguana_RTtxid(struct iguana_info *coin,struct iguana_block *block,int64_t p void iguana_RTspend(struct iguana_info *coin,struct iguana_block *block,int64_t polarity,bits256 txid,int32_t vini,bits256 prev_hash,int32_t prev_vout); void iguana_RTunspent(struct iguana_info *coin,struct iguana_block *block,int64_t polarity,char *coinaddr,uint8_t *rmd160,bits256 txid,int32_t vout,int64_t value); void iguana_RTnewblock(struct iguana_info *coin,struct iguana_block *block); +void *iguana_RTrawdata(struct iguana_info *coin,bits256 hash2,uint8_t *data,int32_t recvlen); void iguana_RTramchainalloc(char *fname,struct iguana_info *coin,struct iguana_bundle *bp); void iguana_update_balances(struct iguana_info *coin); void iguana_RTspendvectors(struct supernet_info *myinfo,struct iguana_info *coin,struct iguana_bundle *bp);