From 0d1ed642640ba2a04b47a960f68d8e2a4c5b65f8 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 25 Oct 2017 12:49:38 +0300 Subject: [PATCH] Test --- iguana/exchanges/LP_nativeDEX.c | 18 +++++++++++++++++- iguana/exchanges/mm.c | 2 +- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index cf4f2e78e..d69c6ec47 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -713,6 +713,7 @@ void LP_pubkeysloop(void *ctx) sleep(10); while ( 1 ) { + printf("LP_pubkeysloop\n"); LP_notify_pubkeys(ctx,LP_mypubsock); sleep(60); } @@ -723,6 +724,7 @@ void LP_privkeysloop(void *ctx) sleep(20); while ( 1 ) { + printf("LP_privkeysloop\n"); LP_privkey_updates(ctx,LP_mypubsock,0); sleep(60); } @@ -734,6 +736,7 @@ void LP_swapsloop(void *ignore) sleep(50); while ( 1 ) { + printf("LP_swapsloop\n"); if ( (retstr= basilisk_swapentry(0,0)) != 0 ) free(retstr); sleep(600); @@ -1010,14 +1013,27 @@ void LPinit(uint16_t myport,uint16_t mypullport,uint16_t mypubport,uint16_t mybu #ifdef FROM_JS uint32_t LP_counter; + void LP_fromjs_iter() { - printf("LP_fromjs_iter got called LP_counter.%d\n",LP_counter); + static void *ctx; + if ( G.initializing != 0 ) + { + printf("LP_fromjs_iter during G.initializing, skip\n"); + return; + } + if ( ctx == 0 ) + ctx = bitcoin_ctx(); + printf("LP_fromjs_iter got called LP_counter.%d userpass.(%s) ctx.%p\n",LP_counter,G.USERPASS,ctx); + LP_mainloop_iter(ctx,LP_myipaddr,0,LP_mypubsock,LP_publicaddr,LP_RPCPORT); LP_counter++; } char *bitcoind_RPC(char **retstrp,char *debugstr,char *url,char *userpass,char *command,char *params,int32_t timeout) { + char fullurl[512]; + sprintf(fullurl,"%s@%s",userpass,url); + printf("bitcoind_RPC(%s)\n",fullurl); return(clonestr("{\"error\":\"curl is disabled\"}")); } diff --git a/iguana/exchanges/mm.c b/iguana/exchanges/mm.c index a84c15c5d..2a7415d2c 100644 --- a/iguana/exchanges/mm.c +++ b/iguana/exchanges/mm.c @@ -883,7 +883,7 @@ int main(int argc, const char * argv[]) retjson = cJSON_Parse("{\"client\":1,\"passphrase\":\"test\"}"); printf("calling LP_main(%s)\n",jprint(retjson,0)); LP_main(retjson); - emscripten_set_main_loop(LP_fromjs_iter,5,0); + emscripten_set_main_loop(LP_fromjs_iter,1,0); #else if ( argc > 1 && (retjson= cJSON_Parse(argv[1])) != 0 ) {