Browse Source

Test

etomic
jl777 8 years ago
parent
commit
51e4c17acd
  1. 2
      iguana/exchanges/LP_include.h
  2. 4
      iguana/exchanges/LP_nativeDEX.c
  3. 2
      iguana/exchanges/LP_rpc.c
  4. 4
      iguana/exchanges/LP_transaction.c

2
iguana/exchanges/LP_include.h

@ -176,7 +176,7 @@ struct basilisk_swapinfo
struct iguana_info struct iguana_info
{ {
uint64_t txfee,estimatedrate; uint64_t txfee; double estimatedrate;
int32_t longestchain; int32_t longestchain;
uint8_t pubtype,p2shtype,isPoS,wiftype; uint8_t pubtype,p2shtype,isPoS,wiftype;
char symbol[16],changeaddr[64],userpass[1024],serverport[128]; char symbol[16],changeaddr[64],userpass[1024],serverport[128];

4
iguana/exchanges/LP_nativeDEX.c

@ -131,8 +131,8 @@ struct LP_cacheinfo *LP_cacheadd(char *base,char *rel,bits256 txid,int32_t vout,
portable_mutex_unlock(&LP_cachemutex); portable_mutex_unlock(&LP_cachemutex);
} else printf("LP_cacheadd keysize mismatch?\n"); } else printf("LP_cacheadd keysize mismatch?\n");
} //else printf("CACHE hit!\n"); } //else printf("CACHE hit!\n");
char str[65]; if ( price != ptr->price ) //char str[65]; if ( price != ptr->price )
printf("updated %s/v%d %s/%s %llu price %.8f\n",bits256_str(str,txid),vout,base,rel,(long long)satoshis,price); // printf("updated %s/v%d %s/%s %llu price %.8f\n",bits256_str(str,txid),vout,base,rel,(long long)satoshis,price);
ptr->price = price; ptr->price = price;
ptr->satoshis = satoshis; ptr->satoshis = satoshis;
ptr->destsatoshis = satoshis * price; ptr->destsatoshis = satoshis * price;

2
iguana/exchanges/LP_rpc.c

@ -154,7 +154,7 @@ uint64_t LP_getestimatedrate(char *symbol)
{ {
if ( retstr[0] != '-' ) if ( retstr[0] != '-' )
{ {
rate = SATOSHIDEN * atof(retstr); rate = atof(retstr) / 1024.;
printf("estimated rate %s -> %llu\n",retstr,(long long)rate); printf("estimated rate %s -> %llu\n",retstr,(long long)rate);
} }
free(retstr); free(retstr);

4
iguana/exchanges/LP_transaction.c

@ -877,7 +877,7 @@ int32_t basilisk_rawtx_gen(void *ctx,char *str,uint32_t swapstarted,uint8_t *pub
if ( strcmp(coin->symbol,"BTC") != 0 ) if ( strcmp(coin->symbol,"BTC") != 0 )
return(retval); return(retval);
len = rawtx->I.datalen; len = rawtx->I.datalen;
if ( coin->estimatedrate == 0 ) if ( coin->estimatedrate == 0. )
coin->estimatedrate = LP_getestimatedrate(coin->symbol); coin->estimatedrate = LP_getestimatedrate(coin->symbol);
newtxfee = coin->estimatedrate * len; newtxfee = coin->estimatedrate * len;
printf("txfee %.8f -> newtxfee %.8f\n",dstr(txfee),dstr(newtxfee)); printf("txfee %.8f -> newtxfee %.8f\n",dstr(txfee),dstr(newtxfee));
@ -888,7 +888,7 @@ int32_t basilisk_rawtx_gen(void *ctx,char *str,uint32_t swapstarted,uint8_t *pub
int32_t basilisk_rawtx_sign(char *symbol,uint8_t pubtype,uint8_t p2shtype,uint8_t isPoS,uint8_t wiftype,struct basilisk_swap *swap,struct basilisk_rawtx *dest,struct basilisk_rawtx *rawtx,bits256 privkey,bits256 *privkey2,uint8_t *userdata,int32_t userdatalen,int32_t ignore_cltverr) int32_t basilisk_rawtx_sign(char *symbol,uint8_t pubtype,uint8_t p2shtype,uint8_t isPoS,uint8_t wiftype,struct basilisk_swap *swap,struct basilisk_rawtx *dest,struct basilisk_rawtx *rawtx,bits256 privkey,bits256 *privkey2,uint8_t *userdata,int32_t userdatalen,int32_t ignore_cltverr)
{ {
char *signedtx; int64_t txfee,newtxfee=0,estimatedrate,destamount; uint32_t timestamp,locktime=0,sequenceid = 0xffffffff; int32_t iter,len,retval = -1; char *signedtx; int64_t txfee,newtxfee=0,destamount; uint32_t timestamp,locktime=0,sequenceid = 0xffffffff; int32_t iter,len,retval = -1; double estimatedrate;
timestamp = swap->I.started; timestamp = swap->I.started;
if ( dest == &swap->aliceclaim ) if ( dest == &swap->aliceclaim )
locktime = swap->bobdeposit.I.locktime + 1, sequenceid = 0; locktime = swap->bobdeposit.I.locktime + 1, sequenceid = 0;

Loading…
Cancel
Save