|
|
@ -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); |
|
|
|
} |
|
|
|
|
|
|
|