From e86e9751454d5d359db6f31f59c1efb64c5c86d4 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 12 Jun 2016 05:59:16 -0300 Subject: [PATCH] test --- basilisk/basilisk.c | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/basilisk/basilisk.c b/basilisk/basilisk.c index ca0bdfdc9..5912c5488 100755 --- a/basilisk/basilisk.c +++ b/basilisk/basilisk.c @@ -958,6 +958,17 @@ void basilisk_msgprocess(struct supernet_info *myinfo,void *addr,uint32_t sender { (void *)"VAL", &_basilisk_value }, { (void *)"BAL", &_basilisk_balances }, }; + if ( (valsobj= cJSON_Parse((char *)data)) != 0 ) + { + if ( jobj(valsobj,"coin") != 0 ) + coin = iguana_coinfind(jstr(valsobj,"coin")); + if ( strcmp(type,"RET") == 0 ) + { + if ( (retstr= _basilisk_result(myinfo,coin,addr,remoteaddr,basilisktag,valsobj,data,datalen)) != 0 ) + free(retstr); + return; + } + } else return; for (i=flag=0; ibasilisk_busy = 1; - if ( (valsobj= cJSON_Parse((char *)data)) != 0 ) + if ( valsobj != 0 ) { jsonlen = (int32_t)strlen((char *)data) + 1; if ( datalen > jsonlen ) @@ -997,17 +1008,14 @@ void basilisk_msgprocess(struct supernet_info *myinfo,void *addr,uint32_t sender if ( *data++ != 0 ) data += sizeof(hash), datalen -= sizeof(hash); } else data = 0, datalen = 0; - if ( (symbol= jstr(valsobj,"coin")) == 0 ) - symbol = "BTCD"; + if ( coin == 0 ) + coin = iguana_coinfind("BTCD"); + if ( coin != 0 ) + coin->basilisk_busy = 1; hash = jbits256(valsobj,"hash"); timeoutmillis = jint(valsobj,"timeout"); if ( (numrequired= jint(valsobj,"numrequired")) == 0 ) numrequired = 1; - if ( jobj(valsobj,"coin") != 0 ) - { - if ( (coin= iguana_coinfind(jstr(valsobj,"coin"))) != 0 ) - coin->basilisk_busy = 1; - } if ( senderipbits != 0 ) expand_ipbits(remoteaddr,senderipbits); else remoteaddr[0] = 0; @@ -1038,14 +1046,9 @@ void basilisk_msgprocess(struct supernet_info *myinfo,void *addr,uint32_t sender return; } } - printf("check coin\n"); if ( coin != 0 ) { - if ( strcmp(type,"RET") == 0 ) - { - retstr = _basilisk_result(myinfo,coin,addr,remoteaddr,basilisktag,valsobj,data,datalen); - } - else if ( coin->RELAYNODE != 0 || coin->VALIDATENODE != 0 ) // iguana node + if ( coin->RELAYNODE != 0 || coin->VALIDATENODE != 0 ) // iguana node { printf("relay path\n"); if ( from_basilisk != 0 )