Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
37726aeaca
  1. 2
      basilisk/basilisk.c
  2. 6
      gecko/gecko_blocks.c
  3. 12
      gecko/gecko_miner.c
  4. 2
      iguana/iguana_msg.c
  5. 6
      iguana/iguana_peers.c

2
basilisk/basilisk.c

@ -145,7 +145,7 @@ int32_t basilisk_sendcmd(struct supernet_info *myinfo,char *destipaddr,char *typ
{ {
if ( destipaddr[0] == 0 ) if ( destipaddr[0] == 0 )
destipaddr = 0; // broadcast destipaddr = 0; // broadcast
else if ( strcmp(destipaddr,"127.0.0.1") == 0 ) else if ( strcmp(destipaddr,"127.0.0.1") == 0 || strcmp(destipaddr,myinfo->ipaddr) == 0 )
{ {
printf("return after locally basilisk_msgprocess\n"); printf("return after locally basilisk_msgprocess\n");
hash = GENESIS_PUBKEY; hash = GENESIS_PUBKEY;

6
gecko/gecko_blocks.c

@ -292,10 +292,10 @@ char *basilisk_respond_geckoblock(struct supernet_info *myinfo,char *CMD,void *a
int32_t basilisk_blocksubmit(struct supernet_info *myinfo,struct iguana_info *btcd,struct iguana_info *virt,char *blockstr,bits256 hash2,int32_t height) int32_t basilisk_blocksubmit(struct supernet_info *myinfo,struct iguana_info *btcd,struct iguana_info *virt,char *blockstr,bits256 hash2,int32_t height)
{ {
int32_t i,datalen,num,numerrs,numresults=-1; uint8_t *data,space[16384],*allocptr; cJSON *valsobj=0,*retjson,*retarray,*item; char *str,*str2,*othercoin; bits256 othertip; int32_t i,datalen,num,numerrs,numresults=0; uint8_t *data,space[16384],*allocptr; cJSON *valsobj=0,*retjson,*retarray,*item; char *str,*str2,*othercoin; bits256 othertip;
if ( (data= get_dataptr(sizeof(struct iguana_msghdr) + BASILISK_HDROFFSET,&allocptr,&datalen,space,sizeof(space),blockstr)) != 0 ) if ( (data= get_dataptr(sizeof(struct iguana_msghdr) + BASILISK_HDROFFSET,&allocptr,&datalen,space,sizeof(space),blockstr)) != 0 )
{ {
if ( (str= gecko_blockarrived(myinfo,virt,"127.0.0.1",data,datalen,hash2,1)) != 0 ) if ( (str= gecko_blockarrived(myinfo,virt,"127.0.0.1",data,datalen,hash2,0)) != 0 )
{ {
if ( (retjson= cJSON_Parse(str)) != 0 ) if ( (retjson= cJSON_Parse(str)) != 0 )
{ {
@ -307,7 +307,7 @@ int32_t basilisk_blocksubmit(struct supernet_info *myinfo,struct iguana_info *bt
jaddnum(valsobj,"fanout",-1); jaddnum(valsobj,"fanout",-1);
jaddnum(valsobj,"height",height); jaddnum(valsobj,"height",height);
jaddstr(valsobj,"symbol",virt->symbol); jaddstr(valsobj,"symbol",virt->symbol);
if ( (str2= basilisk_standardservice("BLK",myinfo,hash2,valsobj,blockstr,0)) != 0 ) if ( 0 && (str2= basilisk_standardservice("BLK",myinfo,hash2,valsobj,blockstr,0)) != 0 )
{ {
if ( (retarray= cJSON_Parse(str2)) != 0 ) if ( (retarray= cJSON_Parse(str2)) != 0 )
{ {

12
gecko/gecko_miner.c

@ -307,9 +307,9 @@ int32_t gecko_blocksubmit(struct supernet_info *myinfo,struct iguana_info *btcd,
{ {
uint8_t *data,space[16384],*allocptr=0; int32_t i,len,numranked=0; struct iguana_peers *peers; struct iguana_peer *addr; uint8_t *data,space[16384],*allocptr=0; int32_t i,len,numranked=0; struct iguana_peers *peers; struct iguana_peer *addr;
//printf("submit.(%s)\n",blockstr); //printf("submit.(%s)\n",blockstr);
if ( (peers= virt->peers) == 0 || (numranked= peers->numranked) == 0 ) if ( (peers= virt->peers) != 0 && (numranked= peers->numranked) > 0 )
{ {
if ( basilisk_blocksubmit(myinfo,btcd,virt,blockstr,hash2,height) < (myinfo->numrelays >> 1) ) if ( basilisk_blocksubmit(myinfo,btcd,virt,blockstr,hash2,height) < 0 )//(myinfo->numrelays >> 1) )
return(-1); return(-1);
} }
else // physical node for geckochain else // physical node for geckochain
@ -341,9 +341,9 @@ void gecko_miner(struct supernet_info *myinfo,struct iguana_info *btcd,struct ig
if ( (virt->blocks.hwmchain.height % myinfo->numrelays) != myinfo->RELAYID ) if ( (virt->blocks.hwmchain.height % myinfo->numrelays) != myinfo->RELAYID )
{ {
//if ( myinfo->numrelays < 3 ) //if ( myinfo->numrelays < 3 )
return; // return;
gap = (int32_t)(time(NULL) - virt->backstoptime) / virt->chain->estblocktime; gap = (int32_t)(time(NULL) - virt->backstoptime) / virt->chain->estblocktime;
for (i=0; i<gap; i++) for (i=1; i<gap; i++)
{ {
if ( ((virt->blocks.hwmchain.height+i) % myinfo->numrelays) == myinfo->RELAYID ) if ( ((virt->blocks.hwmchain.height+i) % myinfo->numrelays) == myinfo->RELAYID )
break; break;
@ -352,14 +352,14 @@ void gecko_miner(struct supernet_info *myinfo,struct iguana_info *btcd,struct ig
return; return;
} }
#endif #endif
if ( virt->newblockstr != 0 ) /*if ( virt->newblockstr != 0 )
{ {
gecko_blocksubmit(myinfo,btcd,virt,virt->newblockstr,virt->newblock.RO.hash2,virt->newblock.height); gecko_blocksubmit(myinfo,btcd,virt,virt->newblockstr,virt->newblock.RO.hash2,virt->newblock.height);
memset(&virt->newblock,0,sizeof(virt->newblock)); memset(&virt->newblock,0,sizeof(virt->newblock));
free(virt->newblockstr); free(virt->newblockstr);
virt->newblockstr = 0; virt->newblockstr = 0;
return; return;
} }*/
memset(&newblock,0,sizeof(newblock)); memset(&newblock,0,sizeof(newblock));
newblock.height = virt->blocks.hwmchain.height + 1; newblock.height = virt->blocks.hwmchain.height + 1;
newblock.RO.prev_block = virt->blocks.hwmchain.RO.hash2; newblock.RO.prev_block = virt->blocks.hwmchain.RO.hash2;

2
iguana/iguana_msg.c

@ -820,7 +820,7 @@ int32_t iguana_msgparser(struct iguana_info *coin,struct iguana_peer *addr,struc
ipaddr = addr->ipaddr; ipaddr = addr->ipaddr;
} else ipaddr = 0; } else ipaddr = 0;
len = recvlen; len = recvlen;
printf("GOT.(%s) len.%d from %s\n",H->command,recvlen,addr->ipaddr); //printf("GOT.(%s) len.%d from %s\n",H->command,recvlen,addr->ipaddr);
basilisk_p2p(myinfo,addr,ipaddr,data,recvlen,&H->command[strlen("SuperNET")],H->command[6] == 'e' && H->command[7] == 't'); basilisk_p2p(myinfo,addr,ipaddr,data,recvlen,&H->command[strlen("SuperNET")],H->command[6] == 'e' && H->command[7] == 't');
return(0); return(0);
} }

6
iguana/iguana_peers.c

@ -463,9 +463,9 @@ int32_t iguana_send(struct iguana_info *coin,struct iguana_peer *addr,uint8_t *s
remains = len; remains = len;
if ( strncmp(cmdstr+1,"uperNET",strlen("uperNET")) == 0 || strncmp(cmdstr+1,"uperNet",strlen("uperNet")) == 0 ) if ( strncmp(cmdstr+1,"uperNET",strlen("uperNET")) == 0 || strncmp(cmdstr+1,"uperNet",strlen("uperNet")) == 0 )
{ {
for (i=0; i<len-sizeof(struct iguana_msghdr); i++) //for (i=0; i<len-sizeof(struct iguana_msghdr); i++)
printf("%02x",serialized[i+sizeof(struct iguana_msghdr)]); // printf("%02x",serialized[i+sizeof(struct iguana_msghdr)]);
printf(" >>>>>>> send.(%s) crc.%x %d bytes to %s:%u supernet.%d\n",cmdstr,calc_crc32(0,serialized,len),len,addr->ipaddr,addr->A.port,addr->supernet); //printf(" >>>>>>> send.(%s) crc.%x %d bytes to %s:%u supernet.%d\n",cmdstr,calc_crc32(0,serialized,len),len,addr->ipaddr,addr->A.port,addr->supernet);
} }
else if ( addr->msgcounts.verack == 0 && (strcmp(cmdstr,"version") != 0 && strcmp(cmdstr,"ConnectTo") != 0 && strcmp(cmdstr,"verack") != 0) != 0 ) else if ( addr->msgcounts.verack == 0 && (strcmp(cmdstr,"version") != 0 && strcmp(cmdstr,"ConnectTo") != 0 && strcmp(cmdstr,"verack") != 0) != 0 )
{ {

Loading…
Cancel
Save