Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
3c6a25cd8d
  1. 12
      basilisk/basilisk.c
  2. 3
      basilisk/basilisk.h
  3. 2
      gecko/gecko_blocks.c
  4. 2
      gecko/gecko_headers.c

12
basilisk/basilisk.c

@ -327,8 +327,8 @@ struct basilisk_item *basilisk_issueremote(struct supernet_info *myinfo,int32_t
struct basilisk_item *basilisk_requestservice(struct supernet_info *myinfo,char *CMD,int32_t blockflag,cJSON *valsobj,bits256 hash,uint8_t *data,int32_t datalen,uint32_t nBits) struct basilisk_item *basilisk_requestservice(struct supernet_info *myinfo,char *CMD,int32_t blockflag,cJSON *valsobj,bits256 hash,uint8_t *data,int32_t datalen,uint32_t nBits)
{ {
int32_t minresults,timeoutmillis,numsent,delaymillis,encryptflag,fanout; struct basilisk_item *ptr; char buf[4096],*symbol,*str = 0; struct iguana_info *virt,*btcd; int32_t minresults,timeoutmillis,numsent,delaymillis,encryptflag,fanout; struct basilisk_item *ptr; char buf[4096],*symbol,*str = 0; struct iguana_info *virt,*btcd;
if ( (btcd= iguana_coinfind("BTCD")) != 0 && btcd->RELAYNODE != 0 ) //if ( (btcd= iguana_coinfind("BTCD")) != 0 && btcd->RELAYNODE != 0 )
jaddnum(valsobj,"iamrelay",1); // jaddnum(valsobj,"iamrelay",1);
basilisk_addhexstr(&str,valsobj,buf,sizeof(buf),data,datalen); basilisk_addhexstr(&str,valsobj,buf,sizeof(buf),data,datalen);
if ( bits256_cmp(hash,GENESIS_PUBKEY) != 0 && bits256_nonz(hash) != 0 ) if ( bits256_cmp(hash,GENESIS_PUBKEY) != 0 && bits256_nonz(hash) != 0 )
{ {
@ -352,9 +352,11 @@ struct basilisk_item *basilisk_requestservice(struct supernet_info *myinfo,char
jaddnum(valsobj,"hwm",virt->blocks.hwmchain.height); jaddnum(valsobj,"hwm",virt->blocks.hwmchain.height);
} }
} }
if ( symbol == 0 )
symbol = "BTCD";
encryptflag = jint(valsobj,"encrypt"); encryptflag = jint(valsobj,"encrypt");
delaymillis = jint(valsobj,"delay"); delaymillis = jint(valsobj,"delay");
ptr = basilisk_issueremote(myinfo,&numsent,CMD,"BTCD",blockflag,valsobj,fanout,minresults,0,timeoutmillis,0,0,encryptflag,delaymillis,nBits); ptr = basilisk_issueremote(myinfo,&numsent,CMD,symbol,blockflag,valsobj,fanout,minresults,0,timeoutmillis,0,0,encryptflag,delaymillis,nBits);
return(ptr); return(ptr);
} }
@ -541,8 +543,8 @@ void basilisks_loop(void *arg)
void basilisks_init(struct supernet_info *myinfo) void basilisks_init(struct supernet_info *myinfo)
{ {
iguana_initQ(&myinfo->basilisks.submitQ,"submitQ"); //iguana_initQ(&myinfo->basilisks.submitQ,"submitQ");
iguana_initQ(&myinfo->basilisks.resultsQ,"resultsQ"); //iguana_initQ(&myinfo->basilisks.resultsQ,"resultsQ");
portable_mutex_init(&myinfo->allcoins_mutex); portable_mutex_init(&myinfo->allcoins_mutex);
portable_mutex_init(&myinfo->basilisk_mutex); portable_mutex_init(&myinfo->basilisk_mutex);
portable_mutex_init(&myinfo->gecko_mutex); portable_mutex_init(&myinfo->gecko_mutex);

3
basilisk/basilisk.h

@ -39,7 +39,8 @@ struct basilisk_item
struct basilisk_info struct basilisk_info
{ {
queue_t resultsQ,submitQ; void *launched; //portable_mutex_t *mutex; //queue_t resultsQ,submitQ;
void *launched; //portable_mutex_t *mutex;
struct basilisk_item *issued; struct basilisk_item *issued;
struct basilisk_value values[8192]; int32_t numvalues; struct basilisk_value values[8192]; int32_t numvalues;
}; };

2
gecko/gecko_blocks.c

@ -67,7 +67,7 @@ struct iguana_bundle *gecko_bundleset(struct iguana_info *virt,struct iguana_blo
struct iguana_bundle *gecko_ensurebundle(struct iguana_info *virt,struct iguana_block *block,int32_t origheight,int32_t depth) struct iguana_bundle *gecko_ensurebundle(struct iguana_info *virt,struct iguana_block *block,int32_t origheight,int32_t depth)
{ {
int32_t hdrsi,bundlei,checkbundlei,height = origheight; bits256 zero; struct iguana_bundle *bp = 0; int32_t hdrsi,bundlei,checkbundlei,height = origheight; bits256 zero;
memset(zero.bytes,0,sizeof(zero)); memset(zero.bytes,0,sizeof(zero));
bundlei = (height % virt->chain->bundlesize); bundlei = (height % virt->chain->bundlesize);
hdrsi = (height / virt->chain->bundlesize); hdrsi = (height / virt->chain->bundlesize);

2
gecko/gecko_headers.c

@ -55,7 +55,7 @@ char *gecko_headersarrived(struct supernet_info *myinfo,struct iguana_info *virt
{ {
bits256 hash2,prevhash2; struct iguana_block *block; int32_t height,firstheight,i,len=0,n,num; struct iguana_msgblock msgB; char str[65],str2[65]; bits256 hash2,prevhash2; struct iguana_block *block; int32_t height,firstheight,i,len=0,n,num; struct iguana_msgblock msgB; char str[65],str2[65];
num = (int32_t)(datalen / 84); num = (int32_t)(datalen / 84);
printf("headers arrived.%d from %s\n",num,bits256_str(str,firsthash2)); printf("headers.%s arrived.%d from %s\n",virt->symbol,num,bits256_str(str,firsthash2));
if ( (block= iguana_blockfind("geckohdrs",virt,firsthash2)) != 0 && (firstheight= block->height) >= 0 ) if ( (block= iguana_blockfind("geckohdrs",virt,firsthash2)) != 0 && (firstheight= block->height) >= 0 )
{ {
gecko_blockhashupdate(virt,firsthash2,firstheight); gecko_blockhashupdate(virt,firsthash2,firstheight);

Loading…
Cancel
Save