jl777 7 years ago
parent
commit
80537395ad
  1. 10
      iguana/exchanges/LP_nativeDEX.c
  2. 6
      iguana/exchanges/LP_ordermatch.c

10
iguana/exchanges/LP_nativeDEX.c

@ -207,6 +207,8 @@ char *LP_process_message(void *ctx,char *typestr,char *myipaddr,int32_t pubsock,
if ( (retstr= LP_command_process(ctx,myipaddr,pubsock,argjson,&((uint8_t *)ptr)[len],recvlen - len)) != 0 )
{
}
if ( jobj(argjson,"method") != 0 && strncmp(jstr(argjson,"method"),"connect",7) == 0 )
fprintf(stderr,"finished %s\n",jsonstr);
free_json(argjson);
}
}
@ -320,9 +322,13 @@ void command_rpcloop(void *myipaddr)
{
if ( peer->errors >= LP_MAXPEER_ERRORS )
{
if ( (rand() % 10000) == 0 )
if ( (rand() % 100) == 0 )
peer->errors--;
else continue;
else
{
printf("skip %s\n",peer->ipaddr);
continue;
}
}
//printf("check %s pubsock.%d\n",peer->ipaddr,peer->subsock);
nonz += LP_sock_check("PULL",ctx,origipaddr,LP_mypubsock,peer->subsock,peer->ipaddr);

6
iguana/exchanges/LP_ordermatch.c

@ -712,7 +712,6 @@ int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson,
retval = 1;
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);
@ -733,6 +732,7 @@ int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson,
char str[65]; printf("couldnt find bob utxos for autxo %s/v%d %.8f\n",bits256_str(str,autxo->payment.txid),autxo->payment.vout,dstr(autxo->S.satoshis));
return(-44);
}
printf("TRADECOMMAND.(%s)\n",jprint(argjson,0));
Q.txid = butxo->payment.txid;
Q.vout = butxo->payment.vout;
Q.txid2 = butxo->deposit.txid;
@ -772,7 +772,7 @@ int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson,
//memset(&zero,0,sizeof(zero));
LP_broadcast_message(pubsock,Q.srccoin,Q.destcoin,butxo->S.otherpubkey,msg);
LP_butxo_swapfields_set(butxo);
return(2);
return(0);
}
} else printf("warning swappending.%u swap.%p\n",butxo->T.swappending,butxo->S.swap);
}
@ -784,7 +784,7 @@ int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson,
// validate SPV alice
LP_connectstartbob(ctx,pubsock,butxo,argjson,Q.srccoin,Q.destcoin,qprice,&Q);
LP_butxo_swapfields_set(butxo);
return(3);
return(0);
}
else printf("pend.%u swap %p when connect came in (%s)\n",butxo->T.swappending,butxo->S.swap,jprint(argjson,0));
}

Loading…
Cancel
Save