From 06d3b4d8fe8f351c985894495512dbe1ac59fd2b Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 24 Nov 2017 16:38:19 +0400 Subject: [PATCH 1/4] Test --- iguana/exchanges/LP_signatures.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/iguana/exchanges/LP_signatures.c b/iguana/exchanges/LP_signatures.c index e9e44e6ed..06053ac54 100644 --- a/iguana/exchanges/LP_signatures.c +++ b/iguana/exchanges/LP_signatures.c @@ -724,12 +724,12 @@ void LP_query(void *ctx,char *myipaddr,int32_t mypubsock,char *method,struct LP_ jaddnum(reqjson,"timestamp",time(NULL)); msg = jprint(reqjson,1); printf("QUERY.(%s)\n",msg); - if ( bits256_nonz(qp->srchash) == 0 || strcmp(method,"request") != 0 ) + //if ( bits256_nonz(qp->srchash) == 0 || strcmp(method,"request") != 0 ) { memset(&zero,0,sizeof(zero)); LP_reserved_msg(1,qp->srccoin,qp->destcoin,qp->desthash,clonestr(msg)); LP_reserved_msg(1,qp->srccoin,qp->destcoin,zero,clonestr(msg)); - LP_reserved_msg(0,qp->srccoin,qp->destcoin,zero,clonestr(msg)); + //LP_reserved_msg(0,qp->srccoin,qp->destcoin,zero,clonestr(msg)); free(msg); /*portable_mutex_lock(&LP_reservedmutex); if ( num_Reserved_msgs[1] < sizeof(Reserved_msgs[1])/sizeof(*Reserved_msgs[1])-2 ) @@ -737,6 +737,6 @@ void LP_query(void *ctx,char *myipaddr,int32_t mypubsock,char *method,struct LP_ if ( num_Reserved_msgs[0] < sizeof(Reserved_msgs[0])/sizeof(*Reserved_msgs[0])-2 ) Reserved_msgs[0][num_Reserved_msgs[0]++] = msg2; portable_mutex_unlock(&LP_reservedmutex);*/ - } else LP_broadcast_message(LP_mypubsock,qp->srccoin,qp->destcoin,qp->srchash,msg); + } //else LP_broadcast_message(LP_mypubsock,qp->srccoin,qp->destcoin,qp->srchash,msg); } From 477a483e7f77a51eaa9f4e0b9fd7229e4b10a8b7 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 24 Nov 2017 16:48:13 +0400 Subject: [PATCH 2/4] Test --- iguana/exchanges/LP_nativeDEX.c | 2 +- iguana/exchanges/LP_ordermatch.c | 9 +++++---- iguana/exchanges/LP_signatures.c | 1 + 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index cfb101aad..9dcd04f35 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -1029,7 +1029,7 @@ int32_t LP_reserved_msg(int32_t priority,char *base,char *rel,bits256 pubkey,cha { Reserved_msgs[priority][num_Reserved_msgs[priority]++] = msg; n = num_Reserved_msgs[priority]; - } else LP_broadcast_message(LP_mypubsock,base,rel,pubkey,msg); + } //else LP_broadcast_message(LP_mypubsock,base,rel,pubkey,msg); if ( num_Reserved_msgs[priority] > max_Reserved_msgs[priority] ) { max_Reserved_msgs[priority] = num_Reserved_msgs[priority]; diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index 435f43599..aceaf0a4a 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -492,11 +492,12 @@ int32_t LP_connectstartbob(void *ctx,int32_t pubsock,cJSON *argjson,char *base,c jaddstr(retjson,"method","connected"); jaddstr(retjson,"pair",pairstr); char str[65]; printf("BOB pubsock.%d binds to %d (%s)\n",pubsock,pair,bits256_str(str,qp->desthash)); - LP_reserved_msg(1,base,rel,qp->desthash,jprint(retjson,0)); bits256 zero; memset(zero.bytes,0,sizeof(zero)); LP_reserved_msg(1,base,rel,zero,jprint(retjson,0)); - LP_reserved_msg(0,base,rel,zero,jprint(retjson,0)); + //sleep(1); + //LP_reserved_msg(1,base,rel,qp->desthash,jprint(retjson,0)); + //LP_reserved_msg(0,base,rel,zero,jprint(retjson,0)); free_json(retjson); retval = 0; } else printf("error launching swaploop\n"); @@ -1001,11 +1002,11 @@ int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson, msg = jprint(retjson,1); printf("return after queued RESERVED: set swappending.%u accept qprice %.8f, min %.8f\n(%s)\n",Q.timestamp + LP_RESERVETIME,qprice,ask,msg); LP_reserved_msg(1,Q.srccoin,Q.destcoin,Q.desthash,clonestr(msg)); - //sleep(1); + sleep(1); bits256 zero; memset(zero.bytes,0,sizeof(zero)); LP_reserved_msg(1,Q.srccoin,Q.destcoin,zero,clonestr(msg)); - LP_reserved_msg(0,Q.srccoin,Q.destcoin,zero,clonestr(msg)); + //LP_reserved_msg(0,Q.srccoin,Q.destcoin,zero,clonestr(msg)); free(msg); butxo->T.lasttime = (uint32_t)time(NULL); return(retval); diff --git a/iguana/exchanges/LP_signatures.c b/iguana/exchanges/LP_signatures.c index 06053ac54..fe309f6e5 100644 --- a/iguana/exchanges/LP_signatures.c +++ b/iguana/exchanges/LP_signatures.c @@ -728,6 +728,7 @@ void LP_query(void *ctx,char *myipaddr,int32_t mypubsock,char *method,struct LP_ { memset(&zero,0,sizeof(zero)); LP_reserved_msg(1,qp->srccoin,qp->destcoin,qp->desthash,clonestr(msg)); + sleep(1); LP_reserved_msg(1,qp->srccoin,qp->destcoin,zero,clonestr(msg)); //LP_reserved_msg(0,qp->srccoin,qp->destcoin,zero,clonestr(msg)); free(msg); From 91857b435ae3638f92272e99cd2882f999c4e84d Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 24 Nov 2017 16:52:37 +0400 Subject: [PATCH 3/4] Test --- iguana/exchanges/LP_ordermatch.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index aceaf0a4a..8ef7fbb33 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -929,7 +929,7 @@ int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson, price += (r * range) / 100.; bestprice = LP_bob_competition(&counter,aliceid,price,0); printf("%llu >>>>>>> price %.8f qprice %.8f r.%d range %.8f -> %.8f, bestprice %.8f counter.%d\n",(long long)aliceid,ask,qprice,r,range,price,bestprice,counter); - if ( counter > 2 || price > bestprice*.99 ) // skip if late or bad price + if ( counter > 3 || price > bestprice*1.1 ) // skip if late or bad price return(retval); } else return(retval); //LP_RTmetrics_update(Q.srccoin,Q.destcoin); @@ -1001,12 +1001,12 @@ int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson, jaddstr(retjson,"method","reserved"); msg = jprint(retjson,1); printf("return after queued RESERVED: set swappending.%u accept qprice %.8f, min %.8f\n(%s)\n",Q.timestamp + LP_RESERVETIME,qprice,ask,msg); - LP_reserved_msg(1,Q.srccoin,Q.destcoin,Q.desthash,clonestr(msg)); - sleep(1); bits256 zero; memset(zero.bytes,0,sizeof(zero)); LP_reserved_msg(1,Q.srccoin,Q.destcoin,zero,clonestr(msg)); //LP_reserved_msg(0,Q.srccoin,Q.destcoin,zero,clonestr(msg)); + sleep(1); + LP_reserved_msg(1,Q.srccoin,Q.destcoin,Q.desthash,clonestr(msg)); free(msg); butxo->T.lasttime = (uint32_t)time(NULL); return(retval); From ce1db896b2897ff193f64b5544282e463302bd41 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 24 Nov 2017 16:59:13 +0400 Subject: [PATCH 4/4] Test --- iguana/exchanges/LP_stats.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_stats.c b/iguana/exchanges/LP_stats.c index f2f9cf13b..d6ce19cdb 100644 --- a/iguana/exchanges/LP_stats.c +++ b/iguana/exchanges/LP_stats.c @@ -372,7 +372,7 @@ char *LP_swapstatus_recv(cJSON *argjson) sp->lasttime = (uint32_t)time(NULL); if ( (methodind= jint(argjson,"ind")) > sp->methodind && methodind < sizeof(LP_stats_methods)/sizeof(*LP_stats_methods) ) { - if ( sp->finished == 0 && sp->expired == 0 ) + if ( 0 && sp->finished == 0 && sp->expired == 0 ) printf("SWAPSTATUS updated %llu %s %u %u\n",(long long)sp->aliceid,LP_stats_methods[sp->methodind],juint(argjson,"finished"),juint(argjson,"expired")); sp->methodind = methodind; sp->finished = juint(argjson,"finished");