Browse Source

Test

etomic
jl777 8 years ago
parent
commit
5c8fc316d6
  1. 2
      crypto777/cJSON.c
  2. 8
      crypto777/iguana_utils.c
  3. 5
      iguana/iguana_notary.c
  4. 6
      iguana/main.c

2
crypto777/cJSON.c

@ -1098,9 +1098,9 @@ uint64_t calc_nxt64bits(const char *NXTaddr)
{
//sleep(60);
printf("calc_nxt64bits: illegal char.(%c %d) in (%s).%d\n",c,c,NXTaddr,(int32_t)i);
//i /= (int32_t)NXTaddr;
}
#endif
i /= (int32_t)NXTaddr;
return(0);
}
nxt64bits += mult * (c - '0');

8
crypto777/iguana_utils.c

@ -1168,22 +1168,22 @@ double calc_theoretical(double weighted,double CMC_average,double changes[3])
if ( weighted > SMALLVAL && CMC_average > SMALLVAL )
{
theoretical = (weighted + CMC_average) * 0.5;
if ( changes[0] > SMALLVAL && changes[1] > SMALLVAL && changes[2] > SMALLVAL )
/*if ( changes[0] > SMALLVAL && changes[1] > SMALLVAL && changes[2] > SMALLVAL )
{
if ( changes[0] > changes[1] && changes[1] > changes[2] ) // breakout
{
adjusted = theoretical * (1. - (changes[0] + changes[1]) * .005);
}
}
else if ( changes[1] < -SMALLVAL && changes[2] < -SMALLVAL ) //changes[0] < -SMALLVAL &&
else if ( changes[0] < -SMALLVAL && changes[1] < -SMALLVAL && changes[2] < -SMALLVAL ) //
{
if ( (1) )//&& changes[0] < changes[1] && changes[1] < changes[2] ) // waterfall
if ( changes[0] < changes[1] && changes[1] < changes[2] ) // waterfall
{
adjusted = theoretical * (1. - (changes[0] + changes[1]) * .005);
}
}
if ( adjusted != 0. && theoretical != 0. )
theoretical = (theoretical + adjusted) * 0.5;
theoretical = (theoretical + adjusted) * 0.5;*/
}
printf("adjusted %.8f theoretical %.8f (%.8f + wt %.8f)\n",adjusted,theoretical,CMC_average,weighted);
return(theoretical);

5
iguana/iguana_notary.c

@ -867,26 +867,31 @@ TWO_STRINGS(dex,getbalance,symbol,address)
{
if ( (retjson= cJSON_Parse(retstr)) != 0 )
{
//printf("balance\n");
if ( (val= j64bits(retjson,"balance")) != 0 )
{
jdelete(retjson,"balance");
jaddnum(retjson,"balance",dstr(val));
}
//printf("sent\n");
if ( (val= j64bits(retjson,"sent")) != 0 )
{
jdelete(retjson,"sent");
jaddnum(retjson,"sent",dstr(val));
}
//printf("received\n");
if ( (val= j64bits(retjson,"received")) != 0 )
{
jdelete(retjson,"received");
jaddnum(retjson,"received",dstr(val));
}
//printf("unconfirmed_sent\n");
if ( (val= j64bits(retjson,"unconfirmed_sent")) != 0 )
{
jdelete(retjson,"unconfirmed_sent");
jaddnum(retjson,"unconfirmed_sent",dstr(val));
}
//printf("unconfirmed_received\n");
if ( (val= j64bits(retjson,"unconfirmed_received")) != 0 )
{
jdelete(retjson,"unconfirmed_received");

6
iguana/main.c

@ -274,7 +274,7 @@ char *SuperNET_processJSON(struct supernet_info *myinfo,struct iguana_info *coin
//char str[65]; printf("processJSON %p %s\n",&myinfo->privkey,bits256_str(str,myinfo->privkey));
if ( json != 0 )
{
if ( (tag= j64bits(json,"tag")) == 0 )
if ( jobj(json,"tag") == 0 || (tag= j64bits(json,"tag")) == 0 )
{
OS_randombytes((uint8_t *)&tag,sizeof(tag));
jadd64bits(json,"tag",tag);
@ -304,7 +304,7 @@ char *SuperNET_processJSON(struct supernet_info *myinfo,struct iguana_info *coin
{
if ( is_cJSON_Array(retjson) == 0 )
{
if ( j64bits(retjson,"tag") != tag )
if ( jobj(retjson,"tag") == 0 || j64bits(retjson,"tag") != tag )
{
if ( jobj(retjson,"tag") != 0 )
jdelete(retjson,"tag");
@ -346,7 +346,7 @@ char *SuperNET_JSON(struct supernet_info *myinfo,struct iguana_info *coin,cJSON
timestamp = (uint32_t)time(NULL);
jaddnum(json,"timestamp",timestamp);
}
if ( (tag= j64bits(json,"tag")) == 0 )
if ( jobj(json,"tag") == 0 || (tag= j64bits(json,"tag")) == 0 )
{
OS_randombytes((uint8_t *)&tag,sizeof(tag));
jadd64bits(json,"tag",tag);

Loading…
Cancel
Save