Browse Source

test

etomic
jl777 8 years ago
parent
commit
f36b6c524d
  1. 22
      iguana/dpow/dpow_network.c

22
iguana/dpow/dpow_network.c

@ -672,13 +672,27 @@ char *dex_reqsend(struct supernet_info *myinfo,char *handler,uint8_t *data,int32
} }
else else
{ {
#define DEX_LESSTHAN_RETSTR "{\"error\":\"less than required responses\"}"
for (i=0; i<j; i++) for (i=0; i<j; i++)
free(retstrs[i]); free(retstrs[i]);
retstrs[0] = clonestr("{\"error\":\"less than required responses\"}"); retstrs[0] = clonestr(DEX_LESSTHAN_RETSTR);
} }
return(retstrs[0]); return(retstrs[0]);
} }
char *_dex_arrayreturn(char *retstr)
{
if ( retstr != 0 )
{
if ( strcmp(retstr,DEX_LESSTHAN_RETSTR) == 0 )
{
free(retstr);
retstr = clonestr("[]");
}
}
return(retstr);
}
char *_dex_sendrequest(struct supernet_info *myinfo,struct dex_request *dexreq,int32_t M,char *field) char *_dex_sendrequest(struct supernet_info *myinfo,struct dex_request *dexreq,int32_t M,char *field)
{ {
uint8_t packet[sizeof(*dexreq)]; int32_t datalen; uint8_t packet[sizeof(*dexreq)]; int32_t datalen;
@ -783,7 +797,7 @@ char *_dex_alladdresses(struct supernet_info *myinfo,char *symbol)
memset(&dexreq,0,sizeof(dexreq)); memset(&dexreq,0,sizeof(dexreq));
safecopy(dexreq.name,symbol,sizeof(dexreq.name)); safecopy(dexreq.name,symbol,sizeof(dexreq.name));
dexreq.func = '*'; dexreq.func = '*';
return(_dex_sendrequest(myinfo,&dexreq,1,"")); return(_dex_arrayreturn(_dex_sendrequest(myinfo,&dexreq,1,"")));
} }
char *_dex_getblock(struct supernet_info *myinfo,char *symbol,bits256 hash2) char *_dex_getblock(struct supernet_info *myinfo,char *symbol,bits256 hash2)
@ -857,7 +871,7 @@ char *_dex_listunspent(struct supernet_info *myinfo,char *symbol,char *address)
memset(&dexreq,0,sizeof(dexreq)); memset(&dexreq,0,sizeof(dexreq));
safecopy(dexreq.name,symbol,sizeof(dexreq.name)); safecopy(dexreq.name,symbol,sizeof(dexreq.name));
dexreq.func = 'U'; dexreq.func = 'U';
return(_dex_sendrequeststr(myinfo,&dexreq,address,1,"")); return(_dex_arrayreturn(_dex_sendrequeststr(myinfo,&dexreq,address,1,"")));
} }
char *_dex_listtransactions(struct supernet_info *myinfo,char *symbol,char *address,int32_t count,int32_t skip) char *_dex_listtransactions(struct supernet_info *myinfo,char *symbol,char *address,int32_t count,int32_t skip)
@ -868,7 +882,7 @@ char *_dex_listtransactions(struct supernet_info *myinfo,char *symbol,char *addr
dexreq.intarg = skip; dexreq.intarg = skip;
dexreq.shortarg = count; dexreq.shortarg = count;
dexreq.func = 'L'; dexreq.func = 'L';
return(_dex_sendrequeststr(myinfo,&dexreq,address,1,"")); return(_dex_arrayreturn(_dex_sendrequeststr(myinfo,&dexreq,address,1,"")));
} }
int32_t dex_crc32find(struct supernet_info *myinfo,uint32_t crc32) int32_t dex_crc32find(struct supernet_info *myinfo,uint32_t crc32)

Loading…
Cancel
Save