Browse Source

Merge branch 'dev' of https://github.com/jl777/SuperNET into etomic

pass-iguana-arg
Artem Pikulin 7 years ago
parent
commit
eb97de6740
  1. 5
      iguana/exchanges/LP_include.h
  2. 13
      iguana/exchanges/LP_ordermatch.c
  3. 14
      iguana/exchanges/LP_utxo.c

5
iguana/exchanges/LP_include.h

@ -29,9 +29,10 @@
#ifdef FROMGUI
#define printf dontprintf
#define fprintf dontprintf
//#define fprintf fdontprintf dont do this!
voind dontprintf(char *formatstr,...) {}
void dontprintf(char *formatstr,...) {}
//void fdontprintf(FILE *fp,char *formatstr,...) {}
#endif
#define LP_MAJOR_VERSION "0"

13
iguana/exchanges/LP_ordermatch.c

@ -1410,7 +1410,7 @@ int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson,
} else printf("got reserved response from destpubkey %s\n",bits256_str(str,Q.srchash));
}
}
if ( bits256_cmp(G.LP_mypub25519,Q.desthash) == 0 && bits256_cmp(G.LP_mypub25519,Q.srchash) != 0 ) // alice
if ( bits256_cmp(G.LP_mypub25519,Q.desthash) == 0 && bits256_cmp(G.LP_mypub25519,Q.srchash) != 0 && (Q.vout != Q.vout2 || bits256_cmp(Q.txid,Q.txid2) != 0) ) // alice
{
if ( Qtrades == 0 )
{
@ -1466,10 +1466,13 @@ int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson,
{
//if ( LP_Alicemaxprice != 0. )
// return(retval);
bestprice = LP_bob_competition(&counter,aliceid,qprice,-1);
if ( Qtrades == 0 )//|| (bits256_cmp(Q.srchash,G.LP_mypub25519) == 0 && bits256_cmp(G.LP_mypub25519,Q.desthash) != 0) )
LP_trades_gotrequest(ctx,&Q,&Q2,jstr(argjson,"pair"));
else LP_tradecommandQ(&Q,jstr(argjson,"pair"),LP_REQUEST);
if ( Q.destvout != Q.feevout || bits256_cmp(Q.desttxid,Q.feetxid) != 0 )
{
bestprice = LP_bob_competition(&counter,aliceid,qprice,-1);
if ( Qtrades == 0 )//|| (bits256_cmp(Q.srchash,G.LP_mypub25519) == 0 && bits256_cmp(G.LP_mypub25519,Q.desthash) != 0) )
LP_trades_gotrequest(ctx,&Q,&Q2,jstr(argjson,"pair"));
else LP_tradecommandQ(&Q,jstr(argjson,"pair"),LP_REQUEST);
}
}
else if ( strcmp(method,"connect") == 0 )
{

14
iguana/exchanges/LP_utxo.c

@ -357,7 +357,7 @@ int32_t LP_address_minmax(int32_t iambob,uint64_t *medianp,uint64_t *minp,uint64
int32_t LP_address_utxo_ptrs(struct iguana_info *coin,int32_t iambob,struct LP_address_utxo **utxos,int32_t max,struct LP_address *ap,char *coinaddr)
{
struct LP_address_utxo *up,*tmp; struct LP_transaction *tx; cJSON *txout; int32_t n = 0;
struct LP_address_utxo *up,*tmp; struct LP_transaction *tx; cJSON *txout; int32_t i,n = 0;
if ( strcmp(ap->coinaddr,coinaddr) != 0 )
printf("UNEXPECTED coinaddr mismatch (%s) != (%s)\n",ap->coinaddr,coinaddr);
//portable_mutex_lock(&LP_utxomutex);
@ -402,9 +402,15 @@ int32_t LP_address_utxo_ptrs(struct iguana_info *coin,int32_t iambob,struct LP_a
}
if ( LP_allocated(up->U.txid,up->U.vout) == 0 )
{
utxos[n++] = up;
if ( n >= max )
break;
for (i=0; i<n; i++)
if ( utxos[i]->U.vout == up->U.vout && bits256_cmp(utxos[i]->U.txid,up->U.txid) == 0 )
break;
if ( i == n )
{
utxos[n++] = up;
if ( n >= max )
break;
}
} //else printf("LP_allocated skip %u\n",LP_allocated(up->U.txid,up->U.vout));
}
else

Loading…
Cancel
Save