From 54248ec9aae76780bd3d839399f62c2a0d153287 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 19 Jun 2016 17:52:19 -0300 Subject: [PATCH] test --- basilisk/basilisk.c | 6 ++++-- gecko/gecko_headers.c | 7 ++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/basilisk/basilisk.c b/basilisk/basilisk.c index 07a1aece1..d2a4e2311 100755 --- a/basilisk/basilisk.c +++ b/basilisk/basilisk.c @@ -584,6 +584,8 @@ char *_basilisk_rawtx(struct supernet_info *myinfo,struct iguana_info *coin,stru char *_basilisk_result(struct supernet_info *myinfo,struct iguana_info *coin,struct iguana_peer *addr,char *remoteaddr,uint32_t basilisktag,cJSON *valsobj,uint8_t *data,int32_t datalen) { + char strbuf[4096],*str = 0; + basilisk_addhexstr(&str,valsobj,strbuf,sizeof(strbuf),data,datalen); return(basilisk_result(myinfo,coin,0,remoteaddr,basilisktag,valsobj)); } @@ -677,7 +679,7 @@ INT_AND_ARRAY(basilisk,result,basilisktag,vals) ptr->basilisktag = basilisktag; strcpy(ptr->remoteaddr,remoteaddr); safecopy(ptr->CMD,jstr(vals,"origcmd"),sizeof(ptr->CMD)); - printf("(%s) -> Q.%u results vals.(%s)\n",ptr->CMD,basilisktag,ptr->retstr); + //printf("(%s) -> Q.%u results vals.(%s)\n",ptr->CMD,basilisktag,ptr->retstr); queue_enqueue("resultsQ",&myinfo->basilisks.resultsQ,&ptr->DL,0); return(clonestr("{\"result\":\"queued basilisk return\"}")); } else printf("null vals.(%s) or no hexmsg.%p\n",jprint(vals,0),vals); @@ -813,7 +815,7 @@ void basilisks_loop(void *arg) pending->metrics[n] = n + 1; else if ( (pending->metrics[n]= (*metricfunc)(myinfo,pending,ptr->retstr)) != 0. ) pending->childrendone++; - printf("%s.%u Add results[%d] <- (%s) metric %f\n",pending->CMD,pending->basilisktag,n,ptr->retstr,pending->metrics[n]); + printf("%s.%u Add results[%d] <- metric %f\n",pending->CMD,pending->basilisktag,n,pending->metrics[n]); pending->results[n] = ptr->retstr; if ( strcmp(ptr->CMD,"SEQ") == 0 ) { diff --git a/gecko/gecko_headers.c b/gecko/gecko_headers.c index 311b2db53..821d67e95 100755 --- a/gecko/gecko_headers.c +++ b/gecko/gecko_headers.c @@ -53,9 +53,9 @@ void gecko_blockhashupdate(struct iguana_info *virt,bits256 hash2,int32_t height char *gecko_headersarrived(struct supernet_info *myinfo,struct iguana_info *virt,char *remoteaddr,uint8_t *data,int32_t datalen,bits256 firsthash2) { - bits256 hash2,prevhash2; struct iguana_block *block; int32_t height,firstheight,i,len=0,n,num; struct iguana_msgblock msgB; + 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); - char str[65]; printf("headers arrived.%d from %s\n",num,bits256_str(str,firsthash2)); + printf("headers arrived.%d from %s\n",num,bits256_str(str,firsthash2)); if ( (block= iguana_blockfind("geckohdrs",virt,firsthash2)) != 0 && (firstheight= block->height) >= 0 ) { gecko_blockhashupdate(virt,firsthash2,firstheight); @@ -69,8 +69,9 @@ char *gecko_headersarrived(struct supernet_info *myinfo,struct iguana_info *virt height = (firstheight + i + 1); gecko_blockhashupdate(virt,hash2,height); printf("ht.%d %s %08x t.%u\n",height,bits256_str(str,hash2),msgB.H.bits,msgB.H.timestamp); - } else printf("ht.%d non prevhash i.%d\n",height,i); + } else printf("ht.%d non prevhash i.%d %s %s\n",height,i,bits256_str(str,prevhash2),bits256_str(str2,msgB.H.prev_block)); len += n; + prevhash2 = hash2; } } return(clonestr("{\"result\":\"gecko headers processed\"}"));