From 47f20b288ae013ef2686dcbfd5999a551a25597f Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 29 May 2017 19:50:56 +0300 Subject: [PATCH] Test --- iguana/exchanges/LP_commands.c | 6 +++--- iguana/exchanges/LP_nativeDEX.c | 7 ++++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index a8f56afb0..a150ce32e 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -94,12 +94,12 @@ void LP_command(struct LP_peerinfo *mypeer,int32_t pubsock,cJSON *argjson,uint8_ desttxid = jbits256(argjson,"desttxid"); destvout = jint(argjson,"destvout"); timestamp = juint(argjson,"timestamp"); - quotetime = juint(argjson,"quotetime"); privkey = LP_privkey(utxo->coinaddr); pubkey = LP_pubkey(privkey); srchash = jbits256(argjson,"srchash"); value = j64bits(argjson,"destsatoshis"); - if ( timestamp == utxo->swappending-LP_RESERVETIME && quotetime >= timestamp && quotetime < utxo->swappending && bits256_cmp(pubkey,srchash) == 0 && (destsatoshis= LP_txvalue(rel,desttxid,destvout)) > price*(utxo->satoshis-txfee)+desttxfee && value <= destsatoshis-desttxfee ) + quotetime = juint(argjson,"quotetime"); + //if ( timestamp == utxo->swappending-LP_RESERVETIME && quotetime >= timestamp && quotetime < utxo->swappending && bits256_cmp(pubkey,srchash) == 0 && (destsatoshis= LP_txvalue(rel,desttxid,destvout)) > price*(utxo->satoshis-txfee)+desttxfee && value <= destsatoshis-desttxfee ) { destsatoshis = value; if ( (utxo->pair= nn_socket(AF_SP,NN_PAIR)) < 0 ) @@ -135,7 +135,7 @@ void LP_command(struct LP_peerinfo *mypeer,int32_t pubsock,cJSON *argjson,uint8_ nn_close(utxo->pair); utxo->pair = -1; } - } else printf("dest %.8f < required %.8f\n",dstr(value),dstr(price*(utxo->satoshis-txfee))); + } //else printf("dest %.8f < required %.8f\n",dstr(value),dstr(price*(utxo->satoshis-txfee))); } else printf("no price for %s/%s\n",base,rel); } else printf("utxo->pair.%d when connect came in (%s)\n",utxo->pair,jprint(argjson,0)); } diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 1a5cb048e..cac96ca08 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -774,7 +774,12 @@ void LP_mainloop(struct LP_peerinfo *mypeer,uint16_t mypubport,int32_t pubsock,i LP_send(peer->pushsock,jprint(reqjson,0),1); jdelete(reqjson,"method"); jaddstr(reqjson,"method","request"); - LP_send(peer->pushsock,jprint(reqjson,1),1); + LP_send(peer->pushsock,jprint(reqjson,0),1); + jdelete(reqjson,"method"); + jaddstr(reqjson,"method","connect"); + LP_send(peer->pushsock,jprint(reqjson,0),1); + + //SENT.({"base":"KMD","rel":"BTC","timestamp":1496076137,"price":0.00021791,"txid":"f5d5e2eb4ef85c78f95076d0d2d99af9e1b85968e57b3c7bdb282bd005f7c341","srchash":"2fe57da347cd62431528daac5fbb290730fff684afc4cfc2ed90995f58cb3b74","txfee":"100000","satoshis":"9999900000","destsatoshis":"2179101","result":"reserved","pending":1496076197} nonz = 1; } }