Browse Source

Test

etomic
jl777 8 years ago
parent
commit
47f20b288a
  1. 6
      iguana/exchanges/LP_commands.c
  2. 7
      iguana/exchanges/LP_nativeDEX.c

6
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));
}

7
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;
}
}

Loading…
Cancel
Save