Browse Source

test

olddPoW
jl777 8 years ago
parent
commit
86090b12a5
  1. 7
      iguana/dpow/dpow_fsm.c
  2. 10
      iguana/iguana_notary.c

7
iguana/dpow/dpow_fsm.c

@ -394,7 +394,7 @@ void dpow_statemachinestart(void *ptr)
jsonstr = ptrs[4];
kmdheight = -1;
memcpy(&checkpoint,&ptrs[5],sizeof(checkpoint));
printf("statemachinestart %s->%s %s ht.%d minsigs.%d duration.%d\n",dp->symbol,dp->dest,bits256_str(str,checkpoint.blockhash.hash),checkpoint.blockhash.height,minsigs,duration);
printf("statemachinestart %s->%s %s ht.%d minsigs.%d duration.%d start.%u\n",dp->symbol,dp->dest,bits256_str(str,checkpoint.blockhash.hash),checkpoint.blockhash.height,minsigs,duration,checkpoint.timestamp);
src = iguana_coinfind(dp->symbol);
dest = iguana_coinfind(dp->dest);
if ( strcmp(src->symbol,"KMD") == 0 )
@ -531,8 +531,9 @@ void dpow_statemachinestart(void *ptr)
}
sleep(1);
}
starttime = (uint32_t)time(NULL);
printf("DPOW.%s statemachine checkpoint.%d %s\n",src->symbol,checkpoint.blockhash.height,bits256_str(str,checkpoint.blockhash.hash));
if ( (starttime= checkpoint.timestamp) == 0 )
starttime = (uint32_t)time(NULL);
printf("DPOW.%s statemachine checkpoint.%d %s start.%u\n",src->symbol,checkpoint.blockhash.height,bits256_str(str,checkpoint.blockhash.hash),checkpoint.timestamp);
for (i=0; i<sizeof(srchash); i++)
srchash.bytes[i] = dp->minerkey33[i+1];
dpow_utxosync(myinfo,dp,bp,0,myind,srchash);

10
iguana/iguana_notary.c

@ -354,21 +354,20 @@ ZERO_ARGS(dpow,cancelratify)
return(clonestr("{\"result\":\"queued dpow cancel ratify\"}"));
}
TWOINTS_AND_ARRAY(dpow,ratify,minsigs,starttime,ratified)
TWOINTS_AND_ARRAY(dpow,ratify,minsigs,start,ratified)
{
void **ptrs; bits256 zero; struct dpow_checkpoint checkpoint; cJSON *retjson;
if ( ratified == 0 )
return(clonestr("{\"error\":\"no ratified list for dpow ratify\"}"));
memset(zero.bytes,0,sizeof(zero));
dpow_checkpointset(myinfo,&checkpoint,0,zero,starttime,starttime);
dpow_checkpointset(myinfo,&checkpoint,0,zero,start,start);
ptrs = calloc(1,sizeof(void *)*5 + sizeof(struct dpow_checkpoint));
ptrs[0] = (void *)myinfo;
ptrs[1] = (void *)&myinfo->DPOWS[0];
ptrs[2] = (void *)(long)minsigs;
ptrs[3] = (void *)DPOW_RATIFYDURATION;
ptrs[4] = (void *)jprint(ratified,0);
checkpoint.blockhash.height = ((starttime / 10) % (DPOW_FIRSTRATIFY/10)) * 10;
checkpoint.blockhash.height = ((start / 10) % (DPOW_FIRSTRATIFY/10)) * 10;
memcpy(&ptrs[5],&checkpoint,sizeof(checkpoint));
myinfo->DPOWS[0].cancelratify = 0;
if ( OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)dpow_statemachinestart,(void *)ptrs) != 0 )
@ -376,7 +375,8 @@ TWOINTS_AND_ARRAY(dpow,ratify,minsigs,starttime,ratified)
}
retjson = cJSON_CreateObject();
jaddstr(retjson,"result","started ratification");
jaddnum(retjson,"starttime",starttime);
jaddnum(retjson,"start",start);
jaddnum(retjson,"minsigs",minsigs);
jaddnum(retjson,"height",checkpoint.blockhash.height);
return(jprint(retjson,1));
}

Loading…
Cancel
Save