diff --git a/crypto777/m_js b/crypto777/m_js index e0aa6c132..cecc5070f 100755 --- a/crypto777/m_js +++ b/crypto777/m_js @@ -1,4 +1,4 @@ git pull rm *.o -emcc -c -s USE_PTHREADS=1 -s ALLOW_MEMORY_GROWTH=1 -O2 *.c jpeg/*.c jpeg/unix/*.c +emcc -c -s USE_PTHREADS=1 *.c jpeg/*.c jpeg/unix/*.c rm -f ../agents/libcrypto777.a; emar rcu ../agents/libcrypto777.a *.o diff --git a/iguana/iguana_instantdex.c b/iguana/iguana_instantdex.c index c3617e1d0..3d1dca335 100755 --- a/iguana/iguana_instantdex.c +++ b/iguana/iguana_instantdex.c @@ -279,9 +279,9 @@ bits256 instantdex_rwoffer(int32_t rwflag,int32_t *lenp,uint8_t *serialized,stru { vcalc_sha256(0,orderhash.bytes,(void *)offer,sizeof(*offer)); /*int32_t i; - for (i=0; isig.allocsize,0,0); /*r = (rand() % max); - for (i=0; ipeers.ranked[j]) != 0 && addr->supernet != 0 && addr->usock >= 0 ) - { - printf("send.%d to (%s)\n",(int32_t)msg->sig.allocsize,addr->ipaddr); - iguana_queue_send(coin,addr,0,serialized,"InstantDEX",msg->sig.allocsize,0,0); - if ( --hops <= 0 ) - break; - } //else printf("skip.%d addr.%p (%s) max.%d hops.%d\n",j,addr,addr!=0?addr->ipaddr:"",max,hops); - }*/ + for (i=0; ipeers.ranked[j]) != 0 && addr->supernet != 0 && addr->usock >= 0 ) + { + printf("send.%d to (%s)\n",(int32_t)msg->sig.allocsize,addr->ipaddr); + iguana_queue_send(coin,addr,0,serialized,"InstantDEX",msg->sig.allocsize,0,0); + if ( --hops <= 0 ) + break; + } //else printf("skip.%d addr.%p (%s) max.%d hops.%d\n",j,addr,addr!=0?addr->ipaddr:"",max,hops); + }*/ } else printf("cant find coin.%p or no ranked.%d\n",coin,max); } else @@ -584,7 +584,7 @@ cJSON *instantdex_statemachinejson(struct bitcoin_swapinfo *swap) jaddbits256(retjson,"pubAm",swap->pubAm); jaddbits256(retjson,"privBn",swap->privBn); jaddbits256(retjson,"pubBn",swap->pubBn); - + jaddbits256(retjson,"myorderhash",swap->myorderhash); jaddnum(retjson,"choosei",swap->choosei); jaddnum(retjson,"cutverified",swap->cutverified); @@ -1296,7 +1296,7 @@ char *InstantDEX_hexmsg(struct supernet_info *myinfo,struct category_info *cat,v //printf("a signed datalen.%d allocsize.%d crc.%x\n",datalen,msg->sig.allocsize,calc_crc32(0,serdata,datalen)); acct777_rwsig(0,(void *)&msg->sig,(void *)tmp); memcpy(&msg->sig,tmp,sizeof(msg->sig)); - // printf("b signed datalen.%d allocsize.%d crc.%x\n",datalen,msg->sig.allocsize,calc_crc32(0,serdata,datalen)); + // printf("b signed datalen.%d allocsize.%d crc.%x\n",datalen,msg->sig.allocsize,calc_crc32(0,serdata,datalen)); if ( (remoteaddr == 0 || remoteaddr[0] == 0 || strcmp("127.0.0.1",remoteaddr) == 0) && ((uint8_t *)msg)[len-1] == 0 && (argjson= cJSON_Parse((char *)msg)) != 0 ) { printf("string instantdex_hexmsg RESULT.(%s)\n",jprint(argjson,0)); @@ -1421,7 +1421,7 @@ TWO_STRINGS_AND_TWO_DOUBLES(InstantDEX,maxaccept,base,rel,maxprice,basevolume) { retstr = instantdex_createaccept(myinfo,&ap,exchange,base,rel,maxprice,basevolume,-1,rel,INSTANTDEX_OFFERDURATION,myinfo->myaddr.nxt64bits,1,juint(json,"minperc")); return(instantdex_checkoffer(myinfo,&txid,exchange,ap,json)); - + } else return(clonestr("{\"error\":\"InstantDEX API request only local usage!\"}")); } @@ -1546,7 +1546,7 @@ TWO_STRINGS(InstantDEX,events,base,rel) free_json(asks); } return(jprint(array,1)); - + //return(clonestr("[{\"h\":14,\"m\":44,\"s\":32,\"date\":1407877200000,\"bid\":30,\"ask\":35},{\"date\":1407877200000,\"bid\":40,\"ask\":44},{\"date\":1407877200000,\"bid\":49,\"ask\":45},{\"date\":1407877200000,\"ask\":28},{\"date\":1407877200000,\"ask\":52}]")); } diff --git a/iguana/m_js b/iguana/m_js index ae454e2c1..2b955f5b1 100755 --- a/iguana/m_js +++ b/iguana/m_js @@ -1,7 +1,5 @@ rm ../agents/iguana *.o git pull cd secp256k1; ./m_js; cd .. -emcc -s USE_PTHREADS=1 -s ALLOW_MEMORY_GROWTH=1 -Wno-deprecated -c -O2 *.c databases/iguana_DB.c -#emcc -s USE_PTHREADS=1 -Wno-deprecated -c main.c iguana777.c iguana_bundles.c -emcc -s USE_PTHREADS=1 -s ALLOW_MEMORY_GROWTH=1 -o iguana.html -O2 *.o ../agents/libcrypto777.a -lm +emcc -s USE_PTHREADS=1 -o iguana.html *.c databases/iguana_DB.c ../agents/libcrypto777.a -lm cp iguana.html iguana.js pthread-main.js iguana.html.mem /var/www/html diff --git a/iguana/secp256k1/m_js b/iguana/secp256k1/m_js index ccf5301bc..7bcc75da8 100755 --- a/iguana/secp256k1/m_js +++ b/iguana/secp256k1/m_js @@ -1 +1 @@ -emcc -c -o ../secp256k1.o -s USE_PTHREADS=1 -s ALLOW_MEMORY_GROWTH=1 -I. -I./src -I./include -I./src -O3 -W -std=c89 -pedantic -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes -Wno-unused-function -Wno-long-long -Wno-overlength-strings -fvisibility=hidden -DHAVE_CONFIG_H src/secp256k1.c +emcc -c -o ../secp256k1.o -s USE_PTHREADS=1 -I. -I./src -I./include -I./src -W -std=c89 -pedantic -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes -Wno-unused-function -Wno-long-long -Wno-overlength-strings -fvisibility=hidden -DHAVE_CONFIG_H src/secp256k1.c diff --git a/iguana/swaps/iguana_BTCswap.c b/iguana/swaps/iguana_BTCswap.c index 4940cf825..2bc2e9702 100755 --- a/iguana/swaps/iguana_BTCswap.c +++ b/iguana/swaps/iguana_BTCswap.c @@ -393,7 +393,7 @@ int32_t instantdex_pubkeyargs(struct supernet_info *myinfo,struct bitcoin_swapin { pubi = instantdex_derivekeypair(myinfo,&swap->privkeys[n],pubkey,privkey,hash); privkey = swap->privkeys[n]; - //printf("i.%d n.%d numpubs.%d %02x vs %02x\n",i,n,numpubs,pubkey[0],firstbyte); + printf("i.%d n.%d numpubs.%d %02x vs %02x\n",i,n,numpubs,pubkey[0],firstbyte); if ( pubkey[0] != firstbyte ) continue; if ( n < 2 && numpubs > 2 ) @@ -406,12 +406,6 @@ int32_t instantdex_pubkeyargs(struct supernet_info *myinfo,struct bitcoin_swapin { calc_rmd160_sha256(secret160,swap->privkeys[n].bytes,sizeof(swap->privkeys[n])); memcpy(&txid,secret160,sizeof(txid)); - /*txid = (m+1) | ((m+1)<<16); - txid <<= 32; - txid = (m+1) | ((m+1)<<16); - pubi.txid = (m+1) | ((m+1)<<16); - pubi.txid <<= 32; - pubi.txid = (m+1) | ((m+1)<<16);*/ len += iguana_rwnum(1,(uint8_t *)&swap->deck[m][0],sizeof(txid),&txid); len += iguana_rwnum(1,(uint8_t *)&swap->deck[m][1],sizeof(pubi.txid),&pubi.txid); m++; diff --git a/iguana/tests/buy b/iguana/tests/buy index 252ab3c60..62fc67130 100755 --- a/iguana/tests/buy +++ b/iguana/tests/buy @@ -1 +1 @@ -curl --url "http://127.0.0.1:7778" --data "{\"dotrade\":1,\"agent\":\"InstantDEX\",\"exchange\":\"bitcoin\",\"method\":\"buy\",\"base\":\"BTCD\",\"rel\":\"BTC\",\"price\":0.0027,\"volume\":1.0}" +curl --url "http://127.0.0.1:7778" --data "{\"password\":\"test\",\"dotrade\":1,\"agent\":\"InstantDEX\",\"exchange\":\"bitcoin\",\"method\":\"buy\",\"base\":\"BTCD\",\"rel\":\"BTC\",\"price\":0.0029,\"volume\":1.0}" diff --git a/iguana/tests/buy2 b/iguana/tests/buy2 new file mode 100755 index 000000000..3f6086487 --- /dev/null +++ b/iguana/tests/buy2 @@ -0,0 +1 @@ +curl --url "http://127.0.0.1:7778" --data "{\"password\":\"test2\",\"dotrade\":1,\"agent\":\"InstantDEX\",\"exchange\":\"bitcoin\",\"method\":\"buy\",\"base\":\"BTCD\",\"rel\":\"BTC\",\"price\":0.0027,\"volume\":1.0}" diff --git a/iguana/tests/encryptwallet2 b/iguana/tests/encryptwallet2 new file mode 100755 index 000000000..36fd9d69e --- /dev/null +++ b/iguana/tests/encryptwallet2 @@ -0,0 +1 @@ +curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"encryptwallet\",\"passphrase\":\"test2\"}" diff --git a/iguana/tests/sell b/iguana/tests/sell index c0eb0ae05..4db541c05 100755 --- a/iguana/tests/sell +++ b/iguana/tests/sell @@ -1 +1 @@ -curl --url "http://127.0.0.1:7778" --data "{\"dotrade\":1,\"agent\":\"InstantDEX\",\"exchange\":\"bitcoin\",\"method\":\"sell\",\"base\":\"BTCD\",\"rel\":\"BTC\",\"price\":0.0029,\"volume\":1.0}" +curl --url "http://127.0.0.1:7778" --data "{\"password\":\"test\",\"dotrade\":1,\"agent\":\"InstantDEX\",\"exchange\":\"bitcoin\",\"method\":\"sell\",\"base\":\"BTCD\",\"rel\":\"BTC\",\"price\":0.0029,\"volume\":1.0}" diff --git a/iguana/tests/sell2 b/iguana/tests/sell2 new file mode 100755 index 000000000..53207b8c9 --- /dev/null +++ b/iguana/tests/sell2 @@ -0,0 +1 @@ +curl --url "http://127.0.0.1:7778" --data "{\"password\":\"test2\",\"password\":\"test\",\"dotrade\":1,\"agent\":\"InstantDEX\",\"exchange\":\"bitcoin\",\"method\":\"sell\",\"base\":\"BTCD\",\"rel\":\"BTC\",\"price\":0.0029,\"volume\":1.0}"