From ed3c7267f8b9920ff13c82050a760725c1dc85a6 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 25 Jun 2018 07:38:48 -1100 Subject: [PATCH] mpnet api, only for gtc:0 --- iguana/exchanges/LP_commands.c | 7 +++++++ iguana/exchanges/LP_nativeDEX.c | 5 ----- iguana/exchanges/LP_ordermatch.c | 8 ++++---- iguana/exchanges/LP_signatures.c | 2 +- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index badc9e223..302db7006 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -173,6 +173,7 @@ unlockedspend(coin, txid)\n\ opreturndecrypt(coin, txid, passphrase)\n\ getendpoint(port=5555)\n\ getfee(coin)\n\ +mpnet(onoff)\n\ sleep(seconds=60)\n\ listtransactions(coin, address, count=10, skip=0)\n\ jpg(srcfile, destfile, power2=7, password, data="", required, ind=0)\n\ @@ -238,6 +239,12 @@ jpg(srcfile, destfile, power2=7, password, data="", required, ind=0)\n\ } return(clonestr("{\"error\":\"cant find KMD\"}")); } + else if ( strcmp(method,"mpnet") == 0 ) + { + G.mpnet = jint(argjson,"onoff"); + printf("MPNET onoff.%d\n",G.mpnet); + return(clonestr("{\"status\":\"success\"}")); + } else if ( strcmp(method,"getendpoint") == 0 ) { int32_t err,mode; uint16_t wsport = 5555; char endpoint[64],bindpoint[64]; diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index bc59b65eb..8974396f1 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -1649,11 +1649,6 @@ void LPinit(uint16_t myport,uint16_t mypullport,uint16_t mypubport,uint16_t mybu int32_t nonz,didremote=0; LP_statslog_parse(); bitcoind_RPC_inittime = 0; - //if ( strcmp(G.USERPASS,"9894cc3a6f94afa8871d3633dce61a4444d48d670bacb229fb607064654ae81f") == 0 ) - { - G.mpnet = 1; - printf("MPNET active\n"); - } //LP_mpnet_init(); seems better to have the GUI send in persistent orders, exit mm is a cancel all while ( LP_STOP_RECEIVED == 0 ) { diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index bd10afc4a..c433720a3 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -547,7 +547,7 @@ int32_t LP_connectstartbob(void *ctx,int32_t pubsock,char *base,char *rel,double if ( IPC_ENDPOINT >= 0 ) LP_queuecommand(0,jprint(reqjson,0),IPC_ENDPOINT,-1,0); } - if ( qp->mpnet != 0 && qp->fill != 0 && qp->gtc != 0 ) + if ( qp->mpnet != 0 && qp->gtc == 0 ) { char *msg = jprint(reqjson,0); LP_mpnet_send(0,msg,1,0); @@ -655,11 +655,11 @@ char *LP_trade(void *ctx,char *myipaddr,int32_t mypubsock,struct LP_quoteinfo *q LP_query(ctx,myipaddr,mypubsock,"request",qp); LP_Alicequery = *qp, LP_Alicemaxprice = qp->maxprice, Alice_expiration = qp->timestamp + timeout, LP_Alicedestpubkey = qp->srchash; } - if ( qp->gtc != 0 ) + if ( qp->gtc == 0 ) { cJSON *reqjson = LP_quotejson(qp); char *msg = jprint(reqjson,1); - LP_mpnet_send(1,msg,qp->fill,0); + LP_mpnet_send(1,msg,1,0); free(msg); } char str[65]; printf("LP_trade mpnet.%d fill.%d gtc.%d %s/%s %.8f vol %.8f dest.(%s) maxprice %.8f etomicdest.(%s) uuid.%s fill.%d gtc.%d\n",qp->mpnet,qp->fill,qp->gtc,qp->srccoin,qp->destcoin,dstr(qp->satoshis),dstr(qp->destsatoshis),bits256_str(str,LP_Alicedestpubkey),qp->maxprice,qp->etomicdest,qp->uuidstr,qp->fill,qp->gtc); @@ -1205,7 +1205,7 @@ printf("bob %s received REQUEST.(%s) mpnet.%d fill.%d gtc.%d\n",bits256_str(str, memset(zero.bytes,0,sizeof(zero)); LP_reserved_msg(1,qp->srccoin,qp->destcoin,zero,jprint(reqjson,0)); } - if ( qp->mpnet != 0 && qp->gtc != 0 && qp->fill != 0 ) + if ( qp->mpnet != 0 && qp->gtc == 0 ) { char *msg = jprint(reqjson,0); LP_mpnet_send(0,msg,1,0); diff --git a/iguana/exchanges/LP_signatures.c b/iguana/exchanges/LP_signatures.c index 58713b7ff..b4c90ffba 100644 --- a/iguana/exchanges/LP_signatures.c +++ b/iguana/exchanges/LP_signatures.c @@ -741,7 +741,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)); } } - if ( strcmp(method,"connect") == 0 && qp->mpnet != 0 && qp->gtc != 0 && qp->fill != 0 ) + if ( strcmp(method,"connect") == 0 && qp->mpnet != 0 && qp->gtc == 0 ) LP_mpnet_send(0,msg,1,0); free(msg); }