Browse Source

Test

etomic
jl777 8 years ago
parent
commit
9aca9cedc4
  1. 6
      iguana/exchanges/LP_rpc.c
  2. 17
      iguana/exchanges/LP_transaction.c
  3. 7
      iguana/exchanges/loop

6
iguana/exchanges/LP_rpc.c

@ -88,6 +88,12 @@ cJSON *LP_getinfo(char *symbol)
return(bitcoin_json(coin,"getinfo","[]"));
}
cJSON *LP_getmempool(char *symbol)
{
struct iguana_info *coin = LP_coinfind(symbol);
return(bitcoin_json(coin,"getrawmempool","[]"));
}
cJSON *LP_gettxout(char *symbol,bits256 txid,int32_t vout)
{
char buf[128],str[65]; struct iguana_info *coin = LP_coinfind(symbol);

17
iguana/exchanges/LP_transaction.c

@ -193,12 +193,27 @@ int32_t LP_numconfirms(struct basilisk_swap *swap,struct basilisk_rawtx *rawtx)
{
int32_t numconfirms = 100;
#ifndef BASILISK_DISABLEWAITTX
cJSON *txobj;
cJSON *txobj,*array; int32_t i,n;
numconfirms = -1;
if ( (txobj= LP_gettx(rawtx->coin->symbol,rawtx->I.signedtxid)) != 0 )
{
numconfirms = jint(txobj,"confirmations");
free_json(txobj);
}
else if ( (array= LP_getmempool(rawtx->coin->symbol)) != 0 )
{
if ( is_cJSON_Array(array) != 0 && (n= cJSON_GetArraySize(array)) > 0 )
{
for (i=0; i<n; i++)
if ( bits256_cmp(rawtx->I.signedtxid,jbits256i(array,i)) == 0 )
{
numconfirms = 0;
printf("found tx in mempool slot.%d\n",i);
break;
}
}
free_json(array);
}
#endif
return(numconfirms);
}

7
iguana/exchanges/loop

@ -0,0 +1,7 @@
while true
do
source userpass
#curl --url "http://127.0.0.1:7779" --data "{\"userpass\":\"$userpass\",\"method\":\"setprice\",\"base\":\"REVS\",\"rel\":\"KMD\",\"price\":1.234}"
./s
sleep 3600
done
Loading…
Cancel
Save