|
|
@ -696,10 +696,11 @@ int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson, |
|
|
|
char *method,*msg; cJSON *retjson; double qprice,price,bid,ask; struct LP_utxoinfo A,B,*autxo,*butxo; struct LP_address_utxo **utxos; struct LP_quoteinfo Q; int32_t retval = -1,max=10000; |
|
|
|
if ( (method= jstr(argjson,"method")) != 0 && (strcmp(method,"request") == 0 ||strcmp(method,"connect") == 0) ) |
|
|
|
{ |
|
|
|
printf("TRADECOMMAND.(%s)\n",jprint(argjson,0)); |
|
|
|
retval = 1; |
|
|
|
if ( LP_quoteparse(&Q,argjson) == 0 && bits256_cmp(LP_mypub25519,Q.srchash) == 0 ) |
|
|
|
printf("LP_tradecommand: check received %s\n",method); |
|
|
|
if ( LP_quoteparse(&Q,argjson) == 0 && bits256_cmp(LP_mypub25519,Q.srchash) == 0 && bits256_cmp(LP_mypub25519,Q.desthash) != 0 ) |
|
|
|
{ |
|
|
|
printf("TRADECOMMAND.(%s)\n",jprint(argjson,0)); |
|
|
|
if ( (price= LP_myprice(&bid,&ask,Q.srccoin,Q.destcoin)) <= SMALLVAL || ask <= SMALLVAL ) |
|
|
|
{ |
|
|
|
printf("this node has no price for %s/%s\n",Q.srccoin,Q.destcoin); |
|
|
|