Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
78dea70bb4
  1. 9
      crypto777/ramcoder.c
  2. 6
      iguana/SuperNET.c
  3. 3
      iguana/iguana777.h
  4. 1
      iguana/iguana_ramchain.c
  5. 2
      iguana/m_osx
  6. 14
      iguana/main.c

9
crypto777/ramcoder.c

@ -49,7 +49,7 @@ int32_t init_ramcoder(struct ramcoder *coder,HUFF *hp,bits256 *seed);
int32_t ramcoder_emit(HUFF *hp,struct ramcoder *coder,int32_t updateprobs,uint8_t *buf,int32_t len);
int32_t ramcoder_decompress(uint8_t *data,int32_t maxlen,uint8_t *bits,uint32_t numbits,bits256 seed);
int32_t ramcoder_compress(uint8_t *bits,int32_t maxlen,uint8_t *data,int32_t datalen,uint64_t *histo,bits256 seed);
int32_t ramcoder_compress(uint8_t *bits,int32_t maxlen,uint8_t *data,int32_t datalen);
uint64_t hconv_bitlen(uint64_t bitlen);
void _init_HUFF(HUFF *hp,int32_t allocsize,void *buf);
@ -439,11 +439,12 @@ int32_t ramcoder_decoder(struct ramcoder *coder,int32_t updateprobs,uint8_t *buf
return(n);
}
int32_t ramcoder_compress(uint8_t *bits,int32_t maxlen,uint8_t *data,int32_t datalen,uint64_t *histo,bits256 seed)
int32_t ramcoder_compress(uint8_t *bits,int32_t maxlen,uint8_t *data,int32_t datalen)
{
int32_t numbits; HUFF H,*hp = &H;
int32_t numbits; bits256 seed; HUFF H,*hp = &H;
memset(seed.bytes,0,sizeof(seed));
_init_HUFF(hp,maxlen,bits);
if ( ramcoder_encoder(0,1,data,datalen,hp,histo,&seed) < 0 )
if ( ramcoder_encoder(0,1,data,datalen,hp,0,&seed) < 0 )
return(-1);
numbits = hp->bitoffset;
if ( 0 )

6
iguana/SuperNET.c

@ -517,7 +517,7 @@ int32_t SuperNET_reqhandler(struct supernet_info *myinfo,struct supernet_msghdr
int32_t SuperNET_LBrequest(struct supernet_info *myinfo,bits256 *dest,uint8_t type,char *agent,uint8_t *data,int32_t datalen,int32_t duration)
{
struct supernet_msghdr *msg,*retmsg; int32_t i,sendlen,recvlen,sock; uint32_t nonce;
struct supernet_msghdr *msg,*retmsg; int32_t sendlen,recvlen,sock; uint32_t nonce;
if ( (sock= myinfo->reqsock) < 0 )
{
printf("SuperNET_LBrequest no reqsock for.(%s)\n",agent);
@ -558,7 +558,7 @@ int32_t SuperNET_LBrequest(struct supernet_info *myinfo,bits256 *dest,uint8_t ty
void SuperNET_recv(struct supernet_info *myinfo,int32_t sock,int32_t LBreq)
{
int32_t i,recvlen,datalen,retlen,type; uint32_t nonce,duration,timestamp; uint8_t *retbuf; struct supernet_msghdr *msg;
int32_t recvlen,datalen,retlen,type; uint32_t nonce,duration,timestamp; uint8_t *retbuf; struct supernet_msghdr *msg;
LBreq <<= 1;
if ( myinfo->recvbuf[LBreq] == 0 )
myinfo->recvbuf[LBreq] = calloc(1,SUPERNET_MAXRECVBUF+sizeof(*msg));
@ -680,7 +680,7 @@ void SuperNET_init(struct supernet_info *myinfo,uint16_t PUBport,uint16_t LBport
sleep(10);
}*/
}
else
else if ( 0 )
{
double startmillis = OS_milliseconds();
for (i=0; i<1000; i++)

3
iguana/iguana777.h

@ -532,7 +532,7 @@ int32_t iguana_updatewaiting(struct iguana_info *coin,int32_t starti,int32_t max
// recvbits
int32_t iguana_recvinit(struct iguana_info *coin,int32_t initialheight);
int32_t ramcoder_decompress(uint8_t *data,int32_t maxlen,uint8_t *bits,uint32_t numbits,bits256 seed);
int32_t ramcoder_compress(uint8_t *bits,int32_t maxlen,uint8_t *data,int32_t datalen,uint64_t *histo,bits256 seed);
int32_t ramcoder_compress(uint8_t *bits,int32_t maxlen,uint8_t *data,int32_t datalen);
uint64_t hconv_bitlen(uint64_t bitlen);
struct iguana_block *iguana_blockptr(struct iguana_info *coin,int32_t height);
int32_t iguana_processrecv(struct iguana_info *coin); // single threaded
@ -689,6 +689,7 @@ char *iguana_bitcoinRPC(struct supernet_info *myinfo,char *method,cJSON *json,ch
cJSON *iguana_pubkeyjson(struct iguana_info *coin,char *pubkeystr);
void iguana_bundleQ(struct iguana_info *coin,struct iguana_bundle *bp,int32_t timelimit);
void iguana_bundleiters(struct iguana_info *coin,struct iguana_bundle *bp,int32_t timelimit);
void ramcoder_test(void *data,int64_t len);
extern queue_t bundlesQ;

1
iguana/iguana_ramchain.c

@ -1715,6 +1715,7 @@ struct iguana_ramchain *iguana_bundleload(struct iguana_info *coin,struct iguana
{
iguana_ramchain_link(mapchain,bp->hashes[0],bp->ramchain.lasthash2,bp->hdrsi,bp->bundleheight,0,bp->ramchain.numblocks,firsti,1);
char str[65]; printf("bp.%d: T.%d U.%d S.%d P%d X.%d MAPPED %s %p\n",bp->hdrsi,bp->ramchain.H.data->numtxids,bp->ramchain.H.data->numunspents,bp->ramchain.H.data->numspends,bp->ramchain.H.data->numpkinds,bp->ramchain.H.data->numexternaltxids,mbstr(str,bp->ramchain.H.data->allocsize),bp->ramchain.H.data);
//ramcoder_test(bp->ramchain.H.data,bp->ramchain.H.data->allocsize);
B = (void *)(long)((long)mapchain->H.data + mapchain->H.data->Boffset);
T = (void *)(long)((long)mapchain->H.data + mapchain->H.data->Toffset);
for (i=0; i<bp->n; i++)

2
iguana/m_osx

@ -1 +1 @@
gcc -Wno-deprecated -o ../agents/iguana -O2 *.c ../agents/libcrypto777.a -lssl -lcrypto -lpthread -lm
gcc -Wno-deprecated -o ../agents/iguana -O2 *.c ../agents/libcrypto777.a -lcurl -lssl -lcrypto -lpthread -lm

14
iguana/main.c

@ -275,6 +275,18 @@ char *SuperNET_p2p(struct iguana_info *coin,int32_t *delaymillisp,char *ipaddr,u
return(retstr);
}
void ramcoder_test(void *data,int64_t datalen)
{
static double totalin,totalout;
int32_t complen,bufsize = 1024 * 1024; uint8_t *buf;
buf = malloc(bufsize);
complen = ramcoder_compress(buf,bufsize,data,(int32_t)datalen);
totalin += datalen;
totalout += (complen >> 3);
printf("datalen.%d -> numbits.%d %d %.3f\n",(int32_t)datalen,complen,complen>>3,(double)totalin/totalout);
free(buf);
}
void iguana_main(void *arg)
{
struct supernet_info MYINFO; char helperstr[64],*helperargs,*coinargs=0,*secret,*jsonstr = arg;
@ -313,7 +325,7 @@ void iguana_main(void *arg)
iguana_launch(iguana_coinadd("BTCD"),"rpcloop",iguana_rpcloop,iguana_coinadd("BTCD"),IGUANA_PERMTHREAD);
if ( coinargs != 0 )
iguana_launch(iguana_coinadd("BTCD"),"iguana_coins",iguana_coins,coinargs,IGUANA_PERMTHREAD);
else if ( 0 )
else if ( 1 )
{
#ifdef __APPLE__
sleep(1);

Loading…
Cancel
Save