diff --git a/crypto777/OS_portable.c b/crypto777/OS_portable.c index 3b9c4d271..422b51427 100755 --- a/crypto777/OS_portable.c +++ b/crypto777/OS_portable.c @@ -249,13 +249,13 @@ void *OS_portable_tmpalloc(char *dirname,char *name,struct OS_memspace *mem,long if ( mem->totalsize > origsize ) size = mem->totalsize; else size = origsize; - fprintf(stderr,"filealloc.(%s) -> ",fname); + printf("filealloc.(%s) -> ",fname); if ( OS_filealloc(&mem->M,fname,mem,size) == 0 ) { printf("couldnt map tmpfile %s\n",fname); return(0); } - fprintf(stderr,"created\n"); + printf("created\n"); } ptr = iguana_memalloc(mem,origsize,1); if ( mem->threadsafe != 0 ) diff --git a/iguana/exchanges/LP_RTmetrics.c b/iguana/exchanges/LP_RTmetrics.c index ad23b851e..4faab9712 100644 --- a/iguana/exchanges/LP_RTmetrics.c +++ b/iguana/exchanges/LP_RTmetrics.c @@ -259,10 +259,10 @@ cJSON *LP_RTmetrics_sort(char *base,char *rel,cJSON *rawasks,int32_t numasks,dou item = jitem(rawasks,sortbuf[i].ind); jaddi(array,jduplicate(item)); } - free(sortbuf); - for (; i 0 ) { methodstr[0] = 0; - if ( 0 ) + if ( 1 ) { #ifdef FROM_JS printf("%s RECV.(%s)\n",typestr,(char *)ptr); @@ -289,7 +289,7 @@ int32_t LP_sock_check(char *typestr,void *ctx,char *myipaddr,int32_t pubsock,int { if ( (mstr= jstr(recvjson,"method")) != 0 )//&& strcmp(mstr,"uitem") == 0 && (cstr= jstr(recvjson,"coin")) != 0 && strcmp(cstr,"REVS") == 0 ) { - printf("%s RECV.(%s)\n",typestr,(char *)ptr); + //printf("%s RECV.(%s)\n",typestr,(char *)ptr); } safecopy(methodstr,jstr(recvjson,"method"),sizeof(methodstr)); free_json(recvjson); @@ -300,8 +300,13 @@ int32_t LP_sock_check(char *typestr,void *ctx,char *myipaddr,int32_t pubsock,int #endif double millis = OS_milliseconds(); if ( strlen((char *)ptr)+sizeof(bits256) <= recvlen ) + { if ( LP_magic_check(ptr,recvlen,remoteaddr) <= 0 ) - printf("magic check error\n"); + { + //printf("magic check error\n"); + } + recvlen -= sizeof(bits256); + } if ( (retstr= LP_process_message(ctx,typestr,myipaddr,pubsock,ptr,recvlen,sock)) != 0 ) free(retstr); if ( Broadcaststr != 0 ) @@ -664,7 +669,7 @@ void LP_initcoins(void *ctx,int32_t pubsock,cJSON *coins) int32_t i,n; cJSON *item; for (i=0; icoin,base,1. / *ordermatchpricep); + int32_t changed; + LP_mypriceset(&changed,autxo->coin,base,1. / *ordermatchpricep); return(bestutxo); } @@ -862,6 +862,8 @@ char *LP_autobuy(void *ctx,char *myipaddr,int32_t mypubsock,char *base,char *rel uint64_t desttxfee,txfee; uint32_t lastnonce; int32_t i,maxiters,numpubs = 0; int64_t bestsatoshis=0,destsatoshis,bestdestsatoshis=0; struct iguana_info *basecoin,*relcoin; struct LP_utxoinfo *autxo,*bestutxo = 0; double qprice,ordermatchprice=0.; struct LP_quoteinfo Q; bits256 pubkeys[100]; basecoin = LP_coinfind(base); relcoin = LP_coinfind(rel); + if ( gui == 0 ) + gui = "nogui"; if ( basecoin == 0 || basecoin->inactive != 0 || relcoin == 0 || relcoin->inactive != 0 ) return(clonestr("{\"error\":\"base or rel not found or inactive\"}")); if ( LP_aliceonly(base) > 0 ) diff --git a/iguana/exchanges/LP_prices.c b/iguana/exchanges/LP_prices.c index 90159811e..117667e28 100644 --- a/iguana/exchanges/LP_prices.c +++ b/iguana/exchanges/LP_prices.c @@ -1064,7 +1064,7 @@ void LP_pricefeedupdate(bits256 pubkey,char *base,char *rel,double price) } if ( (pubp= LP_pubkeyadd(pubkey)) != 0 ) { - //if ( (rand() % 100) == 0 ) + if ( (rand() % 1000) == 0 ) printf("PRICEFEED UPDATE.(%-6s/%6s) %12.8f %s %12.8f\n",base,rel,price,bits256_str(str,pubkey),1./price); pubp->timestamp = (uint32_t)time(NULL); if ( fabs(pubp->matrix[basepp->ind][relpp->ind] - price) > SMALLVAL ) diff --git a/iguana/exchanges/LP_scan.c b/iguana/exchanges/LP_scan.c index 193ee7e92..a8c33fc28 100644 --- a/iguana/exchanges/LP_scan.c +++ b/iguana/exchanges/LP_scan.c @@ -68,7 +68,7 @@ int32_t LP_scanblockchain(struct iguana_info *coin,int32_t startheight,int32_t e } n++; if ( (n % 1000) == 0 ) - fprintf(stderr,"%.1f%% ",100. * (double)n/(endheight-startheight+1)); + printf("%.1f%% ",100. * (double)n/(endheight-startheight+1)); } return(endheight); } @@ -100,7 +100,7 @@ int32_t komodo_bannedset(int32_t *indallvoutsp,bits256 *array,int32_t max) int32_t i; if ( sizeof(banned_txids)/sizeof(*banned_txids) > max ) { - fprintf(stderr,"komodo_bannedset: buffer too small %ld vs %d\n",(long)sizeof(banned_txids)/sizeof(*banned_txids),max); + printf("komodo_bannedset: buffer too small %ld vs %d\n",(long)sizeof(banned_txids)/sizeof(*banned_txids),max); exit(-1); } for (i=0; iN.pair); + printf("start swap iamalice pair.%d\n",swap->N.pair); if ( LP_sendwait("pubkeys",60,swap->N.pair,swap,data,maxlen,LP_pubkeys_verify,LP_pubkeys_data) < 0 ) printf("error LP_sendwait pubkeys\n"); else if ( LP_sendwait("choosei",LP_SWAPSTEP_TIMEOUT,swap->N.pair,swap,data,maxlen,LP_choosei_verify,LP_choosei_data) < 0 ) @@ -910,12 +910,12 @@ int32_t instantdex_pubkeyargs(struct basilisk_swap *swap,int32_t numpubs,bits256 { if ( swap->I.numpubs+2 >= numpubs ) return(numpubs); - //fprintf(stderr,">>>>>> start generating %s\n",buf); + //printf(">>>>>> start generating %s\n",buf); } for (i=n=m=0; ictx,&privkey,pubkey,privkey,hash); - //fprintf(stderr,"i.%d n.%d numpubs.%d %02x vs %02x\n",i,n,numpubs,pubkey[0],firstbyte); + //printf("i.%d n.%d numpubs.%d %02x vs %02x\n",i,n,numpubs,pubkey[0],firstbyte); if ( pubkey[0] != firstbyte ) continue; if ( n < 2 ) diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index ad297bd75..66a24ee0f 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -490,7 +490,7 @@ int32_t iguana_signrawtransaction(void *ctx,char *symbol,uint8_t wiftaddr,uint8_ if ( (txobj= bitcoin_hex2json(taddr,pubtype,p2shtype,isPoS,height,&txid,msgtx,rawtx,extraspace,extralen,serialized4,vins,V->suppress_pubkeys,zcash)) != 0 ) { //printf("back from bitcoin_hex2json (%s)\n",jprint(vins,0)); - } else fprintf(stderr,"no txobj from bitcoin_hex2json\n"); + } else printf("no txobj from bitcoin_hex2json\n"); //printf("call hex2json.(%s) vins.(%s)\n",rawtx,jprint(vins,0)); if ( (numinputs= cJSON_GetArraySize(vins)) > 0 ) { @@ -593,7 +593,7 @@ int32_t iguana_signrawtransaction(void *ctx,char *symbol,uint8_t wiftaddr,uint8_ } else printf("interpreter passed\n");*/ } else printf("complete.%d\n",complete); } else printf("rwmsgtx error\n"); - } else fprintf(stderr,"no inputs in vins.(%s)\n",vins!=0?jprint(vins,0):"null"); + } else printf("no inputs in vins.(%s)\n",vins!=0?jprint(vins,0):"null"); free(extraspace); free(serialized), free(serialized2), free(serialized3), free(serialized4); } else return(-1);