Browse Source

test

release/v0.1
jl777 8 years ago
parent
commit
cbd01fd2ca
  1. 21
      iguana/iguana_realtime.c
  2. 9
      iguana/iguana_recv.c
  3. 9
      iguana/tests/ahloop
  4. 1
      includes/iguana_funcs.h

21
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) 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]; //char str[65];

9
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"); } //else printf("cant save block\n");
} }
portable_mutex_lock(&coin->RTmutex); iguana_RTrawdata(coin,block->RO.hash2,data,recvlen);
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);
req->zblock = txdata->zblock; req->zblock = txdata->zblock;
if ( coin->virtualchain != 0 ) 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)); 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));

9
iguana/tests/ahloop

@ -0,0 +1,9 @@
ind=0
one=1
while true
do
./activehandle
ind=`expr $ind + $one`
echo $ind
done

1
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_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_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_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_RTramchainalloc(char *fname,struct iguana_info *coin,struct iguana_bundle *bp);
void iguana_update_balances(struct iguana_info *coin); void iguana_update_balances(struct iguana_info *coin);
void iguana_RTspendvectors(struct supernet_info *myinfo,struct iguana_info *coin,struct iguana_bundle *bp); void iguana_RTspendvectors(struct supernet_info *myinfo,struct iguana_info *coin,struct iguana_bundle *bp);

Loading…
Cancel
Save