diff --git a/iguana/exchanges/LP_rpc.c b/iguana/exchanges/LP_rpc.c index 8353f2d23..31e1e0255 100644 --- a/iguana/exchanges/LP_rpc.c +++ b/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); diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index b976dbb71..5c0c05dfd 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/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; iI.signedtxid,jbits256i(array,i)) == 0 ) + { + numconfirms = 0; + printf("found tx in mempool slot.%d\n",i); + break; + } + } + free_json(array); + } #endif return(numconfirms); } diff --git a/iguana/exchanges/loop b/iguana/exchanges/loop new file mode 100644 index 000000000..8703827ba --- /dev/null +++ b/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