diff --git a/iguana/exchanges/LP_instantdex.c b/iguana/exchanges/LP_instantdex.c index 63068518b..db381bbcf 100644 --- a/iguana/exchanges/LP_instantdex.c +++ b/iguana/exchanges/LP_instantdex.c @@ -639,7 +639,7 @@ int64_t LP_dynamictrust(int64_t credits,bits256 pubkey,int64_t kmdvalue) printf("unfinished alice %llu r%u-r%u src.%s %.8f dest.%s %.8f -> price %.8f value %.8f\n",(long long)sp->aliceid,sp->Q.R.requestid,sp->Q.R.quoteid,sp->Q.srccoin,dstr(sp->Q.satoshis),sp->Q.destcoin,dstr(sp->Q.destsatoshis),(double)sp->Q.destsatoshis/(sp->Q.satoshis+1),dstr(LP_kmdvalue(sp->Q.destcoin,sp->Q.destsatoshis))); } } - //printf("REJECT: %s instantdex_credits %.8f vs (%.8f + current %.8f)\n",coinaddr,dstr(credits),dstr(swaps_kmdvalue),dstr(kmdvalue)); + printf("REJECT: %s instantdex_credits %.8f vs (%.8f + current %.8f)\n",coinaddr,dstr(credits),dstr(swaps_kmdvalue),dstr(kmdvalue)); } if ( 0 && credits != 0 ) printf("%s %s othercredits %.8f debits %.8f + %.8f -> %.8f\n",coin->symbol,coinaddr,dstr(credits),dstr(swaps_kmdvalue),dstr(kmdvalue),dstr(credits - (swaps_kmdvalue+kmdvalue))); @@ -679,9 +679,9 @@ int64_t LP_instantdex_proofcheck(char *symbol,char *coinaddr,cJSON *proof,int32_ credits = ap->instantdex_credits; ap->didinstantdex = 1; ap->instantdextime = (uint32_t)time(NULL); - if ( 0 && ap->instantdex_credits > 0 ) + if ( 1 && ap->instantdex_credits > 0 ) printf("validated instantdex %s.[%d] proof.(%s) credits %.8f\n",othersmartaddr,num,jprint(proof,0),dstr(ap->instantdex_credits)); - } //else printf("cant find ap.%p or already did %d %.8f\n",ap,ap!=0?ap->didinstantdex:-1,ap!=0?dstr(ap->instantdex_credits):-1); + } else printf("cant find ap.%p or already did %d %.8f\n",ap,ap!=0?ap->didinstantdex:-1,ap!=0?dstr(ap->instantdex_credits):-1); } return(credits); } diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index fc48bbf3e..563277f4b 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -445,7 +445,7 @@ struct LP_utxoinfo *LP_address_myutxopair(struct LP_utxoinfo *butxo,int32_t iamb { if ( (m= LP_address_utxo_ptrs(coin,iambob,utxos,max,ap,coinaddr)) > 1 ) { - if ( 0 ) + if ( 1 ) { int32_t i; for (i=0; i= myprice ) { for (j=0; jdestsatoshis)); - if ( (butxo= LP_address_myutxopair(&B,1,utxos,max,LP_coinfind(qp->srccoin),qp->coinaddr,qp->txfee,dstr(qp->destsatoshis),price,qp->desttxfee)) != 0 ) + if ( (butxo= LP_address_myutxopair(&B,1,utxos,max,coin,qp->coinaddr,qp->txfee,dstr(qp->destsatoshis),price,qp->desttxfee)) != 0 ) { strcpy(qp->gui,G.gui); strcpy(qp->coinaddr,coin->smartaddr); @@ -1181,7 +1182,7 @@ printf("bob %s received REQUEST.(%s) mpnet.%d fill.%d gtc.%d\n",bits256_str(str, else if ( qp->fill != 0 || i == priceiters ) { printf("i.%d cant find utxopair aliceid.%llu %s/%s %.8f -> relvol %.8f txfee %.8f\n",i,(long long)qp->aliceid,qp->srccoin,qp->destcoin,dstr(LP_basesatoshis(dstr(qp->destsatoshis),price,qp->txfee,qp->desttxfee)),dstr(qp->destsatoshis),dstr(qp->txfee)); - if ( qp->gtc != 0 && qp->fill != 0 && coin != 0 ) + if ( qp->gtc != 0 && qp->fill != 0 && coin != 0 && coin->electrum == 0 ) { LP_address_utxo_reset(&num,coin); satoshis = LP_basesatoshis(dstr(qp->destsatoshis),price,qp->txfee,qp->desttxfee) + 3*qp->txfee; diff --git a/iguana/exchanges/LP_rpc.c b/iguana/exchanges/LP_rpc.c index e5a3d3e12..8979239fd 100644 --- a/iguana/exchanges/LP_rpc.c +++ b/iguana/exchanges/LP_rpc.c @@ -254,14 +254,17 @@ cJSON *LP_gettxout(char *symbol,char *coinaddr,bits256 txid,int32_t vout) return(cJSON_Parse("{\"error\":\"no coin\"}")); if ( bits256_nonz(txid) == 0 ) return(cJSON_Parse("{\"error\":\"null txid\"}")); - if ( (tx= LP_transactionfind(coin,txid)) != 0 && vout < tx->numvouts ) - { - if ( tx->outpoints[vout].spendheight > 0 ) - return(0); - //return(LP_gettxout_json(txid,vout,tx->height,tx->outpoints[vout].coinaddr,tx->outpoints[vout].value)); - } if ( coin->electrum == 0 ) { + if ( (tx= LP_transactionfind(coin,txid)) != 0 && vout < tx->numvouts ) + { + if ( tx->outpoints[vout].spendheight > 0 ) + { + //fprintf(stderr,"LP_gettxout (%s) tx->outpoints[vout].spendheight > 0\n",coinaddr); + return(0); + } + //return(LP_gettxout_json(txid,vout,tx->height,tx->outpoints[vout].coinaddr,tx->outpoints[vout].value)); + } sprintf(buf,"[\"%s\", %d, true]",bits256_str(str,txid),vout); return(bitcoin_json(coin,"gettxout",buf)); } @@ -281,7 +284,10 @@ cJSON *LP_gettxout(char *symbol,char *coinaddr,bits256 txid,int32_t vout) if ( (up= LP_address_utxofind(coin,coinaddr,txid,vout)) != 0 ) { if ( up->spendheight > 0 ) + { + //fprintf(stderr,"LP_gettxout (%s) up->spendheight > 0\n",coinaddr); return(0); + } //return(LP_gettxout_json(txid,vout,up->U.height,coinaddr,up->U.value)); } memset(zero.bytes,0,sizeof(zero)); @@ -1145,7 +1151,7 @@ int32_t LP_txhasnotarization(bits256 *notarizedhashp,struct iguana_info *coin,bi { cJSON *txobj,*vins,*vin,*vouts,*vout,*spentobj,*sobj; char *hexstr; uint8_t script[1024]; bits256 spenttxid; uint64_t notarymask; int32_t i,j,numnotaries,len,spentvout,numvins,numvouts,hasnotarization = 0; memset(notarizedhashp,0,sizeof(*notarizedhashp)); - if ( (txobj= LP_gettx("LP_txhasnotarization",coin->symbol,txid,0)) != 0 ) + if ( (txobj= LP_gettx("LP_txhasnotarization",coin->symbol,txid,1)) != 0 ) { if ( (vins= jarray(&numvins,txobj,"vin")) != 0 ) { @@ -1157,7 +1163,7 @@ int32_t LP_txhasnotarization(bits256 *notarizedhashp,struct iguana_info *coin,bi vin = jitem(vins,i); spenttxid = jbits256(vin,"txid"); spentvout = jint(vin,"vout"); - if ( (spentobj= LP_gettx("LP_txhasnotarization",coin->symbol,spenttxid,0)) != 0 ) + if ( (spentobj= LP_gettx("LP_txhasnotarization",coin->symbol,spenttxid,1)) != 0 ) { if ( (vouts= jarray(&numvouts,spentobj,"vout")) != 0 ) { diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index 32d1cab01..a58b4ae4a 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -2319,7 +2319,7 @@ int32_t LP_swap_getcoinaddr(char *symbol,char *coinaddr,bits256 txid,int32_t vou { cJSON *retjson; coinaddr[0] = 0; - if ( (retjson= LP_gettx("LP_swap_getcoinaddr",symbol,txid,0)) != 0 ) + if ( (retjson= LP_gettx("LP_swap_getcoinaddr",symbol,txid,1)) != 0 ) { LP_txdestaddr(coinaddr,txid,vout,retjson); free_json(retjson); diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index b81ec3449..92f91e686 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -906,7 +906,7 @@ cJSON *LP_transactioninit(struct iguana_info *coin,bits256 txid,int32_t iter,cJS struct LP_transaction *tx; int32_t i,height,numvouts,numvins,spentvout; cJSON *vins,*vouts,*vout,*vin; bits256 spenttxid; char str[65]; if ( coin->inactive != 0 ) return(0); - if ( txobj != 0 || (txobj= LP_gettx("LP_transactioninit",coin->symbol,txid,0)) != 0 ) + if ( txobj != 0 || (txobj= LP_gettx("LP_transactioninit",coin->symbol,txid,1)) != 0 ) { if ( coin->electrum == 0 ) height = LP_txheight(coin,txid); @@ -972,7 +972,7 @@ int32_t LP_txheight(struct iguana_info *coin,bits256 txid) return(height); if ( coin->electrum == 0 ) { - if ( (txobj= LP_gettx("LP_txheight",coin->symbol,txid,0)) != 0 ) + if ( (txobj= LP_gettx("LP_txheight",coin->symbol,txid,1)) != 0 ) { //*timestampp = juint(txobj,"locktime"); //*blocktimep = juint(txobj,"blocktime"); @@ -1075,7 +1075,7 @@ uint64_t LP_txinterestvalue(uint64_t *interestp,char *destaddr,struct iguana_inf { if ( (value= LP_value_extract(txobj,0,txid)) == 0 ) { - char str[65]; printf("%s LP_txvalue.%s strange utxo.(%s) vout.%d\n",coin->symbol,bits256_str(str,txid),jprint(txobj,0),vout); + // char str[65]; printf("%s LP_txvalue.%s strange utxo.(%s) vout.%d\n",coin->symbol,bits256_str(str,txid),jprint(txobj,0),vout); } else if ( strcmp(coin->symbol,"KMD") == 0 ) { @@ -1226,7 +1226,7 @@ int32_t LP_iseligible(uint64_t *valp,uint64_t *val2p,int32_t iambob,char *symbol } else free_json(txobj); if ( (txobj= LP_gettxout(coin->symbol,destaddr,txid2,vout2)) == 0 ) { - printf("Could not find tx out: %s %d\n", txid_str, vout2); + printf("Could not find tx out2: %s %d\n", txid_str, vout2); return (0); } else free_json(txobj);