jl777 7 years ago
parent
commit
c9c0ec3b54
  1. 17
      iguana/exchanges/LP_ordermatch.c
  2. 1
      iguana/exchanges/LP_swap.c

17
iguana/exchanges/LP_ordermatch.c

@ -679,11 +679,16 @@ char *LP_connectedalice(cJSON *argjson) // alice
clonestr("{\"error\":\"cant parse quote\"}");
if ( bits256_cmp(Q.desthash,G.LP_mypub25519) != 0 )
return(clonestr("{\"result\",\"update stats\"}"));
printf("CONNECTED.(%s)\n",jprint(argjson,0));
printf("CONNECTED.(%s) numpending.%d\n",jprint(argjson,0),G.LP_pendingswaps);
if ( G.LP_pendingswaps > 0 )
{
printf("swap already pending\n");
return(clonestr("{\"error\":\"swap already pending\"}"));
}
autxo = &A;
butxo = &B;
LP_abutxo_set(autxo,butxo,&Q);
if ( (autxo= LP_utxopairfind(0,Q.txid,Q.vout,Q.txid2,Q.vout2)) != 0 && autxo->S.swap != 0 )
/*if ( (autxo= LP_utxopairfind(0,Q.txid,Q.vout,Q.txid2,Q.vout2)) != 0 && autxo->S.swap != 0 )
{
printf("swap already pending\n");
return(clonestr("{\"error\":\"swap already pending\"}"));
@ -693,11 +698,11 @@ char *LP_connectedalice(cJSON *argjson) // alice
{
printf("couldnt create autxo\n");
return(clonestr("{\"error\":\"couldnt create autxo\"}"));
}
}*/
if ( (qprice= LP_quote_validate(autxo,butxo,&Q,0)) <= SMALLVAL )
{
LP_availableset(autxo);
G.LP_pendingswaps--;
//G.LP_pendingswaps--;
printf("quote validate error %.0f\n",qprice);
return(clonestr("{\"error\":\"quote validation error\"}"));
}
@ -705,7 +710,7 @@ char *LP_connectedalice(cJSON *argjson) // alice
{
printf("this node has no price for %s/%s (%.8f %.8f)\n",Q.destcoin,Q.srccoin,bid,ask);
LP_availableset(autxo);
G.LP_pendingswaps--;
//G.LP_pendingswaps--;
return(clonestr("{\"error\":\"no price set\"}"));
}
// SPV validate bobs
@ -713,7 +718,7 @@ char *LP_connectedalice(cJSON *argjson) // alice
price = bid;
if ( (coin= LP_coinfind(Q.destcoin)) == 0 )
{
G.LP_pendingswaps--;
//G.LP_pendingswaps--;
return(clonestr("{\"error\":\"cant get alicecoin\"}"));
}
Q.privkey = LP_privkey(Q.destaddr,coin->taddr);

1
iguana/exchanges/LP_swap.c

@ -821,6 +821,7 @@ void LP_aliceloop(void *_swap)
nn_close(swap->N.pair);
swap->N.pair = -1;
}
G.LP_pendingswaps--;
}
bits256 instantdex_derivekeypair(void *ctx,bits256 *newprivp,uint8_t pubkey[33],bits256 privkey,bits256 orderhash)

Loading…
Cancel
Save