Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
bd45a5b2a6
  1. 12
      basilisk/basilisk.c
  2. 2
      gecko/gecko.h
  3. 12
      gecko/gecko_miner.c

12
basilisk/basilisk.c

@ -403,6 +403,7 @@ char *basilisk_standardservice(char *CMD,struct supernet_info *myinfo,bits256 ha
}
else if ( ptr->numsent > 0 )
{
queue_enqueue("submitQ",&myinfo->basilisks.submitQ,&ptr->DL,0);
jaddstr(retjson,"result","success");
jaddnum(retjson,"numsent",ptr->numsent);
} else jaddstr(retjson,"error","didnt find any nodes to send to");
@ -1073,9 +1074,12 @@ void basilisk_msgprocess(struct supernet_info *myinfo,void *_addr,uint32_t sende
if ( datalen > jsonlen )
{
data += jsonlen, datalen -= jsonlen;
//for (i=0; i<datalen; i++)
// printf("%02x",data[i]);
//printf(" <-> got datalen.%d\n",datalen);
if ( strcmp("BLK",CMD) == 0 )
{
for (i=0; i<datalen; i++)
printf("%02x",data[i]);
printf(" <-> got datalen.%d\n",datalen);
}
} else data = 0, datalen = 0;
if ( coin == 0 )
coin = iguana_coinfind("BTCD");
@ -1101,6 +1105,8 @@ void basilisk_msgprocess(struct supernet_info *myinfo,void *_addr,uint32_t sende
retstr = basilisk_respond_relays(myinfo,type,addr,remoteaddr,basilisktag,valsobj,data,datalen,hash,from_basilisk);
}
free_json(valsobj);
if ( coin != 0 )
coin->basilisk_busy = 0;
myinfo->basilisk_busy = 0;
return;
}

2
gecko/gecko.h

@ -29,7 +29,7 @@
#define GECKO_MAXNAMELEN 64
#define GECKO_MAXMINERITERS 10000000
#define GECKO_DIFFITERS 13
#define GECKO_MAXFUTUREBLOCK 3
#define GECKO_MAXFUTUREBLOCK 60
struct iguana_peer;

12
gecko/gecko_miner.c

@ -29,18 +29,23 @@ int32_t gecko_blocknonce_verify(struct iguana_info *virt,uint8_t *serialized,int
if ( 1 && timestamp != 0 && prevtimestamp != 0 )
{
if ( prevtimestamp != 0 && timestamp < gecko_earliest_blocktime(virt->chain->estblocktime,prevtimestamp) )
{
printf("reject timestamp prev.%u %u earliest.%u\n",prevtimestamp,timestamp,gecko_earliest_blocktime(virt->chain->estblocktime,prevtimestamp));
return(-1);
}
if ( timestamp > time(NULL) + GECKO_MAXFUTUREBLOCK )
{
printf("reject future timestamp.%u vs %u\n",timestamp,(uint32_t)time(NULL));
return(-1);
}
}
threshold = bits256_from_compact(nBits);
hash2 = iguana_calcblockhash(virt->symbol,virt->chain->hashalgo,serialized,datalen);
if ( bits256_cmp(threshold,hash2) > 0 )
{
printf("nonce worked crc.%d\n",calc_crc32(0,serialized,datalen));
printf("nonce worked crc.%x\n",calc_crc32(0,serialized,datalen));
return(1);
}
printf("nonce failed crc.%d\n",calc_crc32(0,serialized,datalen));
} else printf("nonce failed crc.%x\n",calc_crc32(0,serialized,datalen));
return(-1);
}
@ -299,6 +304,7 @@ cJSON *gecko_paymentsobj(struct supernet_info *myinfo,cJSON *txjson,cJSON *valso
void gecko_blocksubmit(struct supernet_info *myinfo,struct iguana_info *btcd,struct iguana_info *virt,char *blockstr,bits256 hash2)
{
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);
if ( (peers= virt->peers) == 0 || (numranked= peers->numranked) == 0 )
basilisk_blocksubmit(myinfo,btcd,virt,blockstr,hash2);
else // physical node for geckochain

Loading…
Cancel
Save