From 11b009badfb787a726e0734b2be43791686183e5 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 21 Jun 2016 20:03:31 -0300 Subject: [PATCH] test --- basilisk/basilisk.c | 26 +++++++++++++++----------- basilisk/basilisk.h | 2 +- basilisk/basilisk_bitcoin.c | 4 ++-- gecko/gecko_blocks.c | 2 +- gecko/gecko_miner.c | 4 ++-- 5 files changed, 21 insertions(+), 17 deletions(-) diff --git a/basilisk/basilisk.c b/basilisk/basilisk.c index 59ee43f28..40de93c91 100755 --- a/basilisk/basilisk.c +++ b/basilisk/basilisk.c @@ -162,7 +162,9 @@ struct basilisk_item *basilisk_itemcreate(struct supernet_info *myinfo,char *CMD if ( (ptr->numrequired= minresults) == 0 ) ptr->numrequired = 1; if ( (ptr->metricfunc= metricfunc) != 0 ) - ptr->vals = jduplicate(vals); + { + //ptr->vals = jduplicate(vals); + } strcpy(ptr->CMD,CMD); safecopy(ptr->symbol,symbol,sizeof(ptr->symbol)); ptr->expiration = OS_milliseconds() + timeoutmillis; @@ -319,14 +321,14 @@ void basilisk_sendback(struct supernet_info *myinfo,char *origCMD,char *symbol,c } } -char *basilisk_waitresponse(struct supernet_info *myinfo,char *CMD,char *symbol,char *remoteaddr,struct basilisk_item *Lptr,struct basilisk_item *ptr) +char *basilisk_waitresponse(struct supernet_info *myinfo,char *CMD,char *symbol,char *remoteaddr,struct basilisk_item *Lptr,cJSON *vals,struct basilisk_item *ptr) { char *retstr = 0; if ( ptr == Lptr ) { if ( (retstr= Lptr->retstr) == 0 ) retstr = clonestr("{\"result\":\"null return from local basilisk_issuecmd\"}"); - ptr = basilisk_itemcreate(myinfo,CMD,symbol,Lptr->basilisktag,Lptr->numrequired,Lptr->vals,OS_milliseconds() - Lptr->expiration,Lptr->metricfunc); + ptr = basilisk_itemcreate(myinfo,CMD,symbol,Lptr->basilisktag,Lptr->numrequired,vals,OS_milliseconds() - Lptr->expiration,Lptr->metricfunc); queue_enqueue("submitQ",&myinfo->basilisks.submitQ,&ptr->DL,0); } else @@ -420,10 +422,10 @@ char *basilisk_standardservice(char *CMD,struct supernet_info *myinfo,bits256 ha { if ( ptr->expiration <= OS_milliseconds() ) ptr->expiration = OS_milliseconds() + BASILISK_TIMEOUT; - ptr->vals = jduplicate(valsobj); + //ptr->vals = jduplicate(valsobj); strcpy(ptr->symbol,"BTCD"); strcpy(ptr->CMD,CMD); - return(basilisk_waitresponse(myinfo,CMD,"BTCD",0,&Lptr,ptr)); + return(basilisk_waitresponse(myinfo,CMD,"BTCD",0,&Lptr,valsobj,ptr)); } else if ( ptr->numsent > 0 ) { @@ -450,7 +452,7 @@ void basilisk_functions(struct iguana_info *coin,int32_t protocol) case IGUANA_PROTOCOL_BITCOIN: coin->basilisk_balances = basilisk_bitcoinbalances; coin->basilisk_rawtx = basilisk_bitcoinrawtx; - coin->basilisk_rawtxmetric = basilisk_bitcoin_rawtxmetric; + //coin->basilisk_rawtxmetric = basilisk_bitcoin_rawtxmetric; coin->basilisk_value = basilisk_bitcoinvalue; coin->basilisk_valuemetric = basilisk_bitcoin_valuemetric; break; @@ -540,7 +542,9 @@ struct basilisk_item *basilisk_issuecmd(struct basilisk_item *Lptr,basilisk_func if ( (ptr= (*func)(Lptr,myinfo,coin,remoteaddr,basilisktag,timeoutmillis,vals)) != 0 ) { if ( (ptr->metricfunc= metricfunc) != 0 ) - ptr->vals = jduplicate(vals); + { + //ptr->vals = jduplicate(vals); + } strcpy(ptr->symbol,symbol); ptr->basilisktag = basilisktag; ptr->expiration = OS_milliseconds() + timeoutmillis; @@ -572,7 +576,7 @@ char *basilisk_standardcmd(struct supernet_info *myinfo,char *CMD,char *activeco { if ( (ptr= basilisk_issuecmd(&Lptr,func,metric,myinfo,remoteaddr,basilisktag,activecoin,timeoutmillis,vals)) != 0 ) { - return(basilisk_waitresponse(myinfo,CMD,coin->symbol,remoteaddr,&Lptr,ptr)); + return(basilisk_waitresponse(myinfo,CMD,coin->symbol,remoteaddr,&Lptr,vals,ptr)); } else return(clonestr("{\"error\":\"null return from basilisk_issuecmd\"}")); } else return(clonestr("{\"error\":\"couldnt get coin\"}")); @@ -701,7 +705,7 @@ INT_ARRAY_STRING(basilisk,rawtx,basilisktag,vals,activecoin) ptr->numrequired = 1; ptr->uniqueflag = 1; ptr->metricdir = -1; - return(basilisk_waitresponse(myinfo,"RAW",coin->symbol,remoteaddr,&Lptr,ptr)); + return(basilisk_waitresponse(myinfo,"RAW",coin->symbol,remoteaddr,&Lptr,vals,ptr)); } else return(clonestr("{\"error\":\"error issuing basilisk rawtx\"}")); } else return(retstr); } @@ -906,8 +910,8 @@ int32_t basilisk_issued_iteration(struct supernet_info *myinfo,struct basilisk_i for (i=0; inumresults; i++) if ( pending->results[i] != 0 ) free(pending->results[i]), pending->results[i] = 0; - if ( pending->vals != 0 ) - free_json(pending->vals), pending->vals = 0; + //if ( pending->vals != 0 ) + // free_json(pending->vals), pending->vals = 0; free(pending); flag++; } diff --git a/basilisk/basilisk.h b/basilisk/basilisk.h index a408ebb5b..5e7465885 100755 --- a/basilisk/basilisk.h +++ b/basilisk/basilisk.h @@ -35,7 +35,7 @@ struct basilisk_item uint32_t submit,finished,basilisktag,numresults,numsent,numexact,uniqueflag,numrequired,childrendone,numchildren,nBits; int32_t refcount; char symbol[32],CMD[4],remoteaddr[64]; - double expiration; cJSON *vals; int32_t metricdir; void *metricfunc; + double expiration; int32_t metricdir; void *metricfunc; //cJSON *vals; char *retstr,*results[BASILISK_MAXFANOUT]; double metrics[BASILISK_MAXFANOUT]; }; diff --git a/basilisk/basilisk_bitcoin.c b/basilisk/basilisk_bitcoin.c index e844bb5d3..f49b922ce 100755 --- a/basilisk/basilisk_bitcoin.c +++ b/basilisk/basilisk_bitcoin.c @@ -372,7 +372,7 @@ void *basilisk_bitcoinvalue(struct basilisk_item *Lptr,struct supernet_info *myi return(ptr); } -double basilisk_bitcoin_rawtxmetric_dependents(struct supernet_info *myinfo,struct iguana_info *coin,struct basilisk_item *ptr,struct bitcoin_rawtxdependents *dependents) +/*double basilisk_bitcoin_rawtxmetric_dependents(struct supernet_info *myinfo,struct iguana_info *coin,struct basilisk_item *ptr,struct bitcoin_rawtxdependents *dependents) { int32_t i,j,numaddrs,notfinished = 0; cJSON *childjson,*addresses; struct basilisk_item *child; double metric = 0.; char *childstr,*coinaddr; int64_t inputsum,value,txfee; for (i=0; inumptrs; i++) @@ -569,7 +569,7 @@ double basilisk_bitcoin_rawtxmetric(struct supernet_info *myinfo,struct basilisk cost = 1; dependents->cost = cost; return(0.); -} +}*/ void *basilisk_bitcoinrawtx(struct basilisk_item *Lptr,struct supernet_info *myinfo,struct iguana_info *coin,char *remoteaddr,uint32_t basilisktag,int32_t timeoutmillis,cJSON *valsobj) { diff --git a/gecko/gecko_blocks.c b/gecko/gecko_blocks.c index b46e35d0c..9d5b21695 100755 --- a/gecko/gecko_blocks.c +++ b/gecko/gecko_blocks.c @@ -295,7 +295,7 @@ int32_t basilisk_blocksubmit(struct supernet_info *myinfo,struct iguana_info *bt { valsobj = cJSON_CreateObject(); jaddnum(valsobj,"minresults",myinfo->numrelays - 1); - jaddnum(valsobj,"timeout",1000); + jaddnum(valsobj,"timeout",10000); jaddnum(valsobj,"fanout",-1); jaddstr(valsobj,"symbol",virt->symbol); if ( (str2= basilisk_standardservice("BLK",myinfo,hash2,valsobj,blockstr,1)) != 0 ) diff --git a/gecko/gecko_miner.c b/gecko/gecko_miner.c index fedf64280..a0ce464f9 100755 --- a/gecko/gecko_miner.c +++ b/gecko/gecko_miner.c @@ -374,8 +374,8 @@ void gecko_miner(struct supernet_info *myinfo,struct iguana_info *btcd,struct ig free(blockstr); else { - virt->newblockstr = blockstr; - virt->newblock = newblock; + //virt->newblockstr = blockstr; + //virt->newblock = newblock; } } if ( txptrs != (void *)space )