Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
8d1d187f69
  1. 8
      basilisk/basilisk.c
  2. 6
      basilisk/basilisk_CMD.c
  3. 4
      gecko/gecko.c
  4. 1
      gecko/gecko_blocks.c
  5. 5
      iguana/iguana_json.c
  6. 2
      iguana/main.c

8
basilisk/basilisk.c

@ -799,14 +799,18 @@ void basilisks_loop(void *arg)
iter++;
if ( (ptr= queue_dequeue(&myinfo->basilisks.submitQ,0)) != 0 )
{
portable_mutex_lock(&myinfo->basilisk_mutex);
HASH_ADD(hh,myinfo->basilisks.issued,basilisktag,sizeof(ptr->basilisktag),ptr);
portable_mutex_unlock(&myinfo->basilisk_mutex);
ptr->refcount++;
continue;
}
//fprintf(stderr,"A");
if ( (ptr= queue_dequeue(&myinfo->basilisks.resultsQ,0)) != 0 )
{
portable_mutex_lock(&myinfo->basilisk_mutex);
HASH_FIND(hh,myinfo->basilisks.issued,&ptr->basilisktag,sizeof(ptr->basilisktag),pending);
portable_mutex_unlock(&myinfo->basilisk_mutex);
if ( pending != 0 )
{
if ( (n= pending->numresults) < sizeof(pending->results)/sizeof(*pending->results) )
@ -844,6 +848,7 @@ void basilisks_loop(void *arg)
}
//fprintf(stderr,"B");
flag = 0;
portable_mutex_lock(&myinfo->basilisk_mutex);
HASH_ITER(hh,myinfo->basilisks.issued,pending,tmp)
{
//printf("pending.%u numresults.%d m %f func.%p\n",pending->basilisktag,pending->numresults,pending->metrics[0],pending->metricfunc);
@ -894,12 +899,13 @@ void basilisks_loop(void *arg)
free(pending->results[i]), pending->results[i] = 0;
if ( pending->vals != 0 )
free_json(pending->vals), pending->vals = 0;
//free(pending);
free(pending);
} else printf("illegal refcount for pending\n");
flag++;
}
}
}
portable_mutex_unlock(&myinfo->basilisk_mutex);
//fprintf(stderr,"D");
if ( (btcd= iguana_coinfind("BTCD")) != 0 )
{

6
basilisk/basilisk_CMD.c

@ -59,14 +59,14 @@ char *basilisk_addrelay_info(struct supernet_info *myinfo,uint8_t *pubkey33,uint
myinfo->numrelays++;
for (i=0; i<myinfo->numrelays; i++)
memcpy(&myinfo->relaybits[i],&myinfo->relays[i].ipbits,sizeof(myinfo->relaybits[i]));
/*revsort32(&myinfo->relaybits[0],myinfo->numrelays,sizeof(myinfo->relaybits[0]));
revsort32(&myinfo->relaybits[0],myinfo->numrelays,sizeof(myinfo->relaybits[0]));
for (i=0; i<myinfo->numrelays; i++)
{
char ipaddr[64];
expand_ipbits(ipaddr,myinfo->relaybits[i]);
printf("%s ",ipaddr);
}
printf("sorted\n");*/
printf("sorted\n");
return(clonestr("{\"result\":\"relay added\"}"));
}
@ -114,7 +114,7 @@ int32_t basilisk_relays_send(struct supernet_info *myinfo,struct iguana_peer *ad
init_hexbytes_noT(hexstr,serialized,len);
//printf("send relays.(%s)\n",hexstr);
vcalc_sha256(0,txhash2.bytes,serialized,len);
if ( (siglen= bitcoin_sign(myinfo->ctx,"BTCD",sig,txhash2,myinfo->persistent_priv,1)) > 0 )
if ( 0 && bits256_nonz(myinfo->persistent_priv) != 0 && (siglen= bitcoin_sign(myinfo->ctx,"BTCD",sig,txhash2,myinfo->persistent_priv,1)) > 0 )
{
init_hexbytes_noT(strbuf,sig,siglen);
jaddstr(vals,"sig",strbuf);

4
gecko/gecko.c

@ -287,9 +287,9 @@ cJSON *gecko_genesisissue(char *symbol,char *chainname,char *chainstr,cJSON *val
struct iguana_info *basilisk_geckochain(struct supernet_info *myinfo,char *symbol,char *chainname,cJSON *valsobj)
{
int32_t datalen,hdrsize,len=0; struct iguana_info *virt=0; char *hexstr; uint8_t hexbuf[1024],*ptr,*serialized; struct iguana_peer *addr; struct iguana_txblock txdata;
int32_t datalen,hdrsize,len=0; struct iguana_info *virt=0; char *hexstr; uint8_t hexbuf[8192],*ptr,*serialized; struct iguana_peer *addr; struct iguana_txblock txdata;
portable_mutex_lock(&myinfo->gecko_mutex);
printf("symbol.%s chain.%s (%s)\n",symbol,chainname,jprint(valsobj,0));
printf("basilisk_geckochain symbol.%s chain.%s (%s)\n",symbol,chainname,jprint(valsobj,0));
if ( iguana_coinfind(symbol) == 0 && (hexstr= jstr(valsobj,"genesisblock")) != 0 && (virt= iguana_coinadd(symbol,chainname,valsobj)) != 0 )
{
safecopy(virt->name,chainname,sizeof(virt->name));

1
gecko/gecko_blocks.c

@ -288,6 +288,7 @@ int32_t basilisk_blocksubmit(struct supernet_info *myinfo,struct iguana_info *bt
if ( jobj(retjson,"error") == 0 )
{
valsobj = cJSON_CreateObject();
jaddnum(valsobj,"timeout",1000);
jaddnum(valsobj,"fanout",-1);
jaddstr(valsobj,"symbol",virt->symbol);
if ( (str2= basilisk_standardservice("BLK",myinfo,hash2,valsobj,blockstr,1)) != 0 )

5
iguana/iguana_json.c

@ -606,11 +606,6 @@ ZERO_ARGS(bitcoinrpc,getdifficulty)
char buf[512];
if ( coin != 0 )
{
/* {
"proof-of-work": 15432589.66327462,
"proof-of-stake": 0.00112314,
"search-interval": 0
}*/
sprintf(buf,"{\"result\":\"success\",\"proof-of-work\":\"%.8f\",\"search-interval\": 0}",PoW_from_compact(coin->blocks.hwmchain.RO.bits,coin->chain->unitval));
return(clonestr(buf));
} else return(clonestr("{\"error\":\"getdifficulty needs coin\"}"));

2
iguana/main.c

@ -1154,7 +1154,7 @@ void iguana_appletests(struct supernet_info *myinfo)
bitcoin_sharedsecret(myinfo->ctx,hash2,pubkey,33);
printf("secp256k1 elapsed %.3f for %d iterations\n",OS_milliseconds() - startmillis,i);
getchar();**/
if ( 1 && (str= SuperNET_JSON(myinfo,cJSON_Parse("{\"protover\":70002,\"RELAY\":1,\"VALIDATE\":0,\"portp2p\":14631,\"rpc\":14632,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":64,\"endpend\":64,\"services\":129,\"maxpeers\":128,\"newcoin\":\"BTCD\",\"active\":1,\"numhelpers\":4,\"poll\":1}"),0,myinfo->rpcport)) != 0 )
if ( 1 && (str= SuperNET_JSON(myinfo,cJSON_Parse("{\"protover\":70002,\"RELAY\":1,\"VALIDATE\":1,\"portp2p\":14631,\"rpc\":14632,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":64,\"endpend\":64,\"services\":129,\"maxpeers\":128,\"newcoin\":\"BTCD\",\"active\":1,\"numhelpers\":4,\"poll\":1}"),0,myinfo->rpcport)) != 0 )
{
free(str);
if ( 0 && (str= SuperNET_JSON(myinfo,cJSON_Parse("{\"portp2p\":8333,\"RELAY\":0,\"VALIDATE\":0,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":1,\"endpend\":1,\"services\":128,\"maxpeers\":64,\"newcoin\":\"BTC\",\"active\":0,\"numhelpers\":4,\"poll\":100}"),0,myinfo->rpcport)) != 0 )

Loading…
Cancel
Save