Browse Source

Test

etomic
jl777 7 years ago
parent
commit
308d4743ce
  1. 2
      iguana/exchanges/LP_commands.c
  2. 2
      iguana/exchanges/LP_ordermatch.c
  3. 4
      iguana/exchanges/LP_remember.c
  4. 11
      iguana/exchanges/LP_rpc.c
  5. 2
      iguana/exchanges/LP_socket.c
  6. 8
      iguana/exchanges/LP_transaction.c
  7. 6
      iguana/exchanges/LP_utxo.c
  8. 2
      iguana/exchanges/LP_zeroconf.c

2
iguana/exchanges/LP_commands.c

@ -474,7 +474,7 @@ zeroconf_claim(address, expiration=0)\n\
}
else if ( strcmp(method,"getrawtransaction") == 0 )
{
return(jprint(LP_gettx(coin,jbits256(argjson,"txid")),1));
return(jprint(LP_gettx(coin,jbits256(argjson,"txid"),0),1));
}
else if ( strcmp(method,"withdraw") == 0 )
{

2
iguana/exchanges/LP_ordermatch.c

@ -880,7 +880,7 @@ struct LP_quoteinfo *LP_trades_gotrequest(void *ctx,struct LP_quoteinfo *qp,stru
qp = newqp;
if ( (coin= LP_coinfind(qp->srccoin)) == 0 )
return(0);
printf("LP_trades_gotrequest %s/%s %.8f\n",qp->srccoin,qp->destcoin,LP_trades_bobprice(&bid,&ask,qp));
//printf("LP_trades_gotrequest %s/%s %.8f\n",qp->srccoin,qp->destcoin,LP_trades_bobprice(&bid,&ask,qp));
if ( (myprice= LP_trades_bobprice(&bid,&ask,qp)) == 0. )
return(0);
autxo = &A;

4
iguana/exchanges/LP_remember.c

@ -269,7 +269,7 @@ bits256 basilisk_swap_spendupdate(int32_t iambob,char *symbol,char *spentaddr,in
//printf("i.%d of %d: %s\n",i,n,bits256_str(str,txid));
if ( bits256_cmp(txid,txids[utxoind]) != 0 )
{
if ( (txobj= LP_gettx(symbol,txid)) != 0 )
if ( (txobj= LP_gettx(symbol,txid,1)) != 0 )
{
//printf("txobj.(%s)\n",jprint(txobj,0));
if ( (vins= jarray(&m,txobj,"vin")) != 0 )
@ -777,7 +777,7 @@ int32_t LP_swap_load(struct LP_swap_remember *rswap)
safecopy(rswap->alicecoin,symbol,sizeof(rswap->alicecoin));
if ( rswap->finishedflag == 0 )
{
if ( (sentobj= LP_gettx(symbol,txid)) == 0 )
if ( (sentobj= LP_gettx(symbol,txid,1)) == 0 )
{
char str2[65]; printf("%s %s ready to broadcast\n",symbol,bits256_str(str2,txid));
}

11
iguana/exchanges/LP_rpc.c

@ -410,7 +410,7 @@ cJSON *LP_paxprice(char *fiat)
return(bitcoin_json(coin,"paxprice",buf));
}
cJSON *LP_gettx(char *symbol,bits256 txid)
cJSON *LP_gettx(char *symbol,bits256 txid,int32_t suppress_errors)
{
struct iguana_info *coin; char buf[512],str[65]; cJSON *retjson;
//printf("LP_gettx %s %s\n",symbol,bits256_str(str,txid));
@ -431,7 +431,8 @@ cJSON *LP_gettx(char *symbol,bits256 txid)
{
if ( (retjson= electrum_transaction(symbol,coin->electrum,&retjson,txid,0)) != 0 )
return(retjson);
else printf("failed blockchain.transaction.get %s %s\n",coin->symbol,bits256_str(str,txid));
else if ( suppress_errors == 0 )
printf("failed blockchain.transaction.get %s %s\n",coin->symbol,bits256_str(str,txid));
return(cJSON_Parse("{\"error\":\"no transaction bytes\"}"));
}
}
@ -439,7 +440,7 @@ cJSON *LP_gettx(char *symbol,bits256 txid)
uint32_t LP_locktime(char *symbol,bits256 txid)
{
cJSON *txobj; uint32_t locktime = 0;
if ( (txobj= LP_gettx(symbol,txid)) != 0 )
if ( (txobj= LP_gettx(symbol,txid,0)) != 0 )
{
locktime = juint(txobj,"locktime");
free_json(txobj);
@ -1242,7 +1243,7 @@ const char *Notaries_elected[][2] =
int32_t LP_txhasnotarization(struct iguana_info *coin,bits256 txid)
{
cJSON *txobj,*vins,*vin,*vouts,*vout,*spentobj,*sobj; char *hexstr; uint8_t script[35]; bits256 spenttxid; uint64_t notarymask; int32_t i,j,numnotaries,len,spentvout,numvins,numvouts,hasnotarization = 0;
if ( (txobj= LP_gettx(coin->symbol,txid)) != 0 )
if ( (txobj= LP_gettx(coin->symbol,txid,0)) != 0 )
{
if ( (vins= jarray(&numvins,txobj,"vin")) != 0 )
{
@ -1254,7 +1255,7 @@ int32_t LP_txhasnotarization(struct iguana_info *coin,bits256 txid)
vin = jitem(vins,i);
spenttxid = jbits256(vin,"txid");
spentvout = jint(vin,"vout");
if ( (spentobj= LP_gettx(coin->symbol,spenttxid)) != 0 )
if ( (spentobj= LP_gettx(coin->symbol,spenttxid,0)) != 0 )
{
if ( (vouts= jarray(&numvouts,spentobj,"vout")) != 0 )
{

2
iguana/exchanges/LP_socket.c

@ -733,7 +733,7 @@ cJSON *_electrum_transaction(char *symbol,struct electrum_info *ep,cJSON **retjs
free_json(hexjson);
//printf("return from electrum_transaction\n");
return(*retjsonp);
} else printf("%s %s non-hex tx.(%s)\n",coin->symbol,bits256_str(str,txid),jprint(hexjson,0));
} //else printf("%s %s non-hex tx.(%s)\n",coin->symbol,bits256_str(str,txid),jprint(hexjson,0));
free(hexstr);
free_json(hexjson);
}

8
iguana/exchanges/LP_transaction.c

@ -63,7 +63,7 @@ bits256 LP_pubkey(bits256 privkey)
int32_t LP_gettx_presence(char *symbol,bits256 expectedtxid)
{
cJSON *txobj; bits256 txid; int32_t flag = 0;
if ( (txobj= LP_gettx(symbol,expectedtxid)) != 0 )
if ( (txobj= LP_gettx(symbol,expectedtxid,0)) != 0 )
{
txid = jbits256(txobj,"txid");
if ( jobj(txobj,"error") == 0 && bits256_cmp(txid,expectedtxid) == 0 )
@ -772,7 +772,7 @@ char *basilisk_swap_bobtxspend(bits256 *signedtxidp,uint64_t txfee,char *name,ch
if ( (coin= LP_coinfind(symbol)) != 0 )
{
#ifndef BASILISK_DISABLESENDTX
if ( (txobj= LP_gettx(symbol,utxotxid)) != 0 )
if ( (txobj= LP_gettx(symbol,utxotxid,0)) != 0 )
{
if ( (vouts= jarray(&n,txobj,"vout")) != 0 && utxovout < n )
{
@ -1530,7 +1530,7 @@ int32_t LP_swap_getcoinaddr(char *symbol,char *coinaddr,bits256 txid,int32_t vou
{
cJSON *retjson;
coinaddr[0] = 0;
if ( (retjson= LP_gettx(symbol,txid)) != 0 )
if ( (retjson= LP_gettx(symbol,txid,0)) != 0 )
{
LP_txdestaddr(coinaddr,txid,vout,retjson);
free_json(retjson);
@ -1541,7 +1541,7 @@ int32_t LP_swap_getcoinaddr(char *symbol,char *coinaddr,bits256 txid,int32_t vou
int32_t basilisk_swap_getsigscript(char *symbol,uint8_t *script,int32_t maxlen,bits256 txid,int32_t vini)
{
cJSON *retjson,*vins,*item,*skey; int32_t n,scriptlen = 0; char *hexstr;
if ( (retjson= LP_gettx(symbol,txid)) != 0 )
if ( (retjson= LP_gettx(symbol,txid,0)) != 0 )
{
if ( (vins= jarray(&n,retjson,"vin")) != 0 && vini < n )
{

6
iguana/exchanges/LP_utxo.c

@ -701,7 +701,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(coin->symbol,txid)) != 0 )
if ( txobj != 0 || (txobj= LP_gettx(coin->symbol,txid,0)) != 0 )
{
if ( coin->electrum == 0 )
height = LP_txheight(coin,txid);
@ -763,7 +763,7 @@ int32_t LP_txheight(struct iguana_info *coin,bits256 txid)
return(-1);
if ( coin->electrum == 0 )
{
if ( (txobj= LP_gettx(coin->symbol,txid)) != 0 )
if ( (txobj= LP_gettx(coin->symbol,txid,0)) != 0 )
{
//*timestampp = juint(txobj,"locktime");
//*blocktimep = juint(txobj,"blocktime");
@ -803,7 +803,7 @@ int32_t LP_numconfirms(char *symbol,char *coinaddr,bits256 txid,int32_t vout,int
}
else if ( mempool != 0 && LP_mempoolscan(symbol,txid) >= 0 )
numconfirms = 0;
else if ( (txobj= LP_gettx(symbol,txid)) != 0 )
else if ( (txobj= LP_gettx(symbol,txid,0)) != 0 )
{
numconfirms = jint(txobj,"confirmations");
free_json(txobj);

2
iguana/exchanges/LP_zeroconf.c

@ -227,7 +227,7 @@ void LP_zeroconf_deposits(struct iguana_info *coin)
item = jitem(array,i);
LP_listunspent_parseitem(coin,&txid,&vout,&height,item);
} else txid = jbits256i(array,i);
if ( (txjson= LP_gettx(coin->symbol,txid)) != 0 )
if ( (txjson= LP_gettx(coin->symbol,txid,0)) != 0 )
{
// vout0 deposit, vout1 botsfee, vout2 smartaddress
if ( (vouts= jarray(&numvouts,txjson,"vout")) > 0 && numvouts >= 3 && LP_destaddr(destaddr,jitem(vouts,2)) == 0 )

Loading…
Cancel
Save