From 366e5f68374747d20367293046e84060338a4180 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 3 Jul 2016 08:24:59 -0300 Subject: [PATCH] test --- basilisk/basilisk.c | 2 +- basilisk/basilisk_CMD.c | 20 ++++++++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/basilisk/basilisk.c b/basilisk/basilisk.c index bb077ee15..464d57edc 100755 --- a/basilisk/basilisk.c +++ b/basilisk/basilisk.c @@ -677,7 +677,7 @@ void basilisk_msgprocess(struct supernet_info *myinfo,void *_addr,uint32_t sende if ( retstr != 0 ) free(retstr); break; - } //else printf("services null return\n"); + } else printf("services null return\n"); } else printf("non-relay got unexpected.(%s)\n",type); } } diff --git a/basilisk/basilisk_CMD.c b/basilisk/basilisk_CMD.c index c94208799..943e35824 100755 --- a/basilisk/basilisk_CMD.c +++ b/basilisk/basilisk_CMD.c @@ -183,13 +183,29 @@ char *basilisk_respond_VPNmessage(struct supernet_info *myinfo,char *CMD,void *a char *basilisk_respond_rawtx(struct supernet_info *myinfo,char *CMD,void *addr,char *remoteaddr,uint32_t basilisktag,cJSON *valsobj,uint8_t *data,int32_t datalen,bits256 hash,int32_t from_basilisk) { - char *retstr=0; + char *symbol,*retstr=0; struct basilisk_item Lptr,*ptr; int32_t timeoutmillis; struct iguana_info *coin = 0; + timeoutmillis = jint(valsobj,"timeout"); + if ( (symbol= jstr(valsobj,"coin")) != 0 || (symbol= jstr(valsobj,"symbol")) != 0 ) + coin = iguana_coinfind(symbol); + if ( coin != 0 && (ptr= basilisk_bitcoinrawtx(&Lptr,myinfo,coin,remoteaddr,basilisktag,timeoutmillis,valsobj)) != 0 ) + { + retstr = ptr->retstr; + ptr->finished = (uint32_t)time(NULL); + } else retstr = clonestr("{\"error\":\"no coin specified or error bitcoinrawtx\"}"); return(retstr); } char *basilisk_respond_value(struct supernet_info *myinfo,char *CMD,void *addr,char *remoteaddr,uint32_t basilisktag,cJSON *valsobj,uint8_t *data,int32_t datalen,bits256 hash,int32_t from_basilisk) { - char *retstr=0; + char *symbol,*retstr=0; struct basilisk_item Lptr,*ptr; int32_t timeoutmillis; struct iguana_info *coin = 0; + timeoutmillis = jint(valsobj,"timeout"); + if ( (symbol= jstr(valsobj,"coin")) != 0 || (symbol= jstr(valsobj,"symbol")) != 0 ) + coin = iguana_coinfind(symbol); + if ( coin != 0 && (ptr= basilisk_bitcoinvalue(&Lptr,myinfo,coin,remoteaddr,basilisktag,timeoutmillis,valsobj)) != 0 ) + { + retstr = ptr->retstr; + ptr->finished = (uint32_t)time(NULL); + } else retstr = clonestr("{\"error\":\"no coin specified or error bitcoinrawtx\"}"); return(retstr); }