From df83817f10dcab20722c8788f4aa90659a59f77c Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 19 Sep 2016 07:20:01 -0300 Subject: [PATCH] test --- basilisk/basilisk.c | 15 ++++++--------- basilisk/basilisk_CMD.c | 6 +++--- basilisk/basilisk_bitcoin.c | 2 +- iguana/iguana_msg.c | 7 +++++-- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/basilisk/basilisk.c b/basilisk/basilisk.c index 05df1dbf7..5586edc31 100755 --- a/basilisk/basilisk.c +++ b/basilisk/basilisk.c @@ -840,7 +840,7 @@ void basilisk_requests_poll(struct supernet_info *myinfo) void basilisks_loop(void *arg) { - struct iguana_info *virt,*tmpcoin,*coin,*btcd; struct basilisk_message *msg,*tmpmsg; struct basilisk_item *tmp,*pending; uint32_t now; int32_t iter,maxmillis,flag=0; struct supernet_info *myinfo = arg; + struct iguana_info *virt,*tmpcoin,*coin,*notary; struct basilisk_message *msg,*tmpmsg; struct basilisk_item *tmp,*pending; uint32_t now; int32_t iter,maxmillis,flag=0; struct supernet_info *myinfo = arg; iter = 0; while ( 1 ) { @@ -856,7 +856,7 @@ void basilisks_loop(void *arg) } } portable_mutex_unlock(&myinfo->basilisk_mutex); - if ( (btcd= iguana_coinfind("BTCD")) != 0 ) + if ( (notary= iguana_coinfind("NOTARY")) != 0 && myinfo->NOTARY.RELAYID >= 0 ) { maxmillis = (1000 / (myinfo->allcoins_numvirts + 1)) + 1; //portable_mutex_lock(&myinfo->allcoins_mutex); @@ -864,14 +864,11 @@ void basilisks_loop(void *arg) { if ( virt->started != 0 && virt->active != 0 && virt->virtualchain != 0 ) { - gecko_iteration(myinfo,btcd,virt,maxmillis), flag++; + gecko_iteration(myinfo,notary,virt,maxmillis), flag++; } } //portable_mutex_unlock(&myinfo->allcoins_mutex); - if ( myinfo->NOTARY.RELAYID >= 0 ) - { - basilisk_ping_send(myinfo,btcd); - } + basilisk_ping_send(myinfo,notary); } if ( myinfo->expiration != 0 ) { @@ -885,9 +882,9 @@ void basilisks_loop(void *arg) //printf(">>>>>>>>>>>>> update %s finished\n",coin->symbol); } } + if ( myinfo->NOTARY.RELAYID < 0 ) + basilisk_requests_poll(myinfo); } - if ( myinfo->NOTARY.RELAYID < 0 && myinfo->expiration != 0 ) - basilisk_requests_poll(myinfo); now = (uint32_t)time(NULL); portable_mutex_lock(&myinfo->messagemutex); HASH_ITER(hh,myinfo->messagetable,msg,tmpmsg) diff --git a/basilisk/basilisk_CMD.c b/basilisk/basilisk_CMD.c index dc0873610..64f2ebb0d 100755 --- a/basilisk/basilisk_CMD.c +++ b/basilisk/basilisk_CMD.c @@ -218,7 +218,7 @@ char *basilisk_respond_value(struct supernet_info *myinfo,char *CMD,void *addr,c { retstr = ptr->retstr; ptr->finished = (uint32_t)time(NULL); - } else retstr = clonestr("{\"error\":\"no coin specified or error bitcoinrawtx\"}"); + } else retstr = clonestr("{\"error\":\"no coin specified or error bitcoin value\"}"); return(retstr); } @@ -232,7 +232,7 @@ char *basilisk_respond_balances(struct supernet_info *myinfo,char *CMD,void *add { retstr = ptr->retstr; ptr->finished = (uint32_t)time(NULL); - } else retstr = clonestr("{\"error\":\"no coin specified or error bitcoinrawtx\"}"); + } else retstr = clonestr("{\"error\":\"no coin specified or error bitcoin balances\"}"); return(retstr); } @@ -247,7 +247,7 @@ char *basilisk_respond_getinfo(struct supernet_info *myinfo,char *CMD,void *addr { retstr = ptr->retstr; ptr->finished = (uint32_t)time(NULL); - } else retstr = clonestr("{\"error\":\"no coin specified or error bitcoinrawtx\"}"); + } else retstr = clonestr("{\"error\":\"no coin specified or error bitcoin getinfo\"}"); return(retstr); } diff --git a/basilisk/basilisk_bitcoin.c b/basilisk/basilisk_bitcoin.c index 903c9b9e3..c4949a914 100755 --- a/basilisk/basilisk_bitcoin.c +++ b/basilisk/basilisk_bitcoin.c @@ -424,7 +424,7 @@ void *basilisk_bitcoinvalue(struct basilisk_item *Lptr,struct supernet_info *myi void *basilisk_getinfo(struct basilisk_item *Lptr,struct supernet_info *myinfo,struct iguana_info *coin,char *remoteaddr,uint32_t basilisktag,int32_t timeoutmillis,cJSON *valsobj) { struct basilisk_item *ptr; cJSON *infojson; int32_t numsent,fanout,numrequired; - if ( myinfo->IAMNOTARY != 0 || myinfo->NOTARY.RELAYID >= 0 ) + if ( (myinfo->IAMNOTARY != 0 || myinfo->NOTARY.RELAYID >= 0) && strcmp(coin->symbol,"NOTARY") != 0 ) return(0); if ( coin->VALIDATENODE != 0 || coin->FULLNODE != 0 ) { diff --git a/iguana/iguana_msg.c b/iguana/iguana_msg.c index e5c428ff6..cddd4b733 100755 --- a/iguana/iguana_msg.c +++ b/iguana/iguana_msg.c @@ -474,8 +474,11 @@ int32_t iguana_send_ping(struct supernet_info *myinfo,struct iguana_info *coin,s int32_t len; uint64_t nonce; uint8_t serialized[sizeof(struct iguana_msghdr) + sizeof(nonce)]; if ( addr->msgcounts.verack == 0 ) { - printf("%s send version instead of ping to %s\n",coin->symbol,addr->ipaddr); - return(iguana_send_version(coin,addr,coin->myservices)); + if ( strcmp(addr->ipaddr,myinfo->ipaddr) != 0 ) + { + printf("%s send version instead of ping to %s\n",coin->symbol,addr->ipaddr); + return(iguana_send_version(coin,addr,coin->myservices)); + } } if ( (nonce= addr->pingnonce) == 0 ) {