jl777 8 years ago
parent
commit
675aa21fb9
  1. 9
      iguana/dpow/dpow_fsm.c
  2. 2
      iguana/tests/ratify_7776

9
iguana/dpow/dpow_fsm.c

@ -408,16 +408,23 @@ void dpow_statemachinestart(void *ptr)
for (i=0; i<numratified; i++) for (i=0; i<numratified; i++)
{ {
item = jitem(ratified,i); item = jitem(ratified,i);
hexstr = handle = 0;
if ( (hexstr= jstr(item,"pubkey")) != 0 && is_hexstr(hexstr,0) == 66 && (handle= jstr(item,"handle")) != 0 ) if ( (hexstr= jstr(item,"pubkey")) != 0 && is_hexstr(hexstr,0) == 66 && (handle= jstr(item,"handle")) != 0 )
{ {
decode_hex(bp->ratified_pubkeys[i],33,hexstr); decode_hex(bp->ratified_pubkeys[i],33,hexstr);
safecopy(bp->handles[i],handle,sizeof(bp->handles[i])); safecopy(bp->handles[i],handle,sizeof(bp->handles[i]));
} else break; }
else
{
printf("break loop hexstr.%p handle.%p\n",hexstr,handle);
break;
}
} }
if ( i == numratified ) if ( i == numratified )
{ {
bp->numratified = numratified; bp->numratified = numratified;
bp->ratified = jduplicate(ratified); bp->ratified = jduplicate(ratified);
printf("numratified.%d %s\n",numratified,jprint(ratified,0));
} }
} }
free_json(json); free_json(json);

2
iguana/tests/ratify_7776

@ -1 +1 @@
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"dpow\",\"method\":\"ratify\",\"minsigs\":2,\"timestamp\":1476711523,\"ratified\":[{\"handle\":\"testA\",\"pubkey\":\"03b7621b44118017a16043f19b30cc8a4cfe068ac4e42417bae16ba460c80f3828\"}, {\"handle\":\"testA\",\"pubkey\":\"02ebfc784a4ba768aad88d44d1045d240d47b26e248cafaf1c5169a42d7a61d344\"}]}" curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"dpow\",\"method\":\"ratify\",\"minsigs\":2,\"timestamp\":1476711523,\"ratified\":[{\"handle\":\"testA\",\"pubkey\":\"03b7621b44118017a16043f19b30cc8a4cfe068ac4e42417bae16ba460c80f3828\"}, {\"handle\":\"testB\",\"pubkey\":\"02ebfc784a4ba768aad88d44d1045d240d47b26e248cafaf1c5169a42d7a61d344\"}]}"

Loading…
Cancel
Save