jl777 7 years ago
parent
commit
d17c3d7985
  1. 5
      iguana/exchanges/LP_nativeDEX.c
  2. 13
      iguana/exchanges/LP_ordermatch.c

5
iguana/exchanges/LP_nativeDEX.c

@ -682,7 +682,7 @@ int32_t LP_reserved_msgs()
bits256 zero; int32_t n = 0; //struct nn_pollfd pfd;
memset(zero.bytes,0,sizeof(zero));
portable_mutex_lock(&LP_reservedmutex);
if ( num_Reserved_msgs > 0 )
while ( num_Reserved_msgs > 0 )
{
/*memset(&pfd,0,sizeof(pfd));
pfd.fd = LP_mypubsock;
@ -695,7 +695,8 @@ int32_t LP_reserved_msgs()
#endif
LP_broadcast_message(LP_mypubsock,"","",zero,Reserved_msgs[num_Reserved_msgs]);
Reserved_msgs[num_Reserved_msgs] = 0;
n++;
if ( n++ > 10 )
break;
#ifdef __APPLE__
usleep(5000);
#else

13
iguana/exchanges/LP_ordermatch.c

@ -426,10 +426,9 @@ void LP_reserved(void *ctx,char *myipaddr,int32_t mypubsock,struct LP_quoteinfo
price = LP_pricecache(qp,qp->srccoin,qp->destcoin,qp->txid,qp->vout);
if ( LP_pricevalid(price) > 0 && maxprice > SMALLVAL && price <= maxprice )
{
//memset(&LP_Alicequery,0,sizeof(LP_Alicequery));
//LP_Alicemaxprice = 0.;
//Alice_expiration = 0;
LP_Alicequery = *qp;
memset(&LP_Alicequery,0,sizeof(LP_Alicequery));
LP_Alicemaxprice = 0.;
Alice_expiration = 0;
LP_query(ctx,myipaddr,mypubsock,"connect",qp);
}
} else printf("reject reserved due to not eligible.%d or mismatched quote price %.8f vs maxprice %.8f\n",LP_alice_eligible(),price,maxprice);
@ -443,14 +442,14 @@ char *LP_connectedalice(cJSON *argjson) // alice
if ( bits256_cmp(Q.desthash,G.LP_mypub25519) != 0 )
return(clonestr("{\"result\",\"update stats\"}"));
printf("CONNECTED.(%s) numpending.%d\n",jprint(argjson,0),G.LP_pendingswaps);
if ( LP_alice_eligible() == 0 || LP_quotecmp(&Q,&LP_Alicequery) != 0 )
/*if ( LP_alice_eligible() == 0 || LP_quotecmp(&Q,&LP_Alicequery) != 0 )
{
printf("reject mismatched alice query\n");
return(clonestr("{\"error\",\"mismatched alice query\"}"));
}
memset(&LP_Alicequery,0,sizeof(LP_Alicequery));
LP_Alicemaxprice = 0.;
Alice_expiration = 0;
Alice_expiration = 0;*/
if ( (autxo= LP_utxopairfind(0,Q.desttxid,Q.destvout,Q.feetxid,Q.feevout)) == 0 )
{
printf("cant find autxo\n");
@ -619,7 +618,7 @@ int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson,
}
else if ( strcmp(method,"connected") == 0 )
{
if ( bits256_cmp(G.LP_mypub25519,Q.desthash) == 0 && bits256_cmp(G.LP_mypub25519,Q.srchash) != 0 && LP_alice_eligible() > 0 )
if ( bits256_cmp(G.LP_mypub25519,Q.desthash) == 0 && bits256_cmp(G.LP_mypub25519,Q.srchash) != 0 )
{
printf("alice %s received CONNECTED.(%s)\n",bits256_str(str,G.LP_mypub25519),jprint(argjson,0));
if ( (retstr= LP_connectedalice(argjson)) != 0 )

Loading…
Cancel
Save