Browse Source

test

etomic
jl777 8 years ago
parent
commit
15d7fdaebb
  1. 1
      iguana/dPoW.h
  2. 6
      iguana/dpow/dpow_network.c
  3. 27
      iguana/dpow/dpow_rpc.c

1
iguana/dPoW.h

@ -181,5 +181,6 @@ char *_dex_alladdresses(struct supernet_info *myinfo,char *symbol);
int32_t _dex_getheight(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);
cJSON *dpow_checkaddress(struct supernet_info *myinfo,struct iguana_info *coin,char *address);
#endif

6
iguana/dpow/dpow_network.c

@ -513,7 +513,11 @@ char *dex_response(int32_t *broadcastflagp,struct supernet_info *myinfo,struct d
}
else if ( dexreq.func == 'C' )
{
//retstr = dpow_checkaddress(myinfo,coin,(char *)&dexp->packet[datalen]);
if ( (retjson= dpow_checkaddress(myinfo,coin,(char *)&dexp->packet[datalen])) != 0 )
{
dpow_randipbits(myinfo,coin,retjson);
retstr = jprint(retjson,1);
}
}
else if ( dexreq.func == 'A' )
{

27
iguana/dpow/dpow_rpc.c

@ -475,6 +475,33 @@ void update_alladdresses(struct supernet_info *myinfo,struct iguana_info *coin,c
}
}
cJSON *dpow_checkaddress(struct supernet_info *myinfo,struct iguana_info *coin,char *address)
{
int32_t isvalid=0,doneflag=0; char *retstr; cJSON *validatejson,*retjson = cJSON_CreateObject();
if ( (retstr= dpow_validateaddress(myinfo,coin,address)) != 0 )
{
if ( (validatejson= cJSON_Parse(retstr)) != 0 )
{
if ( (isvalid= is_cJSON_True(jobj(validatejson,"isvalid")) != 0) != 0 )
{
if ( is_cJSON_True(jobj(validatejson,"iswatchonly")) != 0 || is_cJSON_True(jobj(validatejson,"ismine")) != 0 )
doneflag = 1;
}
free_json(validatejson);
}
free(retstr);
retstr = 0;
}
if ( isvalid == 0 )
jaddstr(retjson,"error","invalid address");
else if ( doneflag != 0 )
{
jaddstr(retjson,"coin",coin->symbol);
jaddstr(retjson,"address",address);
}
return(retjson);
}
char *dpow_importaddress(struct supernet_info *myinfo,struct iguana_info *coin,char *address)
{
char buf[1024],*retstr; cJSON *validatejson; int32_t isvalid=0,doneflag = 0;

Loading…
Cancel
Save