jl777 7 years ago
parent
commit
850a2d588b
  1. 2
      iguana/exchanges/LP_commands.c
  2. 6
      iguana/exchanges/LP_instantdex.c
  3. 4
      iguana/exchanges/LP_remember.c
  4. 10
      iguana/exchanges/LP_rpc.c
  5. 10
      iguana/exchanges/LP_transaction.c
  6. 8
      iguana/exchanges/LP_utxo.c

2
iguana/exchanges/LP_commands.c

@ -523,7 +523,7 @@ jpg(srcfile, destfile, power2=7, password, data="", required, ind=0)\n\
}
else if ( strcmp(method,"getrawtransaction") == 0 )
{
return(jprint(LP_gettx(coin,jbits256(argjson,"txid"),0),1));
return(jprint(LP_gettx("stats_JSON",coin,jbits256(argjson,"txid"),0),1));
}
else if ( strcmp(method,"withdraw") == 0 )
{

6
iguana/exchanges/LP_instantdex.c

@ -306,7 +306,7 @@ char *LP_unlockedspend(void *ctx,char *symbol,bits256 utxotxid)
retjson = cJSON_CreateObject();
utxovout = 0;
memset(&sendtxid,0,sizeof(sendtxid));
if ( (txjson= LP_gettx(coin->symbol,utxotxid,1)) != 0 )
if ( (txjson= LP_gettx("LP_unlockedspend",coin->symbol,utxotxid,1)) != 0 )
{
if ( (vouts= jarray(&numvouts,txjson,"vout")) != 0 && numvouts >= 2 )
{
@ -397,7 +397,7 @@ char *LP_timelock(char *symbol,uint32_t duration,char *destaddr,uint64_t satoshi
int32_t LP_claim_submit(void *ctx,cJSON *txids,int64_t *sump,struct iguana_info *coin,bits256 utxotxid)
{
uint8_t redeemscript[512]; bits256 claimtxid; cJSON *txjson,*vout0,*vout1,*vout2,*vouts,*item; int32_t numvouts; char str[65],vinaddr[64],destaddr[64],checkaddr[64]; int32_t j,utxovout,flagi = 0,redeemlen,weeki,iter; int64_t weeksatoshis,satoshis; uint32_t expiration,claimtime;
if ( (txjson= LP_gettx(coin->symbol,utxotxid,1)) != 0 )
if ( (txjson= LP_gettx("LP_claim_submit",coin->symbol,utxotxid,1)) != 0 )
{
if ( (vouts= jarray(&numvouts,txjson,"vout")) != 0 && numvouts >= 3 )
{
@ -515,7 +515,7 @@ int64_t LP_instantdex_credit(int32_t dispflag,char *coinaddr,int64_t satoshis,in
int64_t LP_instantdex_creditcalc(struct iguana_info *coin,int32_t dispflag,bits256 txid,char *refaddr,char *origcoinaddr)
{
cJSON *txjson,*vouts,*txobj,*item; int64_t satoshis=0,amount64; int32_t weeki,numvouts; char destaddr[64],p2shaddr[64];
if ( (txjson= LP_gettx(coin->symbol,txid,0)) != 0 )
if ( (txjson= LP_gettx("LP_instantdex_creditcalc",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 )

4
iguana/exchanges/LP_remember.c

@ -290,7 +290,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,1)) != 0 )
if ( (txobj= LP_gettx("basilisk_swap_spendupdate",symbol,txid,1)) != 0 )
{
if ( (vins= jarray(&numvins,txobj,"vin")) != 0 )
{
@ -934,7 +934,7 @@ int32_t LP_swap_load(struct LP_swap_remember *rswap,int32_t forceflag)
safecopy(rswap->alicecoin,symbol,sizeof(rswap->alicecoin));
if ( rswap->finishedflag == 0 )
{
if ( (sentobj= LP_gettx(symbol,txid,1)) == 0 )
if ( (sentobj= LP_gettx("LP_remember",symbol,txid,1)) == 0 )
{
//char str2[65]; printf("%s %s ready to broadcast %s r%u q%u\n",symbol,bits256_str(str2,txid),txnames[i],rswap->requestid,rswap->quoteid);
}

10
iguana/exchanges/LP_rpc.c

@ -179,10 +179,10 @@ cJSON *LP_paxprice(char *fiat)
return(bitcoin_json(coin,"paxprice",buf));
}
cJSON *LP_gettx(char *symbol,bits256 txid,int32_t suppress_errors)
cJSON *LP_gettx(char *debug,char *symbol,bits256 txid,int32_t suppress_errors)
{
struct iguana_info *coin; char buf[512],str[65]; int32_t height; cJSON *retjson;
printf("LP_gettx %s %s\n",symbol,bits256_str(str,txid));
printf("%s LP_gettx %s %s\n",debug,symbol,bits256_str(str,txid));
if ( symbol == 0 || symbol[0] == 0 )
return(cJSON_Parse("{\"error\":\"null symbol\"}"));
coin = LP_coinfind(symbol);
@ -209,7 +209,7 @@ cJSON *LP_gettx(char *symbol,bits256 txid,int32_t suppress_errors)
uint32_t LP_locktime(char *symbol,bits256 txid)
{
cJSON *txobj; uint32_t locktime = 0;
if ( (txobj= LP_gettx(symbol,txid,0)) != 0 )
if ( (txobj= LP_gettx("LP_locktime",symbol,txid,0)) != 0 )
{
locktime = juint(txobj,"locktime");
free_json(txobj);
@ -1055,7 +1055,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(coin->symbol,txid,0)) != 0 )
if ( (txobj= LP_gettx("LP_txhasnotarization",coin->symbol,txid,0)) != 0 )
{
if ( (vins= jarray(&numvins,txobj,"vin")) != 0 )
{
@ -1067,7 +1067,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(coin->symbol,spenttxid,0)) != 0 )
if ( (spentobj= LP_gettx("LP_txhasnotarization",coin->symbol,spenttxid,0)) != 0 )
{
if ( (vouts= jarray(&numvouts,spentobj,"vout")) != 0 )
{

10
iguana/exchanges/LP_transaction.c

@ -65,7 +65,7 @@ int32_t LP_gettx_presence(int32_t *numconfirmsp,char *symbol,bits256 expectedtxi
cJSON *txobj,*retjson; bits256 txid; struct iguana_info *coin; int32_t flag = 0;
if ( numconfirmsp != 0 )
*numconfirmsp = -1;
if ( (txobj= LP_gettx(symbol,expectedtxid,0)) != 0 )
if ( (txobj= LP_gettx("LP_gettx_presence",symbol,expectedtxid,0)) != 0 )
{
txid = jbits256(txobj,"txid");
if ( jobj(txobj,"error") == 0 && bits256_cmp(txid,expectedtxid) == 0 )
@ -775,7 +775,7 @@ char *basilisk_swap_bobtxspend(bits256 *signedtxidp,uint64_t txfee,char *name,ch
if ( txfee > 0 && txfee < coin->txfee )
txfee = coin->txfee;
#ifndef BASILISK_DISABLESENDTX
if ( (txobj= LP_gettx(symbol,utxotxid,0)) != 0 )
if ( (txobj= LP_gettx("basilisk_swap_bobtxspend",symbol,utxotxid,0)) != 0 )
{
if ( (vouts= jarray(&n,txobj,"vout")) != 0 && utxovout < n )
{
@ -1626,7 +1626,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)) != 0 )
if ( (retjson= LP_gettx("LP_swap_getcoinaddr",symbol,txid,0)) != 0 )
{
LP_txdestaddr(coinaddr,txid,vout,retjson);
free_json(retjson);
@ -1638,7 +1638,7 @@ int32_t basilisk_swap_getsigscript(char *symbol,uint8_t *script,int32_t maxlen,b
{
cJSON *retjson,*vins,*item,*skey; int32_t n,scriptlen = 0; char *hexstr;
//char str[65]; printf("getsigscript %s %s/v%d\n",symbol,bits256_str(str,txid),vini);
if ( bits256_nonz(txid) != 0 && (retjson= LP_gettx(symbol,txid,0)) != 0 )
if ( bits256_nonz(txid) != 0 && (retjson= LP_gettx("basilisk_swap_getsigscript",symbol,txid,0)) != 0 )
{
//printf("gettx.(%s)\n",jprint(retjson,0));
if ( (vins= jarray(&n,retjson,"vin")) != 0 && vini < n )
@ -1731,7 +1731,7 @@ bits256 LP_swap_spendtxid(char *symbol,char *destaddr,bits256 utxotxid,int32_t u
for (i=0; i<n; i++)
{
txid = jbits256i(array,i);
if ( (txobj= LP_gettx(symbol,txid,1)) != 0 )
if ( (txobj= LP_gettx("LP_swap_spendtxid",symbol,txid,1)) != 0 )
{
if ( (vins= jarray(&m,txobj,"vin")) != 0 )
{

8
iguana/exchanges/LP_utxo.c

@ -811,7 +811,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)) != 0 )
if ( txobj != 0 || (txobj= LP_gettx("LP_transactioninit",coin->symbol,txid,0)) != 0 )
{
if ( coin->electrum == 0 )
height = LP_txheight(coin,txid);
@ -873,7 +873,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)) != 0 )
if ( (txobj= LP_gettx("LP_txheight",coin->symbol,txid,0)) != 0 )
{
//*timestampp = juint(txobj,"locktime");
//*blocktimep = juint(txobj,"blocktime");
@ -923,7 +923,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,1)) != 0 )
else if ( (txobj= LP_gettx("LP_numconfirms",symbol,txid,1)) != 0 )
{
numconfirms = jint(txobj,"confirmations");
free_json(txobj);
@ -1052,7 +1052,7 @@ int64_t LP_outpoint_amount(char *symbol,bits256 txid,int32_t vout)
return(amount);
else
{
if ( (txjson= LP_gettx(symbol,txid,1)) != 0 )
if ( (txjson= LP_gettx("LP_outpoint_amount",symbol,txid,1)) != 0 )
{
if ( (vouts= jarray(&numvouts,txjson,"vout")) != 0 && vout < numvouts )
amount = LP_value_extract(jitem(vouts,vout),0);

Loading…
Cancel
Save