From bf0fac201968e49f94b51d7ab57fd7ba3cafe3cc Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 10 Jan 2017 19:29:35 +0200 Subject: [PATCH] test --- iguana/dpow/dpow_network.c | 10 +++++----- iguana/dpow/dpow_rpc.c | 11 ++++++++--- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/iguana/dpow/dpow_network.c b/iguana/dpow/dpow_network.c index 14a8d2cd9..8a9490468 100755 --- a/iguana/dpow/dpow_network.c +++ b/iguana/dpow/dpow_network.c @@ -116,7 +116,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 = 2000; + timeout = 1000; 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 ) @@ -184,7 +184,7 @@ char *_dex_reqsend(struct supernet_info *myinfo,char *handler,uint8_t *data,int3 { ipbits = juint(retjson,"randipbits"); free_json(retjson); - if ( ipbits != 0 ) + if ( 0 && ipbits != 0 ) printf("GOT randipbits.%08x\n",ipbits); } } @@ -377,17 +377,17 @@ char *dex_response(int32_t *broadcastflagp,struct supernet_info *myinfo,struct d char *dex_reqsend(struct supernet_info *myinfo,char *handler,uint8_t *data,int32_t datalen) { - char *retstr = 0; int32_t i,max = myinfo->numdpowipbits; + char *retstr = 0; int32_t i,max = myinfo->numdexipbits; for (i=0; i<=max; i++) { if ( (retstr= _dex_reqsend(myinfo,handler,data,datalen)) != 0 ) { if ( strncmp(retstr,"{\"error\":\"null return\"}",strlen("{\"error\":\"null return\"}")) != 0 ) break; - else if ( i < max-1 ) + else if ( i < max ) free(retstr); } - printf("automatic retry\n"); + //printf("automatic retry.%d of %d\n",i,max); } return(retstr); } diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index d7568df26..517078374 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -484,18 +484,23 @@ void update_alladdresses(struct supernet_info *myinfo,struct iguana_info *coin,c char *dpow_importaddress(struct supernet_info *myinfo,struct iguana_info *coin,char *address) { - char buf[1024],*retstr; cJSON *validatejson; int32_t doneflag = 0; + char buf[1024],*retstr; cJSON *validatejson; int32_t isvalid=0,doneflag = 0; if ( (retstr= dpow_validateaddress(myinfo,coin,address)) != 0 ) { if ( (validatejson= cJSON_Parse(retstr)) != 0 ) { - if ( is_cJSON_True(jobj(validatejson,"iswatchonly")) != 0 || is_cJSON_True(jobj(validatejson,"ismine")) != 0 ) - doneflag = 1; + 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 ) + return(clonestr("{\"isvalid\":false}")); if ( doneflag != 0 ) return(0); // success update_alladdresses(myinfo,coin,address);