Browse Source

Test

etomic
jl777 8 years ago
parent
commit
61703097af
  1. 2
      iguana/exchanges/LP_network.c
  2. 2
      iguana/exchanges/LP_ordermatch.c
  3. 29
      iguana/exchanges/LP_utxos.c

2
iguana/exchanges/LP_network.c

@ -43,7 +43,7 @@ int32_t LP_send(int32_t sock,char *msg,int32_t freeflag)
{
if ( (sentbytes= nn_send(sock,msg,len,0)) != len )
printf("LP_send sent %d instead of %d\n",sentbytes,len);
else printf("SENT.(%s)\n",msg);
//else printf("SENT.(%s)\n",msg);
if ( freeflag != 0 )
free(msg);
return(sentbytes);

2
iguana/exchanges/LP_ordermatch.c

@ -560,7 +560,7 @@ char *LP_autotrade(char *myipaddr,int32_t mypubsock,double profitmargin,char *ba
{
if ( bestprice == 0. ) // assumes price ordered asks
bestprice = price;
printf("item.[%d] %s\n",i,jprint(item,0));
//printf("item.[%d] %s\n",i,jprint(item,0));
txid = jbits256(item,"txid");
vout = jint(item,"vout");
vol = jdouble(item,"volume");

29
iguana/exchanges/LP_utxos.c

@ -114,19 +114,25 @@ int32_t LP_utxocollisions(struct LP_utxoinfo *ptrs[],struct LP_utxoinfo *refutxo
n = LP_utxoaddptrs(ptrs,n,utxo);
}
portable_mutex_unlock(&LP_utxomutex);
if ( n > 0 )
if ( 0 && n > 0 )
printf("LP_utxocollisions n.%d\n",n);
return(n);
}
void _LP_availableset(struct LP_utxoinfo *utxo)
int32_t _LP_availableset(struct LP_utxoinfo *utxo)
{
int32_t flag = 0;
if ( utxo != 0 )
{
memset(&utxo->S.otherpubkey,0,sizeof(utxo->S.otherpubkey));
utxo->S.swap = 0;
utxo->T.swappending = 0;
if ( bits256_nonz(utxo->S.otherpubkey) != 0 )
flag = 1, memset(&utxo->S.otherpubkey,0,sizeof(utxo->S.otherpubkey));
if ( utxo->S.swap != 0 )
flag = 1, utxo->S.swap = 0;
if ( utxo->T.swappending != 0 )
flag = 1, utxo->T.swappending = 0;
return(flag);
}
return(0);
}
void _LP_unavailableset(struct LP_utxoinfo *utxo,bits256 otherpubkey)
@ -154,16 +160,19 @@ void LP_unavailableset(struct LP_utxoinfo *utxo,bits256 otherpubkey)
void LP_availableset(struct LP_utxoinfo *utxo)
{
struct LP_utxoinfo *ptrs[8]; int32_t i,n; struct _LP_utxoinfo u;
struct LP_utxoinfo *ptrs[8]; int32_t i,n,count = 0; struct _LP_utxoinfo u;
memset(ptrs,0,sizeof(ptrs));
if ( (n= LP_utxocollisions(ptrs,utxo)) > 0 )
{
for (i=0; i<n; i++)
_LP_availableset(ptrs[i]);
count += _LP_availableset(ptrs[i]);
}
count += _LP_availableset(utxo);
if ( count > 0 )
{
u = (utxo->iambob != 0) ? utxo->deposit : utxo->fee;
char str[65],str2[65]; printf("UTXO.[%d] AVAIL %s/v%d %s/v%d collisions.%d\n",utxo->iambob,bits256_str(str,utxo->payment.txid),utxo->payment.vout,bits256_str(str2,u.txid),u.vout,n);
}
u = (utxo->iambob != 0) ? utxo->deposit : utxo->fee;
char str[65],str2[65]; printf("UTXO.[%d] AVAIL %s/v%d %s/v%d collisions.%d\n",utxo->iambob,bits256_str(str,utxo->payment.txid),utxo->payment.vout,bits256_str(str2,u.txid),u.vout,n);
_LP_availableset(utxo);
}
int32_t LP_utxopurge(int32_t allutxos)

Loading…
Cancel
Save