Browse Source

test

etomic
jl777 8 years ago
parent
commit
6558d607f9
  1. 9
      basilisk/basilisk_swap.c
  2. 13
      iguana/dpow/dpow_network.c
  3. 3
      iguana/tests/requestM

9
basilisk/basilisk_swap.c

@ -1022,15 +1022,16 @@ void basilisk_rawtx_setparms(char *name,struct supernet_info *myinfo,struct basi
int32_t bitcoin_coinptrs(struct supernet_info *myinfo,struct iguana_info **bobcoinp,struct iguana_info **alicecoinp,char *src,char *dest,bits256 srchash,bits256 desthash)
{
struct iguana_info *coin = iguana_coinfind(src);
*bobcoinp = *alicecoinp = 0;
if ( strcmp("BTC",src) == 0 )
if ( strcmp("BTC",src) == 0 || coin->notarychain >= 0 )
{
*bobcoinp = iguana_coinfind("BTC");
*bobcoinp = iguana_coinfind(src);
*alicecoinp = iguana_coinfind(dest);
}
else if ( strcmp("BTC",dest) == 0 )
else //if ( strcmp("BTC",dest) == 0 )
{
*bobcoinp = iguana_coinfind("BTC");
*bobcoinp = iguana_coinfind(dest);
*alicecoinp = iguana_coinfind(src);
}
if ( bits256_cmp(myinfo->myaddr.persistent,srchash) == 0 )

13
iguana/dpow/dpow_network.c

@ -70,7 +70,7 @@ int32_t signed_nn_recv(void **freeptrp,void *ctx,uint8_t notaries[64][33],int32_
{
*(void **)packetp = (void **)((uint64_t)sigpacket + sizeof(*sigpacket));
*freeptrp = sigpacket;
//printf("got signed packet from notary0\n");
printf("got signed packet from notary0\n");
return((int32_t)(recvbytes - sizeof(*sigpacket)));
}
for (i=0; i<n && i<64; i++)
@ -78,7 +78,7 @@ int32_t signed_nn_recv(void **freeptrp,void *ctx,uint8_t notaries[64][33],int32_
if ( memcmp(pubkey33,notaries[i],33) == 0 )
{
*(void **)packetp = (void **)((uint64_t)sigpacket + sizeof(*sigpacket));
//printf("got signed packet from notary.%d\n",i);
printf("got signed packet from notary.%d\n",i);
*freeptrp = sigpacket;
return((int32_t)(recvbytes - sizeof(*sigpacket)));
}
@ -204,7 +204,7 @@ char *_dex_reqsend(struct supernet_info *myinfo,char *handler,uint8_t *data,int3
{
timeout = 100;
nn_setsockopt(reqsock,NN_SOL_SOCKET,NN_SNDTIMEO,&timeout,sizeof(timeout));
timeout = 1000;
timeout = 2000;
nn_setsockopt(reqsock,NN_SOL_SOCKET,NN_RCVTIMEO,&timeout,sizeof(timeout));
//nn_setsockopt(reqsock,NN_TCP,NN_RECONNECT_IVL,&timeout,sizeof(timeout));
if ( myinfo->IAMNOTARY == 0 && subsock < 0 && (subsock= nn_socket(AF_SP,NN_SUB)) >= 0 )
@ -296,7 +296,8 @@ char *_dex_reqsend(struct supernet_info *myinfo,char *handler,uint8_t *data,int3
printf("%d: subscribe connect (%s)\n",myinfo->numdexipbits,str);
}
}
//nn_connect(myinfo->reqsock,nanomsg_tcpname(0,str,ipaddr,REP_SOCK));
nanomsg_tcpname(0,str,ipaddr,REP_SOCK);
//nn_connect(myinfo->reqsock,str);
printf("%d: req connect (%s)\n",myinfo->numdexipbits,str);
}
}
@ -485,7 +486,7 @@ char *dex_reqsend(struct supernet_info *myinfo,char *handler,uint8_t *data,int32
{
if ( (retstrs[j]= _dex_reqsend(myinfo,handler,data,datalen)) != 0 )
{
//printf("j.%d of max.%d M.%d (%s)\n",j,max,M,retstrs[j]);
printf("j.%d of max.%d M.%d (%s)\n",j,max,M,retstrs[j]);
if ( strncmp(retstrs[j],"{\"error\":\"null return\"}",strlen("{\"error\":\"null return\"}")) != 0 && strncmp(retstrs[j],"[]",strlen("[]")) != 0 && strcmp("0",retstrs[j]) != 0 )
{
if ( ++j == M )
@ -1564,7 +1565,7 @@ int32_t dpow_nanomsg_update(struct supernet_info *myinfo)
break;
usleep(1000);
}*/
while ( (size= signed_nn_recv(&freeptr,myinfo->ctx,myinfo->notaries,myinfo->numnotaries,myinfo->dpowsock,&np)) >= 0 && num < 100 )
while ( (size= signed_nn_recv(&freeptr,myinfo->ctx,myinfo->notaries,myinfo->numnotaries,myinfo->dpowsock,&np)) >= 0 && num < 300 )
{
num++;
if ( size > 0 )

3
iguana/tests/requestM

@ -0,0 +1,3 @@
#!/bin/bash
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"InstantDEX\",\"method\":\"request\",\"vals\":{\"source\":\"MVP\",\"amount\":0.1,\"dest\":\"USD\",\"minprice\":0.09}}"
Loading…
Cancel
Save