Browse Source

Test

etomic
jl777 8 years ago
parent
commit
3d5832f2dc
  1. 13
      iguana/exchanges/LP_portfolio.c
  2. 12
      iguana/exchanges/LP_swap.c

13
iguana/exchanges/LP_portfolio.c

@ -455,13 +455,16 @@ int32_t LP_portfolio_trade(void *ctx,uint32_t *requestidp,uint32_t *quoteidp,str
if ( requestid != 0 && quoteid != 0 )
break;
} else printf("cant find alice %.8f %s\n",relvolume,sell->symbol);
for (i=0; i<100; i++)
if ( iter == 0 )
{
relvolume *= .99;
if ( LP_utxo_bestfit(sell->symbol,SATOSHIDEN * relvolume) != 0 )
for (i=0; i<100; i++)
{
printf("i.%d relvolume %.8f from %.8f\n",i,relvolume,sell->relvolume);
break;
relvolume *= .99;
if ( LP_utxo_bestfit(sell->symbol,SATOSHIDEN * relvolume) != 0 )
{
printf("i.%d relvolume %.8f from %.8f\n",i,relvolume,sell->relvolume);
break;
}
}
}
}

12
iguana/exchanges/LP_swap.c

@ -441,15 +441,15 @@ int32_t swap_nn_send(int32_t sock,uint8_t *data,int32_t datalen,uint32_t flags,i
int32_t LP_waitsend(char *statename,int32_t timeout,int32_t pairsock,struct basilisk_swap *swap,uint8_t *data,int32_t maxlen,int32_t (*verify)(struct basilisk_swap *swap,uint8_t *data,int32_t datalen),int32_t (*datagen)(struct basilisk_swap *swap,uint8_t *data,int32_t maxlen))
{
int32_t datalen,sendlen,retval = -1;
printf("waitsend.%s timeout.%d\n",statename,timeout);
//printf("waitsend.%s timeout.%d\n",statename,timeout);
if ( LP_waitfor(pairsock,swap,timeout,verify) == 0 )
{
printf("waited for %s\n",statename);
//printf("waited for %s\n",statename);
if ( (datalen= (*datagen)(swap,data,maxlen)) > 0 )
{
if ( (sendlen= swap_nn_send(pairsock,data,datalen,0,timeout)) == datalen )
{
printf("sent.%d after waitfor.%s\n",sendlen,statename);
//printf("sent.%d after waitfor.%s\n",sendlen,statename);
retval = 0;
} else printf("send %s error\n",statename);
} else printf("%s datagen no data\n",statename);
@ -460,13 +460,13 @@ int32_t LP_waitsend(char *statename,int32_t timeout,int32_t pairsock,struct basi
int32_t LP_sendwait(char *statename,int32_t timeout,int32_t pairsock,struct basilisk_swap *swap,uint8_t *data,int32_t maxlen,int32_t (*verify)(struct basilisk_swap *swap,uint8_t *data,int32_t datalen),int32_t (*datagen)(struct basilisk_swap *swap,uint8_t *data,int32_t maxlen))
{
int32_t datalen,sendlen,retval = -1;
printf("sendwait.%s\n",statename);
//printf("sendwait.%s\n",statename);
if ( (datalen= (*datagen)(swap,data,maxlen)) > 0 )
{
printf("generated %d for %s, timeout.%d\n",datalen,statename,timeout);
//printf("generated %d for %s, timeout.%d\n",datalen,statename,timeout);
if ( (sendlen= swap_nn_send(pairsock,data,datalen,0,timeout)) == datalen )
{
printf("sendwait.%s sent %d\n",statename,sendlen);
//printf("sendwait.%s sent %d\n",statename,sendlen);
if ( LP_waitfor(pairsock,swap,timeout,verify) == 0 )
{
//printf("waited! sendwait.%s sent %d\n",statename,sendlen);

Loading…
Cancel
Save