Browse Source

test

etomic
jl777 8 years ago
parent
commit
6e0893cc97
  1. 2
      iguana/dPoW.h
  2. 6
      iguana/dpow/dpow_network.c
  3. 3
      iguana/dpow/dpow_rpc.c
  4. 6
      iguana/iguana_notary.c
  5. 2
      iguana/main.c
  6. 2
      iguana/tests/dexnotaries
  7. 1
      includes/iguana_apideclares.h

2
iguana/dPoW.h

@ -179,7 +179,7 @@ char *_dex_listunspent(struct supernet_info *myinfo,char *symbol,char *address);
char *_dex_listtransactions(struct supernet_info *myinfo,char *symbol,char *coinaddr,int32_t count,int32_t skip);
char *_dex_alladdresses(struct supernet_info *myinfo,char *symbol);
int32_t _dex_getheight(struct supernet_info *myinfo,char *symbol);
char *_dex_notaries(struct supernet_info *myinfo,char *symbol);
char *_dex_getnotaries(struct supernet_info *myinfo,char *symbol);
int32_t komodo_notaries(char *symbol,uint8_t pubkeys[64][33],int32_t height);
#endif

6
iguana/dpow/dpow_network.c

@ -259,7 +259,7 @@ char *_dex_reqsend(struct supernet_info *myinfo,char *handler,uint8_t *data,int3
// printf("%02x",((uint8_t *)data)[i]);
if ( (recvbytes= signed_nn_recv(&freeptr,myinfo->ctx,myinfo->notaries,myinfo->numnotaries,myinfo->reqsock,&retptr)) >= 0 )
{
printf("req returned.[%d]\n",recvbytes);
//printf("req returned.[%d]\n",recvbytes);
portable_mutex_lock(&myinfo->dexmutex);
ipbits = 0;
if ( strcmp(handler,"DEX") == 0 )
@ -267,7 +267,7 @@ char *_dex_reqsend(struct supernet_info *myinfo,char *handler,uint8_t *data,int3
else if ( retptr != 0 )
{
retstr = clonestr((char *)retptr);
printf("GOT.(%s)\n",retstr);
//printf("GOT.(%s)\n",retstr);
if ( (retjson= cJSON_Parse(retstr)) != 0 )
{
ipbits = juint(retjson,"randipbits");
@ -619,7 +619,7 @@ int32_t _dex_getheight(struct supernet_info *myinfo,char *symbol)
return(height);
}
char *_dex_notaries(struct supernet_info *myinfo,char *symbol)
char *_dex_getnotaries(struct supernet_info *myinfo,char *symbol)
{
struct dex_request dexreq;
memset(&dexreq,0,sizeof(dexreq));

3
iguana/dpow/dpow_rpc.c

@ -51,6 +51,7 @@ int32_t komodo_notaries(char *symbol,uint8_t pubkeys[64][33],int32_t height)
{
height = jint(retjson,"blocks") - 1;
free_json(retjson);
printf("komodo_notaries height.%d\n",height);
}
}
if ( coin->FULLNODE < 0 )
@ -60,7 +61,7 @@ int32_t komodo_notaries(char *symbol,uint8_t pubkeys[64][33],int32_t height)
{
if ( (retjson= cJSON_Parse(retstr)) != 0 )
{
//printf("%s\n",retstr);
printf("%s\n",retstr);
if ( (array= jarray(&num,retjson,"notaries")) != 0 )
{
if ( num > 64 )

6
iguana/iguana_notary.c

@ -656,6 +656,12 @@ TWO_STRINGS_AND_TWO_DOUBLES(dex,listtransactions,symbol,address,count,skip)
{
return(_dex_listtransactions(myinfo,symbol,address,count,skip));
}
STRING_ARG(dex,getnotaries,symbol)
{
return(_dex_getnotaries(myinfo,symbol));
}
#include "../includes/iguana_apiundefs.h"

2
iguana/main.c

@ -1644,7 +1644,7 @@ void iguana_main(void *arg)
iguana_appletests(myinfo);
#endif
char *retstr,*pubkeystr; cJSON *retjson,*array,*item; int32_t i,n;
if ( (retstr= _dex_notaries(myinfo,"KMD")) != 0 )
if ( (retstr= _dex_getnotaries(myinfo,"KMD")) != 0 )
{
printf("INITIAL NOTARIES.(%s)\n",retstr);
if ( (retjson= cJSON_Parse(retstr)) != 0 )

2
iguana/tests/dexnotaries

@ -0,0 +1,2 @@
#!/bin/bash
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"getnotaries\",\"symbol\":\"KMD\"}"

1
includes/iguana_apideclares.h

@ -29,6 +29,7 @@ ZERO_ARGS(iguana,paxfiats);
TWO_STRINGS(dex,send,hex,handler);
HASH_AND_STRING(dex,gettransaction,txid,symbol);
STRING_ARG(dex,getinfo,symbol);
STRING_ARG(dex,getnotaries,symbol);
STRING_ARG(dex,alladdresses,symbol);
STRING_ARG(dex,getbestblockhash,symbol);
STRING_AND_INT(dex,getblockhash,symbol,height);

Loading…
Cancel
Save