Browse Source

Test

etomic
jl777 8 years ago
parent
commit
b977dff87b
  1. 2
      iguana/exchanges/LP_commands.c
  2. 20
      iguana/exchanges/LP_nativeDEX.c
  3. 10
      iguana/exchanges/LP_network.c
  4. 6
      iguana/exchanges/LP_ordermatch.c
  5. 2
      iguana/exchanges/LP_peers.c
  6. 2
      iguana/exchanges/LP_prices.c
  7. 4
      iguana/exchanges/LP_rpc.c
  8. 8
      iguana/exchanges/LP_signatures.c
  9. 2
      iguana/exchanges/LP_socket.c
  10. 22
      iguana/exchanges/LP_statemachine.c
  11. 2
      iguana/exchanges/LP_tradebots.c
  12. 2
      iguana/exchanges/LP_utxo.c
  13. 2
      iguana/exchanges/LP_utxos.c

2
iguana/exchanges/LP_commands.c

@ -36,7 +36,7 @@ char *stats_JSON(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson,char *r
{ {
char *method,*userpass,*base,*rel,*coin,*retstr = 0; int32_t changed,flag = 0; cJSON *retjson,*reqjson = 0; struct iguana_info *ptr; char *method,*userpass,*base,*rel,*coin,*retstr = 0; int32_t changed,flag = 0; cJSON *retjson,*reqjson = 0; struct iguana_info *ptr;
method = jstr(argjson,"method"); method = jstr(argjson,"method");
printf("stats_JSON %s\n",method); //printf("stats_JSON %s\n",method);
/*if ( (ipaddr= jstr(argjson,"ipaddr")) != 0 && (argport= juint(argjson,"port")) != 0 && (method == 0 || strcmp(method,"electrum") != 0) ) /*if ( (ipaddr= jstr(argjson,"ipaddr")) != 0 && (argport= juint(argjson,"port")) != 0 && (method == 0 || strcmp(method,"electrum") != 0) )
{ {
if ( strcmp(ipaddr,"127.0.0.1") != 0 && argport >= 1000 ) if ( strcmp(ipaddr,"127.0.0.1") != 0 && argport >= 1000 )

20
iguana/exchanges/LP_nativeDEX.c

@ -118,6 +118,16 @@ struct LP_globals
struct LP_privkey LP_privkeys[100]; struct LP_privkey LP_privkeys[100];
} G; } G;
uint32_t LP_rand()
{
uint32_t retval;
retval = rand();
retval = (retval << 7) ^ (retval >> 17) ^ rand();
retval = (retval << 13) ^ (retval >> 13) ^ rand();
retval = (retval << 17) ^ (retval >> 7) ^ rand();
return(retval);
}
#include "LP_network.c" #include "LP_network.c"
char *activecoins[] = { "BTC", "KMD" }; char *activecoins[] = { "BTC", "KMD" };
@ -130,7 +140,6 @@ char *default_LPnodes[] = { "5.9.253.195", "5.9.253.196", "5.9.253.197", "5.9.25
"51.15.203.171", "51.15.86.136", "51.15.94.249", "51.15.80.18", "51.15.91.40", "51.15.54.2", "51.15.86.31", "51.15.82.29", "51.15.89.155", "51.15.203.171", "51.15.86.136", "51.15.94.249", "51.15.80.18", "51.15.91.40", "51.15.54.2", "51.15.86.31", "51.15.82.29", "51.15.89.155",
};//"5.9.253.204" }; // };//"5.9.253.204" }; //
// stubs // stubs
void tradebot_swap_balancingtrade(struct basilisk_swap *swap,int32_t iambob) void tradebot_swap_balancingtrade(struct basilisk_swap *swap,int32_t iambob)
@ -230,7 +239,7 @@ char *LP_process_message(void *ctx,char *typestr,char *myipaddr,int32_t pubsock,
dup++; dup++;
else uniq++; else uniq++;
portable_mutex_lock(&LP_commandmutex); portable_mutex_lock(&LP_commandmutex);
if ( (rand() % 10000) == 0 ) if ( (LP_rand() % 10000) == 0 )
printf("%s dup.%d (%u / %u) %.1f%% encrypted.%d recv.%u [%02x %02x] vs %02x %02x\n",typestr,duplicate,dup,dup+uniq,(double)100*dup/(dup+uniq),encrypted,crc32,ptr[0],ptr[1],crc32&0xff,(crc32>>8)&0xff); printf("%s dup.%d (%u / %u) %.1f%% encrypted.%d recv.%u [%02x %02x] vs %02x %02x\n",typestr,duplicate,dup,dup+uniq,(double)100*dup/(dup+uniq),encrypted,crc32,ptr[0],ptr[1],crc32&0xff,(crc32>>8)&0xff);
if ( duplicate == 0 ) if ( duplicate == 0 )
{ {
@ -412,7 +421,7 @@ int32_t LP_nanomsg_recvs(void *ctx)
{ {
if ( peer->errors >= LP_MAXPEER_ERRORS ) if ( peer->errors >= LP_MAXPEER_ERRORS )
{ {
if ( (rand() % 10000) == 0 ) if ( (LP_rand() % 10000) == 0 )
peer->errors--; peer->errors--;
else else
{ {
@ -896,6 +905,7 @@ void LPinit(uint16_t myport,uint16_t mypullport,uint16_t mypubport,uint16_t mybu
} }
#endif #endif
OS_randombytes((void *)&n,sizeof(n)); OS_randombytes((void *)&n,sizeof(n));
srand((uint32_t)n);
if ( jobj(argjson,"gui") != 0 ) if ( jobj(argjson,"gui") != 0 )
safecopy(LP_gui,jstr(argjson,"gui"),sizeof(LP_gui)); safecopy(LP_gui,jstr(argjson,"gui"),sizeof(LP_gui));
if ( jobj(argjson,"canbind") == 0 ) if ( jobj(argjson,"canbind") == 0 )
@ -1205,7 +1215,7 @@ int32_t zeroval() { return(0); }
void *LP_alloc(uint64_t len) void *LP_alloc(uint64_t len)
{ {
//return(calloc(1,len)); return(calloc(1,len));
LP_cjson_allocated += len; LP_cjson_allocated += len;
LP_cjson_total += len; LP_cjson_total += len;
LP_cjson_count++; LP_cjson_count++;
@ -1224,7 +1234,7 @@ void *LP_alloc(uint64_t len)
void LP_free(void *ptr) void LP_free(void *ptr)
{ {
static uint32_t lasttime,unknown; static int64_t lasttotal; static uint32_t lasttime,unknown; static int64_t lasttotal;
//free(ptr); return; free(ptr); return;
uint32_t now; char str[65]; int32_t n,lagging; uint64_t total = 0; struct LP_memory_list *mp,*tmp; uint32_t now; char str[65]; int32_t n,lagging; uint64_t total = 0; struct LP_memory_list *mp,*tmp;
if ( (now= (uint32_t)time(NULL)) > lasttime+6 ) if ( (now= (uint32_t)time(NULL)) > lasttime+6 )
{ {

10
iguana/exchanges/LP_network.c

@ -183,7 +183,7 @@ bits256 LP_calc_magic(uint8_t *msg,int32_t len)
sum += (OS_milliseconds() - millis); sum += (OS_milliseconds() - millis);
nsum += n; nsum += n;
counter++; counter++;
if ( n > maxn || (rand() % 10000) == 0 ) if ( n > maxn || (LP_rand() % 10000) == 0 )
{ {
if ( n > maxn ) if ( n > maxn )
{ {
@ -237,7 +237,7 @@ int32_t LP_crc32find(int32_t *duplicatep,int32_t ind,uint32_t crc32)
break; break;
} }
if ( i >= sizeof(crcs)/sizeof(*crcs) ) if ( i >= sizeof(crcs)/sizeof(*crcs) )
i = (rand() % (sizeof(crcs)/sizeof(*crcs))); i = (LP_rand() % (sizeof(crcs)/sizeof(*crcs)));
return(i); return(i);
} }
else else
@ -316,7 +316,7 @@ void queue_loop(void *arg)
flag = 0; flag = 0;
if ( ptr->sock >= 0 ) if ( ptr->sock >= 0 )
{ {
if ( ptr->notready == 0 || (rand() % ptr->notready) == 0 ) if ( ptr->notready == 0 || (LP_rand() % ptr->notready) == 0 )
{ {
if ( LP_sockcheck(ptr->sock) > 0 ) if ( LP_sockcheck(ptr->sock) > 0 )
{ {
@ -387,11 +387,11 @@ void _LP_queuesend(uint32_t crc32,int32_t sock0,int32_t sock1,uint8_t *msg,int32
if ( sock0 < 0 && sock1 < 0 ) if ( sock0 < 0 && sock1 < 0 )
{ {
if ( (maxind= LP_numpeers()) > 0 ) if ( (maxind= LP_numpeers()) > 0 )
peerind = (rand() % maxind) + 1; peerind = (LP_rand() % maxind) + 1;
else peerind = 1; else peerind = 1;
sock0 = LP_peerindsock(&peerind); sock0 = LP_peerindsock(&peerind);
if ( (maxind= LP_numpeers()) > 0 ) if ( (maxind= LP_numpeers()) > 0 )
peerind = (rand() % maxind) + 1; peerind = (LP_rand() % maxind) + 1;
else peerind = 1; else peerind = 1;
sock1 = LP_peerindsock(&peerind); sock1 = LP_peerindsock(&peerind);
} }

6
iguana/exchanges/LP_ordermatch.c

@ -52,7 +52,7 @@ double LP_bob_competition(int32_t *counterp,uint64_t aliceid,double price,int32_
firsti = i; firsti = i;
} }
if ( firsti < 0 ) if ( firsti < 0 )
firsti = (rand() % (sizeof(Bob_competition)/sizeof(*Bob_competition))); firsti = (LP_rand() % (sizeof(Bob_competition)/sizeof(*Bob_competition)));
Bob_competition[firsti].starttime = (uint32_t)time(NULL); Bob_competition[firsti].starttime = (uint32_t)time(NULL);
Bob_competition[firsti].counter = counter; Bob_competition[firsti].counter = counter;
Bob_competition[firsti].aliceid = aliceid; Bob_competition[firsti].aliceid = aliceid;
@ -252,7 +252,7 @@ int32_t LP_nanobind(void *ctx,char *pairstr)
{ {
for (i=0; i<10; i++) for (i=0; i<10; i++)
{ {
r = (10000 + (rand() % 50000)) & 0xffff; r = (10000 + (LP_rand() % 50000)) & 0xffff;
if ( LP_fixed_pairport != 0 ) if ( LP_fixed_pairport != 0 )
r = LP_fixed_pairport; r = LP_fixed_pairport;
nanomsg_transportname(0,pairstr,LP_myipaddr,r); nanomsg_transportname(0,pairstr,LP_myipaddr,r);
@ -884,7 +884,7 @@ int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson,
} else return(retval); } else return(retval);
if ( qprice > price ) if ( qprice > price )
{ {
r = (rand() % 100); r = (LP_rand() % 100);
range = (qprice - price); range = (qprice - price);
price += (r * range) / 100.; price += (r * range) / 100.;
bestprice = LP_bob_competition(&counter,aliceid,price,0); bestprice = LP_bob_competition(&counter,aliceid,price,0);

2
iguana/exchanges/LP_peers.c

@ -235,7 +235,7 @@ uint16_t LP_randpeer(char *destip)
numpeers = LP_numpeers(); numpeers = LP_numpeers();
if ( numpeers > 0 ) if ( numpeers > 0 )
{ {
r = rand() % numpeers; r = LP_rand() % numpeers;
n = 0; n = 0;
HASH_ITER(hh,LP_peerinfos,peer,tmp) HASH_ITER(hh,LP_peerinfos,peer,tmp)
{ {

2
iguana/exchanges/LP_prices.c

@ -1070,7 +1070,7 @@ void LP_pricefeedupdate(bits256 pubkey,char *base,char *rel,double price)
} }
if ( (pubp= LP_pubkeyadd(pubkey)) != 0 ) if ( (pubp= LP_pubkeyadd(pubkey)) != 0 )
{ {
if ( (rand() % 1000) == 0 ) if ( (LP_rand() % 1000) == 0 )
printf("PRICEFEED UPDATE.(%-6s/%6s) %12.8f %s %12.8f\n",base,rel,price,bits256_str(str,pubkey),1./price); 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); pubp->timestamp = (uint32_t)time(NULL);
if ( fabs(pubp->matrix[basepp->ind][relpp->ind] - price) > SMALLVAL ) if ( fabs(pubp->matrix[basepp->ind][relpp->ind] - price) > SMALLVAL )

4
iguana/exchanges/LP_rpc.c

@ -314,13 +314,13 @@ char *account = "NXT-MRBN-8DFH-PFMK-A4DBM";
cJSON *LP_assethbla(char *assetid) cJSON *LP_assethbla(char *assetid)
{ {
char url[1024],*retstr; int32_t n; cJSON *array,*bid=0,*ask=0,*retjson; char url[1024],*retstr; int32_t n; cJSON *array,*bid=0,*ask=0,*retjson;
sprintf(url,"http://%s:7876/nxt?requestType=getBidOrders&asset=%s&firstIndex=0&lastIndex=0",NXTnodes[rand() % (sizeof(NXTnodes)/sizeof(*NXTnodes))],assetid); sprintf(url,"http://%s:7876/nxt?requestType=getBidOrders&asset=%s&firstIndex=0&lastIndex=0",NXTnodes[LP_rand() % (sizeof(NXTnodes)/sizeof(*NXTnodes))],assetid);
if ( (retstr= issue_curlt(url,LP_HTTP_TIMEOUT)) != 0 ) if ( (retstr= issue_curlt(url,LP_HTTP_TIMEOUT)) != 0 )
{ {
bid = cJSON_Parse(retstr); bid = cJSON_Parse(retstr);
free(retstr); free(retstr);
} }
sprintf(url,"http://%s:7876/nxt?requestType=getAskOrders&asset=%s&firstIndex=0&lastIndex=0",NXTnodes[rand() % (sizeof(NXTnodes)/sizeof(*NXTnodes))],assetid); sprintf(url,"http://%s:7876/nxt?requestType=getAskOrders&asset=%s&firstIndex=0&lastIndex=0",NXTnodes[LP_rand() % (sizeof(NXTnodes)/sizeof(*NXTnodes))],assetid);
if ( (retstr= issue_curlt(url,LP_HTTP_TIMEOUT)) != 0 ) if ( (retstr= issue_curlt(url,LP_HTTP_TIMEOUT)) != 0 )
{ {
ask = cJSON_Parse(retstr); ask = cJSON_Parse(retstr);

8
iguana/exchanges/LP_signatures.c

@ -132,14 +132,14 @@ int32_t LP_quoteparse(struct LP_quoteinfo *qp,cJSON *argjson)
qp->R.quoteid = juint(argjson,"quoteid"); qp->R.quoteid = juint(argjson,"quoteid");
if ( qp->R.requestid == 0 ) if ( qp->R.requestid == 0 )
{ {
rid= basilisk_requestid(&qp->R); rid = basilisk_requestid(&qp->R);
//printf("requestid.%u -> %u\n",qp->R.requestid,rid); printf("requestid.%u -> %u\n",qp->R.requestid,rid);
qp->R.requestid = rid; qp->R.requestid = rid;
} }
if ( qp->R.quoteid == 0 ) if ( qp->R.quoteid == 0 )
{ {
qid= basilisk_quoteid(&qp->R); qid = basilisk_quoteid(&qp->R);
//printf("quoteid.%u -> %u\n",qp->R.quoteid,qid); printf("quoteid.%u -> %u\n",qp->R.quoteid,qid);
qp->R.quoteid = qid; qp->R.quoteid = qid;
} }
return(0); return(0);

2
iguana/exchanges/LP_socket.c

@ -272,7 +272,7 @@ struct electrum_info *electrum_server(char *symbol,struct electrum_info *ep)
ep = recent_ep; ep = recent_ep;
if ( n > 0 ) if ( n > 0 )
{ {
i = (rand() % n); i = (LP_rand() % n);
ep = rbuf[i]; ep = rbuf[i];
} }
} }

22
iguana/exchanges/LP_statemachine.c

@ -186,7 +186,7 @@ FILE *basilisk_swap_save(struct basilisk_swap *swap,bits256 privkey,struct basil
{ {
if ( peer->errors >= LP_MAXPEER_ERRORS ) if ( peer->errors >= LP_MAXPEER_ERRORS )
{ {
if ( (rand() % 10000) == 0 ) if ( (LP_rand() % 10000) == 0 )
{ {
peer->errors--; peer->errors--;
if ( peer->errors < LP_MAXPEER_ERRORS ) if ( peer->errors < LP_MAXPEER_ERRORS )
@ -195,7 +195,7 @@ FILE *basilisk_swap_save(struct basilisk_swap *swap,bits256 privkey,struct basil
if ( IAMLP == 0 ) if ( IAMLP == 0 )
continue; continue;
} }
if ( now > peer->lastpeers+LP_ORDERBOOK_DURATION*.777 || (rand() % 100000) == 0 ) if ( now > peer->lastpeers+LP_ORDERBOOK_DURATION*.777 || (LP_rand() % 100000) == 0 )
{ {
if ( strcmp(peer->ipaddr,myipaddr) != 0 ) if ( strcmp(peer->ipaddr,myipaddr) != 0 )
{ {
@ -241,7 +241,7 @@ int32_t LP_peersparse(struct LP_peerinfo *mypeer,int32_t mypubsock,char *destipa
if ( (peer= LP_peerfind(argipbits,argport)) == 0 ) if ( (peer= LP_peerfind(argipbits,argport)) == 0 )
{ {
numpeers = LP_numpeers(); numpeers = LP_numpeers();
if ( IAMLP != 0 || numpeers < LP_MIN_PEERS || (IAMLP == 0 && (rand() % LP_MAX_PEERS) > numpeers) ) if ( IAMLP != 0 || numpeers < LP_MIN_PEERS || (IAMLP == 0 && (LP_rand() % LP_MAX_PEERS) > numpeers) )
peer = LP_addpeer(mypeer,mypubsock,argipaddr,argport,pushport,subport,jint(item,"numpeers"),jint(item,"numutxos"),juint(item,"session")); peer = LP_addpeer(mypeer,mypubsock,argipaddr,argport,pushport,subport,jint(item,"numpeers"),jint(item,"numutxos"),juint(item,"session"));
} }
if ( peer != 0 ) if ( peer != 0 )
@ -395,7 +395,7 @@ void issue_LP_uitem(char *destip,uint16_t destport,char *symbol,char *coinaddr,b
ptr = calloc(1,sizeof(*ptr)); ptr = calloc(1,sizeof(*ptr));
ptr->timestamp = (uint32_t)time(NULL); ptr->timestamp = (uint32_t)time(NULL);
ptr->item = item; ptr->item = item;
item->cjsonid = rand(); item->cjsonid = LP_rand();
ptr->cjsonid = item->cjsonid; ptr->cjsonid = item->cjsonid;
portable_mutex_lock(&LP_cJSONmutex); portable_mutex_lock(&LP_cJSONmutex);
DL_APPEND(LP_cJSONlist,ptr); DL_APPEND(LP_cJSONlist,ptr);
@ -955,7 +955,7 @@ int32_t _basilisk_rawtx_gen(char *str,uint32_t swapstarted,uint8_t *pubkey33,int
{ {
char scriptstr[1024],wifstr[256],coinaddr[64],*signedtx,*rawtxbytes; uint32_t basilisktag; int32_t retval = -1; cJSON *vins,*privkeys,*addresses,*valsobj; struct vin_info *V; char scriptstr[1024],wifstr[256],coinaddr[64],*signedtx,*rawtxbytes; uint32_t basilisktag; int32_t retval = -1; cJSON *vins,*privkeys,*addresses,*valsobj; struct vin_info *V;
init_hexbytes_noT(scriptstr,script,scriptlen); init_hexbytes_noT(scriptstr,script,scriptlen);
basilisktag = (uint32_t)rand(); basilisktag = (uint32_t)LP_rand();
valsobj = cJSON_CreateObject(); valsobj = cJSON_CreateObject();
jaddstr(valsobj,"coin",rawtx->coin->symbol); jaddstr(valsobj,"coin",rawtx->coin->symbol);
jaddstr(valsobj,"spendscript",scriptstr); jaddstr(valsobj,"spendscript",scriptstr);
@ -1195,7 +1195,7 @@ int32_t basilisk_swapiteration(struct basilisk_swap *swap,uint8_t *data,int32_t
basilisk_swap_saveupdate(swap); basilisk_swap_saveupdate(swap);
if ( swap->connected == 0 ) if ( swap->connected == 0 )
basilisk_psockinit(swap,swap->I.iambob != 0); basilisk_psockinit(swap,swap->I.iambob != 0);
//if ( (rand() % 30) == 0 ) //if ( (LP_rand() % 30) == 0 )
printf("E r%u/q%u swapstate.%x otherstate.%x remaining %d\n",swap->I.req.requestid,swap->I.req.quoteid,swap->I.statebits,swap->I.otherstatebits,(int32_t)(swap->I.expiration-time(NULL))); printf("E r%u/q%u swapstate.%x otherstate.%x remaining %d\n",swap->I.req.requestid,swap->I.req.quoteid,swap->I.statebits,swap->I.otherstatebits,(int32_t)(swap->I.expiration-time(NULL)));
if ( swap->I.iambob != 0 ) if ( swap->I.iambob != 0 )
{ {
@ -1369,7 +1369,7 @@ int32_t basilisk_swapiteration(struct basilisk_swap *swap,uint8_t *data,int32_t
} }
} }
} }
if ( (rand() % 30) == 0 ) if ( (LP_rand() % 30) == 0 )
printf("finished swapstate.%x other.%x\n",swap->I.statebits,swap->I.otherstatebits); printf("finished swapstate.%x other.%x\n",swap->I.statebits,swap->I.otherstatebits);
if ( swap->I.statebits == savestatebits && swap->I.otherstatebits == saveotherbits ) if ( swap->I.statebits == savestatebits && swap->I.otherstatebits == saveotherbits )
sleep(DEX_SLEEP + (swap->I.iambob == 0)*1); sleep(DEX_SLEEP + (swap->I.iambob == 0)*1);
@ -2792,7 +2792,7 @@ void LP_price_broadcastloop(void *ctx)
minprice = LP_pricevol_invert(&basevol,bot->maxprice,bot->totalrelvolume - bot->relsum); minprice = LP_pricevol_invert(&basevol,bot->maxprice,bot->totalrelvolume - bot->relsum);
printf("simulated trade sell %s/%s minprice %.8f volume %.8f, %.8f %s -> %s price %.8f relvol %.8f\n",bot->rel,bot->base,minprice,basevol,v,bot->base,bot->rel,p,relvol); printf("simulated trade sell %s/%s minprice %.8f volume %.8f, %.8f %s -> %s price %.8f relvol %.8f\n",bot->rel,bot->base,minprice,basevol,v,bot->base,bot->rel,p,relvol);
} }
if ( (rand() % 2) == 0 ) if ( (LP_rand() % 2) == 0 )
{ {
bot->relsum += relvol; bot->relsum += relvol;
bot->basesum += v; bot->basesum += v;
@ -2809,7 +2809,7 @@ void LP_price_broadcastloop(void *ctx)
#ifdef FROM_JS #ifdef FROM_JS
int32_t sentbytes,sock,peerind,maxind; int32_t sentbytes,sock,peerind,maxind;
if ( (maxind= LP_numpeers()) > 0 ) if ( (maxind= LP_numpeers()) > 0 )
peerind = (rand() % maxind) + 1; peerind = (LP_rand() % maxind) + 1;
else peerind = 1; else peerind = 1;
sock = LP_peerindsock(&peerind); sock = LP_peerindsock(&peerind);
if ( sock >= 0 ) if ( sock >= 0 )
@ -2851,11 +2851,11 @@ void _LP_queuesend(uint32_t crc32,int32_t sock0,int32_t sock1,uint8_t *msg,int32
else else
{ {
if ( (maxind= LP_numpeers()) > 0 ) if ( (maxind= LP_numpeers()) > 0 )
peerind = (rand() % maxind) + 1; peerind = (LP_rand() % maxind) + 1;
else peerind = 1; else peerind = 1;
sock0 = LP_peerindsock(&peerind); sock0 = LP_peerindsock(&peerind);
if ( (maxind= LP_numpeers()) > 0 ) if ( (maxind= LP_numpeers()) > 0 )
peerind = (rand() % maxind) + 1; peerind = (LP_rand() % maxind) + 1;
else peerind = 1; else peerind = 1;
sock1 = LP_peerindsock(&peerind); sock1 = LP_peerindsock(&peerind);
} }

2
iguana/exchanges/LP_tradebots.c

@ -324,7 +324,7 @@ void LP_tradebot_timeslice(void *ctx,struct LP_tradebot *bot)
printf("try autobuy %s/%s remaining %.8f maxprice %.8f maxrel %.8f\n",bot->base,bot->rel,remaining,bot->maxprice,maxrel); printf("try autobuy %s/%s remaining %.8f maxprice %.8f maxrel %.8f\n",bot->base,bot->rel,remaining,bot->maxprice,maxrel);
if ( maxrel < remaining ) if ( maxrel < remaining )
remaining = maxrel; remaining = maxrel;
tradeid = rand(); tradeid = LP_rand();
for (i=1; i<=maxiters; i++) for (i=1; i<=maxiters; i++)
{ {
if ( remaining < 0.001 ) if ( remaining < 0.001 )

2
iguana/exchanges/LP_utxo.c

@ -405,7 +405,7 @@ int32_t LP_address_utxoadd(uint32_t timestamp,char *debug,struct iguana_info *co
up->SPV = tx->SPV; up->SPV = tx->SPV;
} }
char str[65]; char str[65];
//if ( 0 && strcmp(coin->smartaddr,coinaddr) == 0 && strcmp("KMD",coin->symbol) == 0 ) if ( 0 && strcmp(coin->smartaddr,coinaddr) == 0 && strcmp("KMD",coin->symbol) == 0 )
printf("%s ADD UTXO >> %s %s %s/v%d ht.%d %.8f\n",debug,coin->symbol,coinaddr,bits256_str(str,txid),vout,height,dstr(value)); printf("%s ADD UTXO >> %s %s %s/v%d ht.%d %.8f\n",debug,coin->symbol,coinaddr,bits256_str(str,txid),vout,height,dstr(value));
portable_mutex_lock(&coin->addrmutex); portable_mutex_lock(&coin->addrmutex);
DL_APPEND(ap->utxos,up); DL_APPEND(ap->utxos,up);

2
iguana/exchanges/LP_utxos.c

@ -848,7 +848,7 @@ void LP_privkey_updates(void *ctx,int32_t pubsock,char *passphrase)
else if ( IAMLP == 0 || coin->inactive == 0 ) else if ( IAMLP == 0 || coin->inactive == 0 )
{ {
//printf("from updates %s\n",coin->symbol); //printf("from updates %s\n",coin->symbol);
if ( LP_privkey_init(pubsock,coin,G.LP_privkey,G.LP_mypub25519) == 0 && (rand() % 10) == 0 ) if ( LP_privkey_init(pubsock,coin,G.LP_privkey,G.LP_mypub25519) == 0 && (LP_rand() % 10) == 0 )
LP_postutxos(coin->symbol,coin->smartaddr); LP_postutxos(coin->symbol,coin->smartaddr);
} }
} }

Loading…
Cancel
Save