diff --git a/basilisk/basilisk.c b/basilisk/basilisk.c index 16df820dd..ec3a72e74 100755 --- a/basilisk/basilisk.c +++ b/basilisk/basilisk.c @@ -231,6 +231,7 @@ char *basilisk_block(struct supernet_info *myinfo,struct iguana_info *coin,char { if ( (retstr= Lptr->retstr) == 0 ) retstr = clonestr("{\"result\":\"null return from local basilisk_issuecmd\"}"); + printf("block got local.(%s)\n",retstr); } else { @@ -254,30 +255,33 @@ char *basilisk_block(struct supernet_info *myinfo,struct iguana_info *coin,char if ( ptr->uniqueflag == 0 && ptr->numexact <= (ptr->numresults >> 1) ) besti = -1, errstr = "{\"error\":\"basilisk non-consensus results\"}"; else besti = basilisk_besti(ptr), errstr = "{\"error\":\"basilisk no valid results\"}"; - if ( (retstr= basilisk_finish(ptr,besti,errstr)) != 0 && remoteaddr != 0 && remoteaddr[0] != 0 && strcmp(remoteaddr,"127.0.0.1") != 0 ) + retstr = basilisk_finish(ptr,besti,errstr); + break; + } + if ( retstr == 0 ) + retstr = basilisk_finish(ptr,-1,"{\"error\":\"basilisk timeout\"}"); + } + if ( retstr != 0 && remoteaddr != 0 && remoteaddr[0] != 0 && strcmp(remoteaddr,"127.0.0.1") != 0 ) + { + for (j=0; jpeers.active[i]) != 0 && addr->usock >= 0 ) { - if ( (coin= Coins[j]) == 0 ) - continue; - for (i=0; isupernet != 0 && strcmp(addr->ipaddr,remoteaddr) == 0 ) { - if ( (addr= &coin->peers.active[i]) != 0 && addr->usock >= 0 ) - { - if ( addr->supernet != 0 && strcmp(addr->ipaddr,remoteaddr) == 0 ) - { - printf("send back.%d basilisk_result addr->supernet.%u to (%s).%d\n",(int32_t)strlen(retstr),addr->supernet,addr->ipaddr,addr->A.port); - iguana_send_supernet(addr,retstr,0); - return(retstr); - } - } - if ( 0 && addr->ipbits != 0 ) - printf("i.%d (%s) vs (%s) %s\n",i,addr->ipaddr,remoteaddr,coin->symbol); + printf("send back.%d basilisk_result addr->supernet.%u to (%s).%d\n",(int32_t)strlen(retstr),addr->supernet,addr->ipaddr,addr->A.port); + iguana_send_supernet(addr,retstr,0); + return(retstr); } } + if ( 0 && addr->ipbits != 0 ) + printf("i.%d (%s) vs (%s) %s\n",i,addr->ipaddr,remoteaddr,coin->symbol); } } - retstr = basilisk_finish(ptr,-1,"{\"error\":\"basilisk timeout\"}"); } return(retstr); } diff --git a/basilisk/basilisk_bitcoin.c b/basilisk/basilisk_bitcoin.c index 669ff339e..57ac72a38 100755 --- a/basilisk/basilisk_bitcoin.c +++ b/basilisk/basilisk_bitcoin.c @@ -632,6 +632,7 @@ void *basilisk_bitcoinrawtx(struct basilisk_item *Lptr,struct supernet_info *myi decode_hex(buf,spendlen,spendscriptstr); bitcoin_txoutput(coin,txobj,buf,spendlen,amount); rawtx = iguana_calcrawtx(myinfo,coin,&vins,txobj,amount,changeaddr,txfee,addresses,minconf); + printf("generated.(%s) vins.(%s)\n",rawtx,vins!=0?jprint(vins,0):""); } else { @@ -651,12 +652,14 @@ void *basilisk_bitcoinrawtx(struct basilisk_item *Lptr,struct supernet_info *myi Lptr->retstr = jprint(valsobj,1); return(Lptr); } else free(rawtx); - } // fall through to remote + } + if ( txobj != 0 ) + free_json(txobj); + if ( vins != 0 ) + free_json(vins); + Lptr->retstr = clonestr("{\"error\":\"couldnt create rawtx\"}"); + return(Lptr); } - if ( txobj != 0 ) - free_json(txobj), txobj = 0; - if ( vins != 0 ) - free_json(vins), vins = 0; return(basilisk_issueremote(myinfo,"rawtx",coin->symbol,valsobj,0,juint(valsobj,"fanout"),juint(valsobj,"minresults"),basilisktag)); }