From 87e3235b6b6d3985bc3cb7e501f2dae96a292c8b Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 24 Jun 2018 07:42:34 -1100 Subject: [PATCH] Clear my price on Alice query clear --- iguana/exchanges/LP_ordermatch.c | 23 ++++++++++++----------- iguana/exchanges/LP_signatures.c | 3 +-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index 8e715b858..0f77f4386 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -526,7 +526,6 @@ int32_t LP_connectstartbob(void *ctx,int32_t pubsock,char *base,char *rel,double LP_importaddress(qp->destcoin,qp->destaddr); LP_otheraddress(qp->srccoin,otheraddr,qp->destcoin,qp->destaddr); LP_importaddress(qp->srccoin,otheraddr); - if ( qp->mpnet == 0 || qp->fill == 0 || qp->gtc == 0 ) { bits256 zero; memset(zero.bytes,0,sizeof(zero)); @@ -547,14 +546,13 @@ int32_t LP_connectstartbob(void *ctx,int32_t pubsock,char *base,char *rel,double printf("send CONNECT for %u-%u\n",qp->R.requestid,qp->R.quoteid); LP_reserved_msg(1,qp->srccoin,qp->destcoin,zero,jprint(reqjson,0)); if ( IPC_ENDPOINT >= 0 ) - LP_queuecommand(0,jprint(reqjson,1),IPC_ENDPOINT,-1,0); - else free_json(reqjson); + LP_queuecommand(0,jprint(reqjson,0),IPC_ENDPOINT,-1,0); } - else + if ( qp->mpnet != 0 && qp->fill != 0 && qp->gtc != 0 ) { // send to mpnet - free_json(reqjson); } + free_json(reqjson); retval = 0; } else @@ -592,7 +590,7 @@ void LP_gtc_iteration(void *ctx,char *myipaddr,int32_t mypubsock) DL_FOREACH_SAFE(GTCorders,gtc,tmp) { qp = >c->Q; - if ( (qp->mpnet == 0 || qp->fill == 0) && gtc->cancelled == 0 && (oldest == 0 || gtc->pending < oldest) ) + if ( gtc->cancelled == 0 && (oldest == 0 || gtc->pending < oldest) ) oldest = gtc->pending; } DL_FOREACH_SAFE(GTCorders,gtc,tmp) @@ -612,7 +610,7 @@ void LP_gtc_iteration(void *ctx,char *myipaddr,int32_t mypubsock) } else { - if ( (qp->mpnet == 0 || qp->fill == 0) && gtc->pending <= oldest+60 && time(NULL) > gtc->pending+LP_AUTOTRADE_TIMEOUT*10 ) + if ( gtc->pending <= oldest+60 && time(NULL) > gtc->pending+LP_AUTOTRADE_TIMEOUT*10 ) { gtc->pending = qp->timestamp = (uint32_t)time(NULL); LP_query(ctx,myipaddr,mypubsock,"request",qp); @@ -646,12 +644,11 @@ char *LP_trade(void *ctx,char *myipaddr,int32_t mypubsock,struct LP_quoteinfo *q DL_APPEND(GTCorders,gtc); portable_mutex_unlock(&LP_gtcmutex); } - if ( qp->mpnet == 0 || qp->gtc == 0 || qp->fill == 0 ) { LP_query(ctx,myipaddr,mypubsock,"request",qp); LP_Alicequery = *qp, LP_Alicemaxprice = maxprice, Alice_expiration = qp->timestamp + timeout, LP_Alicedestpubkey = qp->srchash; } - else + if ( qp->mpnet != 0 && qp->gtc != 0 && qp->fill != 0 ) { // send to mpnet } @@ -680,6 +677,11 @@ int32_t LP_quotecmp(int32_t strictflag,struct LP_quoteinfo *qp,struct LP_quotein void LP_alicequery_clear() { + if ( LP_Alicequery.srccoin[0] != 0 && LP_Alicequery.destcoin[0] != 0 ) + { + LP_mypriceset(&changed,LP_Alicequery.destcoin,LP_Alicequery.srccoin,0.); + LP_mypriceset(&changed,LP_Alicequery.srccoin,LP_Alicequery.destcoin,0.); + } memset(&LP_Alicequery,0,sizeof(LP_Alicequery)); memset(&LP_Alicedestpubkey,0,sizeof(LP_Alicedestpubkey)); LP_Alicemaxprice = 0.; @@ -1201,14 +1203,13 @@ printf("bob %s received REQUEST.(%s) mpnet.%d fill.%d gtc.%d\n",bits256_str(str, jaddnum(reqjson,"quotetime",qp->quotetime); jaddnum(reqjson,"pending",qp->timestamp + LP_RESERVETIME); jaddstr(reqjson,"method","reserved"); - if ( qp->mpnet == 0 || qp->fill == 0 || qp->gtc == 0 ) { LP_reserved_msg(1,qp->srccoin,qp->destcoin,qp->desthash,jprint(reqjson,0)); bits256 zero; memset(zero.bytes,0,sizeof(zero)); LP_reserved_msg(1,qp->srccoin,qp->destcoin,zero,jprint(reqjson,0)); } - else + if ( qp->mpnet != 0 && qp->gtc != 0 && qp->fill != 0 ) { // send to mpnet } diff --git a/iguana/exchanges/LP_signatures.c b/iguana/exchanges/LP_signatures.c index 8242d39a3..15fb2b694 100644 --- a/iguana/exchanges/LP_signatures.c +++ b/iguana/exchanges/LP_signatures.c @@ -726,7 +726,6 @@ void LP_query(void *ctx,char *myipaddr,int32_t mypubsock,char *method,struct LP_ jadd(reqjson,"proof",LP_instantdex_txids(0,coin->smartaddr)); } msg = jprint(reqjson,1); - if ( qp->mpnet == 0 || qp->fill == 0 || qp->gtc == 0 ) { //printf("QUERY.(%s)\n",msg); if ( IPC_ENDPOINT >= 0 ) @@ -739,7 +738,7 @@ void LP_query(void *ctx,char *myipaddr,int32_t mypubsock,char *method,struct LP_ LP_reserved_msg(1,qp->srccoin,qp->destcoin,qp->srchash,clonestr(msg)); } } - else + if ( qp->mpnet != 0 && qp->gtc != 0 && qp->fill != 0 ) { // send to mpnet }