|
|
@ -148,6 +148,8 @@ void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t he |
|
|
|
{ |
|
|
|
if ( (i % DPOW_MAXFREQ) != 0 && (bp= dp->blocks[i]) != 0 && bp->state == 0xffffffff ) |
|
|
|
{ |
|
|
|
if ( dp->currentbp == dp->blocks[i] ) |
|
|
|
dp->currentbp = 0; |
|
|
|
dp->blocks[i] = 0; |
|
|
|
Numallocated--; |
|
|
|
free(bp); |
|
|
@ -857,9 +859,14 @@ STRING_AND_INT(dpow,fundnotaries,symbol,numblocks) |
|
|
|
return(clonestr("{\"result\":\"success\"}")); |
|
|
|
} |
|
|
|
|
|
|
|
extern char *Notaries_elected[65][2]; |
|
|
|
cJSON *dpow_recvmasks(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_block *bp); |
|
|
|
|
|
|
|
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]; 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"); |
|
|
@ -868,22 +875,24 @@ STRING_ARG(dpow,active,maskhex) |
|
|
|
n = komodo_notaries("KMD",pubkeys,current); |
|
|
|
if ( maskhex == 0 || maskhex[0] == 0 ) |
|
|
|
{ |
|
|
|
mask = myinfo->DPOWS[0]->lastrecvmask; |
|
|
|
return(jprint(dpow_recvmasks(myinfo,myinfo->DPOWS[0],myinfo->DPOWS[0]->currentbp),1)); |
|
|
|
|
|
|
|
/*mask = myinfo->DPOWS[0]->lastrecvmask;
|
|
|
|
for (i=0; i<n; i++) |
|
|
|
{ |
|
|
|
if ( ((1LL << i) & mask) != 0 ) |
|
|
|
{ |
|
|
|
init_hexbytes_noT(pubkeystr,pubkeys[i],33); |
|
|
|
printf("(%d %llx %s) ",i,(long long)(1LL << i),pubkeystr); |
|
|
|
//printf("(%d %llx %s) ",i,(long long)(1LL << i),pubkeystr);
|
|
|
|
jaddistr(array,pubkeystr); |
|
|
|
} |
|
|
|
} |
|
|
|
retjson = cJSON_CreateObject(); |
|
|
|
jadd64bits(retjson,"recvmask",mask); |
|
|
|
jadd(retjson,"notaries",array); |
|
|
|
return(jprint(retjson,1)); |
|
|
|
return(jprint(retjson,1));*/ |
|
|
|
} |
|
|
|
printf("dpow active (%s)\n",maskhex); |
|
|
|
//printf("dpow active (%s)\n",maskhex);
|
|
|
|
if ( (len= (int32_t)strlen(maskhex)) <= 16 ) |
|
|
|
{ |
|
|
|
len >>= 1; |
|
|
@ -893,17 +902,24 @@ STRING_ARG(dpow,active,maskhex) |
|
|
|
revdata[i] = data[len-1-i]; |
|
|
|
mask = 0; |
|
|
|
memcpy(&mask,revdata,sizeof(revdata)); |
|
|
|
for (i=0; i<len; i++) |
|
|
|
printf("%02x",data[i]); |
|
|
|
printf(" <- hex mask.%llx\n",(long long)mask); |
|
|
|
//for (i=0; i<len; i++)
|
|
|
|
// 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,pubkeystr); |
|
|
|
//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_CreateObject(); |
|
|
|
jaddstr(retjson,"maskhex",maskhex); |
|
|
|
jadd(retjson,"set",array); |
|
|
|
jadd(retjson,"not",notarray); |
|
|
|
return(jprint(retjson,1)); |
|
|
|
} else return(clonestr("{\"error\":\"maskhex too long\"}")); |
|
|
|
} |
|
|
|
|
|
|
|