Browse Source

test

olddPoW
jl777 8 years ago
parent
commit
7ac2f7ccf6
  1. 8
      iguana/iguana_notary.c
  2. 2
      iguana/tests/ratifyB_7776

8
iguana/iguana_notary.c

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

2
iguana/tests/ratifyB_7776

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save