jl777 7 years ago
parent
commit
59f36f01b5
  1. 9
      iguana/exchanges/LP_commands.c
  2. 1
      iguana/exchanges/LP_nativeDEX.c
  3. 2
      iguana/exchanges/LP_network.c
  4. 4
      iguana/exchanges/LP_ordermatch.c

9
iguana/exchanges/LP_commands.c

@ -441,7 +441,14 @@ dividends(coin, height, <args>)\n\
memset(zero.bytes,0,sizeof(zero)); memset(zero.bytes,0,sizeof(zero));
if ( strcmp("connect",method) == 0 ) if ( strcmp("connect",method) == 0 )
printf("broadcast.(%s)\n",jprint(reqjson,0)); printf("broadcast.(%s)\n",jprint(reqjson,0));
LP_broadcast_message(LP_mypubsock,base!=0?base:jstr(argjson,"coin"),rel,zero,jprint(reqjson,0)); if ( LP_mypubsock >= 0 )
{
char *msg;
msg = jprint(reqjson,0);
nn_send(pubsock,(void *)msg,(int32_t)strlen(msg)+1,0);
free(msg);
}
//LP_broadcast_message(LP_mypubsock,base!=0?base:jstr(argjson,"coin"),rel,zero,jprint(reqjson,0));
} }
retstr = clonestr("{\"result\":\"success\"}"); retstr = clonestr("{\"result\":\"success\"}");
} else retstr = clonestr("{\"error\":\"couldnt dereference sendmessage\"}"); } else retstr = clonestr("{\"error\":\"couldnt dereference sendmessage\"}");

1
iguana/exchanges/LP_nativeDEX.c

@ -202,6 +202,7 @@ char *LP_process_message(void *ctx,char *typestr,char *myipaddr,int32_t pubsock,
if ( jsonstr != 0 && argjson != 0 ) if ( jsonstr != 0 && argjson != 0 )
{ {
len = (int32_t)strlen(jsonstr) + 1; len = (int32_t)strlen(jsonstr) + 1;
if ( strcmp(method,"postprice") != 0 )
fprintf(stderr,"%s ",jstr(argjson,"method")); fprintf(stderr,"%s ",jstr(argjson,"method"));
if ( (retstr= LP_command_process(ctx,myipaddr,pubsock,argjson,&((uint8_t *)ptr)[len],recvlen - len)) != 0 ) if ( (retstr= LP_command_process(ctx,myipaddr,pubsock,argjson,&((uint8_t *)ptr)[len],recvlen - len)) != 0 )
{ {

2
iguana/exchanges/LP_network.c

@ -214,7 +214,7 @@ void _LP_queuesend(uint32_t crc32,int32_t sock0,int32_t sock1,uint8_t *msg,int32
printf("_LP_queuesend0 sent %d instead of %d\n",sentbytes,msglen); printf("_LP_queuesend0 sent %d instead of %d\n",sentbytes,msglen);
else else
{ {
printf("Q sent %u\n",crc32); printf("Q sent %u msglen.%d\n",crc32,msglen);
sock0 = -1; sock0 = -1;
} }
} }

4
iguana/exchanges/LP_ordermatch.c

@ -594,7 +594,9 @@ int32_t LP_connectstartbob(void *ctx,int32_t pubsock,struct LP_utxoinfo *utxo,cJ
if ( (pair= LP_nanobind(ctx,pairstr)) >= 0 ) if ( (pair= LP_nanobind(ctx,pairstr)) >= 0 )
{ {
LP_requestinit(&qp->R,qp->srchash,qp->desthash,base,qp->satoshis-qp->txfee,rel,qp->destsatoshis-qp->desttxfee,qp->timestamp,qp->quotetime,DEXselector); LP_requestinit(&qp->R,qp->srchash,qp->desthash,base,qp->satoshis-qp->txfee,rel,qp->destsatoshis-qp->desttxfee,qp->timestamp,qp->quotetime,DEXselector);
printf("call swapinit\n");
swap = LP_swapinit(1,0,privkey,&qp->R,qp); swap = LP_swapinit(1,0,privkey,&qp->R,qp);
printf("swapinit.%p\n",swap);
swap->N.pair = pair; swap->N.pair = pair;
utxo->S.swap = swap; utxo->S.swap = swap;
swap->utxo = utxo; swap->utxo = utxo;
@ -764,6 +766,8 @@ int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson,
{ {
bits256 zero; bits256 zero;
memset(&zero,0,sizeof(zero)); memset(&zero,0,sizeof(zero));
if ( pubsock >= 0 )
nn_send(pubsock,msg,(int32_t)strlen(msg)+1,0);
LP_broadcast_message(pubsock,Q.srccoin,Q.destcoin,zero,msg); //butxo->S.otherpubkey LP_broadcast_message(pubsock,Q.srccoin,Q.destcoin,zero,msg); //butxo->S.otherpubkey
} }
butxo->T.lasttime = (uint32_t)time(NULL); butxo->T.lasttime = (uint32_t)time(NULL);

Loading…
Cancel
Save