Browse Source

Test

etomic
jl777 7 years ago
parent
commit
bf7260e484
  1. 7
      iguana/exchanges/LP_cache.c
  2. 9
      iguana/exchanges/LP_ordermatch.c

7
iguana/exchanges/LP_cache.c

@ -45,10 +45,9 @@ struct LP_transaction *LP_create_transaction(struct iguana_info *coin,bits256 tx
vins = jarray(&numvins,txobj,"vin");
vouts = jarray(&numvouts,txobj,"vout");
tx = LP_transactionadd(coin,txid,height,numvouts,numvins);
tx->serialized = 0;//serialized;
free(serialized);
tx->serialized = serialized, tx->len = 0;
//free(serialized), tx->len = 0;
tx->fpos = fpos;
tx->len = 0;//tx->len;
tx->SPV = tx->height = height;
//printf("tx.%s numvins.%d numvouts.%d\n",bits256_str(str,txid),numvins,numvouts);
for (i=0; i<numvouts; i++)
@ -262,7 +261,7 @@ int32_t LP_merkleproof(struct iguana_info *coin,char *coinaddr,struct electrum_i
if ( tx != 0 )
{
tx->SPV = height;
if ( tx->serialized != 0 )
if ( 0 && tx->serialized != 0 )
{
free(tx->serialized);
tx->serialized = 0;

9
iguana/exchanges/LP_ordermatch.c

@ -121,7 +121,7 @@ int32_t LP_quote_checkmempool(struct LP_quoteinfo *qp,struct LP_utxoinfo *autxo,
double LP_quote_validate(struct LP_utxoinfo *autxo,struct LP_utxoinfo *butxo,struct LP_quoteinfo *qp,int32_t iambob)
{
double qprice=0.; char str[65]; cJSON *txout; uint64_t txfee,desttxfee,srcvalue=0,srcvalue2=0,destvalue=0,destvalue2=0;
//printf(">>>>>>> quote satoshis.(%.8f %.8f) %s %.8f -> %s %.8f\n",dstr(qp->satoshis),dstr(qp->destsatoshis),qp->srccoin,dstr(qp->satoshis),qp->destcoin,dstr(qp->destsatoshis));
printf(">>>>>>> quote satoshis.(%.8f %.8f) %s %.8f -> %s %.8f\n",dstr(qp->satoshis),dstr(qp->destsatoshis),qp->srccoin,dstr(qp->satoshis),qp->destcoin,dstr(qp->destsatoshis));
if ( butxo != 0 )
{
if ( LP_iseligible(&srcvalue,&srcvalue2,1,qp->srccoin,qp->txid,qp->vout,qp->satoshis,qp->txid2,qp->vout2) == 0 )
@ -177,14 +177,11 @@ double LP_quote_validate(struct LP_utxoinfo *autxo,struct LP_utxoinfo *butxo,str
return(-24);
}
}
printf("checked autxo and butxo\n");
if ( LP_quote_checkmempool(qp,autxo,butxo) < 0 )
return(-4);
//if ( iambob != 0 && (*butxop= LP_utxofind(1,qp->txid,qp->vout)) == 0 )
// return(-5);
if ( iambob == 0 && autxo != 0 )
{
//if ( (*autxop= LP_utxofind(0,qp->desttxid,qp->destvout)) == 0 )
// return(-8);
if ( bits256_cmp(autxo->fee.txid,qp->feetxid) != 0 || autxo->fee.vout != qp->feevout )
return(-9);
if ( strcmp(autxo->coinaddr,qp->destaddr) != 0 )
@ -1006,11 +1003,13 @@ struct LP_quoteinfo *LP_trades_gotconnected(void *ctx,struct LP_quoteinfo *qp,st
qp = newqp;
if ( LP_trades_alicevalidate(ctx,qp) > 0. )
{
printf("LP_trades_alicevalidate fine\n");
LP_aliceid(qp->tradeid,qp->aliceid,"connected",0,0);
if ( (retstr= LP_connectedalice(qp,pairstr)) != 0 )
free(retstr);
return(qp);
}
printf("LP_trades_alicevalidate error\n");
return(0);
}

Loading…
Cancel
Save