From 93891850376ac6c25ca4410e1c0b0a345efc303a Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 25 Jul 2017 13:31:05 +0200 Subject: [PATCH] Test --- iguana/exchanges/LP_nativeDEX.c | 2 +- iguana/exchanges/LP_ordermatch.c | 6 ++---- iguana/exchanges/LP_portfolio.c | 4 ++-- iguana/exchanges/LP_prices.c | 2 +- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 2b570d600..c528514e0 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -184,7 +184,7 @@ char *LP_process_message(void *ctx,char *typestr,char *myipaddr,int32_t pubsock, if ( duplicate != 0 ) dup++; else uniq++; - if ( (rand() % 100) == 0 ) + if ( (rand() % 1000) == 0 ) printf("%s dup.%d (%u / %u) %.1f%% encrypted.%d recv.%u [%02x %02x] vs %02x %02x U.%d\n",typestr,duplicate,dup,dup+uniq,(double)100*dup/(dup+uniq),encrypted,crc32,ptr[0],ptr[1],crc32&0xff,(crc32>>8)&0xff,LP_mypeer != 0 ? LP_mypeer->numutxos : -1); if ( duplicate == 0 ) { diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index 1b4d85148..9d983512b 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -471,7 +471,7 @@ char *LP_connectedalice(cJSON *argjson) // alice } if ( (coin= LP_coinfind(Q.destcoin)) == 0 ) { - LP_pendingswaps++; + LP_pendingswaps--; return(clonestr("{\"error\":\"cant get alicecoin\"}")); } Q.privkey = LP_privkey(Q.destaddr,coin->taddr); @@ -502,13 +502,12 @@ char *LP_connectedalice(cJSON *argjson) // alice printf("connected result.(%s)\n",jprint(retjson,0)); if ( jobj(retjson,"error") != 0 ) LP_availableset(autxo); - else LP_pendingswaps--; + else LP_pendingswaps++; return(jprint(retjson,1)); } else { LP_availableset(autxo); - LP_pendingswaps--; printf("no privkey found\n"); return(clonestr("{\"error\",\"no privkey\"}")); } @@ -753,7 +752,6 @@ char *LP_trade(void *ctx,char *myipaddr,int32_t mypubsock,struct LP_quoteinfo *q } if ( aliceutxo->S.swap == 0 ) LP_availableset(aliceutxo); - else LP_pendingswaps++; return(jprint(bestitem,0)); } diff --git a/iguana/exchanges/LP_portfolio.c b/iguana/exchanges/LP_portfolio.c index 36ce949ab..512b90ea4 100644 --- a/iguana/exchanges/LP_portfolio.c +++ b/iguana/exchanges/LP_portfolio.c @@ -343,7 +343,7 @@ void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp) char *retstr; cJSON *retjson,*bid,*ask; uint64_t bidsatoshis,asksatoshis; int32_t i; double nxtkmd,price; struct LP_priceinfo *kmdpp,*fiatpp,*nxtpp; if ( (retstr= issue_curlt("https://bittrex.com/api/v1.1/public/getmarketsummaries",LP_HTTP_TIMEOUT*10)) == 0 ) { - printf("error getting marketsummaries\n"); + printf("trex error getting marketsummaries\n"); sleep(60); return; } @@ -351,7 +351,7 @@ void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp) free(retstr); if ( (retstr= issue_curlt("https://www.cryptopia.co.nz/api/GetMarkets",LP_HTTP_TIMEOUT*10)) == 0 ) { - printf("error getting marketsummaries\n"); + printf("cryptopia error getting marketsummaries\n"); sleep(60); return; } diff --git a/iguana/exchanges/LP_prices.c b/iguana/exchanges/LP_prices.c index bbd71582e..8e177e6e0 100644 --- a/iguana/exchanges/LP_prices.c +++ b/iguana/exchanges/LP_prices.c @@ -833,7 +833,7 @@ void LP_pricefeedupdate(bits256 pubkey,char *base,char *rel,double price) } if ( (pubp= LP_pubkeyadd(pubkey)) != 0 ) { - if ( (rand() % 10) == 0 && fabs(pubp->matrix[basepp->ind][relpp->ind] - price) > SMALLVAL ) + if ( (rand() % 100) == 0 && fabs(pubp->matrix[basepp->ind][relpp->ind] - price) > SMALLVAL ) printf("PRICEFEED UPDATE.(%-6s/%6s) %12.8f %s %12.8f\n",base,rel,price,bits256_str(str,pubkey),1./price); { pubp->matrix[basepp->ind][relpp->ind] = price;