From 8b6574434986e16fe4cdb42c5e0bf17884987f10 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 26 Sep 2017 19:58:59 +0200 Subject: [PATCH] Test --- iguana/exchanges/LP_rpc.c | 2 +- iguana/exchanges/LP_transaction.c | 30 +++++++++++++++--------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/iguana/exchanges/LP_rpc.c b/iguana/exchanges/LP_rpc.c index 9fded7317..a1f10e9d7 100644 --- a/iguana/exchanges/LP_rpc.c +++ b/iguana/exchanges/LP_rpc.c @@ -602,7 +602,7 @@ double LP_getestimatedrate(struct iguana_info *coin) return(0.0001); if ( strcmp(coin->symbol,"BTC") == 0 || coin->txfee == 0 || coin->rate == 0. ) { - if ( strcmp(coin->symbol,"BTC") == 0 || coin->rate == 0. || time(NULL) > coin->ratetime ) + if ( coin->rate == 0. || time(NULL) > coin->ratetime+60 ) { sprintf(buf,"[%d]",strcmp(coin->symbol,"BTC") == 0 ? 6 : 2); if ( (retstr= LP_apicall(coin,coin->electrum==0?"estimatefee" : "blockchain.estimatefee",buf)) != 0 ) diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index 3d4e00068..1f2deff8a 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -545,7 +545,7 @@ int32_t iguana_signrawtransaction(void *ctx,char *symbol,uint8_t wiftaddr,uint8_ char *basilisk_swap_bobtxspend(bits256 *signedtxidp,uint64_t txfee,char *name,char *symbol,uint8_t wiftaddr,uint8_t taddr,uint8_t pubtype,uint8_t p2shtype,uint8_t isPoS,uint8_t wiftype,void *ctx,bits256 privkey,bits256 *privkey2p,uint8_t *redeemscript,int32_t redeemlen,uint8_t *userdata,int32_t userdatalen,bits256 utxotxid,int32_t vout,char *destaddr,uint8_t *pubkey33,int32_t finalseqid,uint32_t expiration,int64_t *destamountp,uint64_t satoshis,char *changeaddr,char *vinaddr,int32_t suppress_pubkeys) { - char *rawtxbytes=0,*signedtx=0,tmpaddr[64],hexstr[999],wifstr[128],_destaddr[64]; uint8_t spendscript[512],addrtype,rmd160[20]; cJSON *txobj,*vins,*vin,*item,*privkeys; int32_t completed,spendlen,n,ignore_cltverr=1; struct vin_info V[2]; uint32_t timestamp,locktime = 0,sequenceid = 0xffffffff * finalseqid; bits256 txid; uint64_t value=0,change = 0; struct iguana_msgtx msgtx; + char *rawtxbytes=0,*signedtx=0,tmpaddr[64],txdestaddr[64],hexstr[999],wifstr[128],_destaddr[64]; uint8_t spendscript[512],addrtype,rmd160[20]; cJSON *txobj,*vins,*item,*privkeys; int32_t completed,spendlen,ignore_cltverr=1; struct vin_info V[2]; uint32_t timestamp,locktime = 0,sequenceid = 0xffffffff * finalseqid; bits256 txid; uint64_t value=0,change = 0; struct iguana_msgtx msgtx; struct iguana_info *coin; *destamountp = 0; memset(signedtxidp,0,sizeof(*signedtxidp)); if ( finalseqid == 0 ) @@ -554,24 +554,24 @@ char *basilisk_swap_bobtxspend(bits256 *signedtxidp,uint64_t txfee,char *name,ch if ( redeemlen < 0 ) return(0); #ifndef BASILISK_DISABLESENDTX - if ( (txobj= LP_gettx(symbol,utxotxid)) != 0 ) + if ( (coin= LP_coinfind(symbol)) != 0 && coin->electrum == 0 ) { - if ( (vins= jarray(&n,txobj,"vin")) != 0 && vout < n ) + if ( (value= LP_txvalue(txdestaddr,symbol,utxotxid,vout)) == 0 ) { - vin = jitem(vins,vout); - value = LP_value_extract(vin,1); + char str[65]; + printf("basilisk_swap_bobtxspend.%s %s utxo.(%s) already spent or doesnt exist\n",name,symbol,bits256_str(str,utxotxid)); + return(0); } - free_json(txobj); - } - /*if ( coin->electrum == 0 ) - { - if ( (value= LP_txvalue(txdestaddr,symbol,utxotxid,vout)) == 0 ) - { - char str[65]; - printf("basilisk_swap_bobtxspend.%s %s utxo.(%s) already spent or doesnt exist\n",name,symbol,bits256_str(str,utxotxid)); - return(0); + /*if ( (txobj= LP_gettx(symbol,utxotxid)) != 0 ) + { + if ( (vins= jarray(&n,txobj,"vin")) != 0 && vout < n ) + { + vin = jitem(vins,vout); + value = LP_value_extract(vin,1); + } + free_json(txobj); + }*/ } - }*/ #else value = satoshis; #endif