Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
cd665a586c
  1. 2
      crypto777/m_js
  2. 60
      iguana/iguana_instantdex.c
  3. 4
      iguana/m_js
  4. 2
      iguana/secp256k1/m_js
  5. 8
      iguana/swaps/iguana_BTCswap.c
  6. 2
      iguana/tests/buy
  7. 1
      iguana/tests/buy2
  8. 1
      iguana/tests/encryptwallet2
  9. 2
      iguana/tests/sell
  10. 1
      iguana/tests/sell2

2
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

60
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; i<sizeof(*offer); i++)
printf("%02x ",((uint8_t *)offer)[i]);
printf("rwoffer offer\n");*/
for (i=0; i<sizeof(*offer); i++)
printf("%02x ",((uint8_t *)offer)[i]);
printf("rwoffer offer\n");*/
}
else
{
@ -300,20 +300,20 @@ 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; i<len; i++)
printf("%02x ",serialized[i]);
printf("read rwoffer serialized\n");
for (i=0; i<sizeof(*offer); i++)
printf("%02x ",((uint8_t *)offer)[i]);
printf("rwoffer offer\n");*/
for (i=0; i<len; i++)
printf("%02x ",serialized[i]);
printf("read rwoffer serialized\n");
for (i=0; i<sizeof(*offer); i++)
printf("%02x ",((uint8_t *)offer)[i]);
printf("rwoffer offer\n");*/
}
/*else
{
int32_t i;
for (i=0; i<len; i++)
printf("%02x ",serialized[i]);
printf("wrote rwoffer serialized\n");
}*/
{
int32_t i;
for (i=0; i<len; i++)
printf("%02x ",serialized[i]);
printf("wrote rwoffer serialized\n");
}*/
*lenp = len;
return(orderhash);
}
@ -366,17 +366,17 @@ char *instantdex_sendcmd(struct supernet_info *myinfo,struct instantdex_offer *o
{
iguana_queue_send(coin,addr,0,serialized,"InstantDEX",msg->sig.allocsize,0,0);
/*r = (rand() % max);
for (i=0; i<max; i++)
{
j = (i + r) % max;
if ( (addr= coin->peers.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; i<max; i++)
{
j = (i + r) % max;
if ( (addr= coin->peers.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}]"));
}

4
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

2
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

8
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++;

2
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}"

1
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}"

1
iguana/tests/encryptwallet2

@ -0,0 +1 @@
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"encryptwallet\",\"passphrase\":\"test2\"}"

2
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}"

1
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}"
Loading…
Cancel
Save