jl777 7 years ago
parent
commit
9ee6baf20b
  1. 14
      iguana/exchanges/LP_nativeDEX.c
  2. 2
      iguana/exchanges/install
  3. 3
      iguana/exchanges/m_js
  4. 8
      iguana/exchanges/mm.c

14
iguana/exchanges/LP_nativeDEX.c

@ -789,6 +789,11 @@ int32_t LP_reserved_msg(char *base,char *rel,bits256 pubkey,char *msg)
return(n);
}
void LP_fromjs_iter(void *arg)
{
printf("LP_fromjs_iter got arg.%p\n",arg);
}
void LPinit(uint16_t myport,uint16_t mypullport,uint16_t mypubport,uint16_t mybusport,char *passphrase,int32_t amclient,char *userhome,cJSON *argjson)
{
char *myipaddr=0; long filesize,n; int32_t timeout,pubsock=-1; struct LP_peerinfo *mypeer=0; char pushaddr[128],subaddr[128],bindaddr[128],*coins_str=0; cJSON *coinsjson=0; void *ctx = bitcoin_ctx();
@ -851,7 +856,9 @@ void LPinit(uint16_t myport,uint16_t mypullport,uint16_t mypubport,uint16_t mybu
portable_mutex_init(&LP_butxomutex);
portable_mutex_init(&LP_reservedmutex);
portable_mutex_init(&LP_nanorecvsmutex);
myipaddr = clonestr("127.0.0.1");
#ifndef _WIN32
#ifndef FROM_JS
if ( system("curl -s4 checkip.amazonaws.com > myipaddr") == 0 )
{
char ipfname[64];
@ -865,7 +872,8 @@ void LPinit(uint16_t myport,uint16_t mypullport,uint16_t mypubport,uint16_t mybu
} else printf("error getting myipaddr\n");
} else printf("error issuing curl\n");
#else
myipaddr = clonestr("127.0.0.1");
IAMLP = 0;
#endif
#endif
if ( IAMLP != 0 )
{
@ -982,8 +990,7 @@ void LPinit(uint16_t myport,uint16_t mypullport,uint16_t mypubport,uint16_t mybu
printf("error launching LP_swapsloop for port.%u\n",myport);
exit(-1);
}
//if ( (retstr= basilisk_swapentry(0,0)) != 0 )
// free(retstr);
#ifndef FROM_JS
int32_t nonz;
printf("start mainloop\n");
while ( 1 )
@ -1002,6 +1009,7 @@ void LPinit(uint16_t myport,uint16_t mypullport,uint16_t mypubport,uint16_t mybu
else if ( IAMLP == 0 )
usleep(1000);
}
#endif
}

2
iguana/exchanges/install

@ -1,5 +1,5 @@
#!/bin/bash
cp trust trusted setconfirms balance listunspent electrum snapshot_balance snapshot_loop secretaddresses dividends snapshot goals goal portfolio autoprice deletemessages getmessages debug buy sell bestfit orderbook client run_osx client_osx run coins disable enable myprice myprices getcoins getpeers getpeersIP getprices help inv setprice status ../dexscripts
cp notarizations getrawtransaction parselog statsdisp m_js trust trusted setconfirms balance listunspent electrum snapshot_balance snapshot_loop secretaddresses dividends snapshot goals goal portfolio autoprice deletemessages getmessages debug buy sell bestfit orderbook client run_osx client_osx run coins disable enable myprice myprices getcoins getpeers getpeersIP getprices help inv setprice status ../dexscripts
cp coins.json ..
cd ../dexscripts
#cp ../exchanges/passphrase ../exchanges/userpass .

3
iguana/exchanges/m_js

@ -1 +1,2 @@
emcc -DFROM_JS -O2 -I../../includes -I../../crypto777 -s ALLOW_MEMORY_GROWTH=1 -s PTHREAD_POOL_SIZE=40 -s USE_PTHREADS=2 -o /var/www/html/bartderDEX.html mm.c ../../crypto777/*.c ../../crypto777/jpeg/*.c ../../crypto777/jpeg/unix/*.c ../mini-gmp.c ../secp256k1/src/secp256k1.c -lm -lcurl.js
~/emsdk/emscripten/1.37.21/emcc -DFROM_JS -O2 -I../../includes -I../../crypto777 -s ALLOW_MEMORY_GROWTH=1 -s PTHREAD_POOL_SIZE=40 -s USE_PTHREADS=2 -o /var/www/html/index.html mm.c ../../crypto777/*.c ../../crypto777/jpeg/*.c ../../crypto777/jpeg/unix/*.c ../mini-gmp.c ../secp256k1/src/secp256k1.c -lm libnanomsg.so

8
iguana/exchanges/mm.c

@ -878,6 +878,13 @@ int main(int argc, const char * argv[])
sprintf(dirname,"%s",GLOBAL_DBDIR), OS_ensure_directory(dirname);
sprintf(dirname,"%s/SWAPS",GLOBAL_DBDIR), OS_ensure_directory(dirname);
sprintf(dirname,"%s/PRICES",GLOBAL_DBDIR), OS_ensure_directory(dirname);
#ifdef FROM_JS
argc = 2;
retjson = cJSON_Parse("{\"client\":1,\"passphrase\":\"test\"}");
printf("calling LP_main(%s)\n",jprint(retjson,0));
LP_main(retjson);
emscripten_set_main_loop(LP_mainiter,0,0);
#else
if ( argc > 1 && (retjson= cJSON_Parse(argv[1])) != 0 )
{
if ( (passphrase= jstr(retjson,"passphrase")) == 0 )
@ -949,5 +956,6 @@ int main(int argc, const char * argv[])
}
free_json(retjson);
}
#endif
return 0;
}

Loading…
Cancel
Save