From 085ece246e8c310cc6485837e77c8997418b422f Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 30 Apr 2018 14:19:05 +0300 Subject: [PATCH 1/3] Good/bad to active return --- iguana/iguana_notary.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/iguana/iguana_notary.c b/iguana/iguana_notary.c index 7be7fca29..1a49df395 100755 --- a/iguana/iguana_notary.c +++ b/iguana/iguana_notary.c @@ -861,7 +861,9 @@ extern char *Notaries_elected[65][2]; STRING_ARG(dpow,active,maskhex) { - uint8_t data[8],revdata[8],pubkeys[64][33]; char pubkeystr[67]; int32_t i,len,current,n; uint64_t mask; cJSON *infojson,*retjson,*array = cJSON_CreateArray(); + uint8_t data[8],revdata[8],pubkeys[64][33]; char pubkeystr[67]; int32_t i,len,current,n; uint64_t mask; cJSON *infojson,*retjson,*array,*notarray; + array = cJSON_CreateArray(); + notarray = cJSON_CreateArray(); if ( (infojson= dpow_getinfo(myinfo,coin)) != 0 ) { current = jint(infojson,"blocks"); @@ -899,13 +901,19 @@ STRING_ARG(dpow,active,maskhex) // printf("%02x",data[i]); //printf(" <- hex mask.%llx\n",(long long)mask); for (i=0; i<(len<<3); i++) + { if ( ((1LL << i) & mask) != 0 ) { //init_hexbytes_noT(pubkeystr,pubkeys[i],33); //printf("(%d %llx %s) ",i,(long long)(1LL << i),pubkeystr); jaddistr(array,Notaries_elected[i][0]); } - return(jprint(array,1)); + else jaddistr(notarray,Notaries_elected[i][0]); + } + retjson = cJSON_CreateArray(); + jadd(retjson,"good",array); + jadd(retjson,"bad",notarray); + return(jprint(retjson,1)); } else return(clonestr("{\"error\":\"maskhex too long\"}")); } From 8cce9595c038cfae5760301c1f107f58203c4ff5 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 30 Apr 2018 14:22:51 +0300 Subject: [PATCH 2/3] Print --- iguana/iguana_notary.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/iguana_notary.c b/iguana/iguana_notary.c index 1a49df395..aa5337593 100755 --- a/iguana/iguana_notary.c +++ b/iguana/iguana_notary.c @@ -911,8 +911,8 @@ STRING_ARG(dpow,active,maskhex) else jaddistr(notarray,Notaries_elected[i][0]); } retjson = cJSON_CreateArray(); - jadd(retjson,"good",array); - jadd(retjson,"bad",notarray); + jadd(retjson,"set",array); + jadd(retjson,"not",notarray); return(jprint(retjson,1)); } else return(clonestr("{\"error\":\"maskhex too long\"}")); } From be95c9d23118f36578da1d7200d7e3261d7dc8e6 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 30 Apr 2018 14:24:16 +0300 Subject: [PATCH 3/3] Array -> object --- iguana/iguana_notary.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/iguana_notary.c b/iguana/iguana_notary.c index aa5337593..cfab2d931 100755 --- a/iguana/iguana_notary.c +++ b/iguana/iguana_notary.c @@ -910,7 +910,7 @@ STRING_ARG(dpow,active,maskhex) } else jaddistr(notarray,Notaries_elected[i][0]); } - retjson = cJSON_CreateArray(); + retjson = cJSON_CreateObject(); jadd(retjson,"set",array); jadd(retjson,"not",notarray); return(jprint(retjson,1));