Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
666363d2df
  1. 6
      iguana/SuperNET.c
  2. 2
      iguana/SuperNET_category.c
  3. 16
      iguana/pangea_api.c

6
iguana/SuperNET.c

@ -638,10 +638,16 @@ char *SuperNET_JSON(struct supernet_info *myinfo,cJSON *json,char *remoteaddr)
char hexbuf[8192]; bits256 category,subhash;
int32_t hexlen,destflag,maxdelay,flag=0; uint32_t destipbits,timestamp; cJSON *retjson;
char *forwardstr=0,*retstr=0,*agent=0,*method=0,*message,*hexmsg=0,*jsonstr=0; uint64_t tag;
//printf("SuperNET_JSON.(%s)\n",jprint(json,0));
if ( remoteaddr != 0 && strcmp(remoteaddr,"127.0.0.1") == 0 )
remoteaddr = 0;
agent = jstr(json,"agent");
method = jstr(json,"method");
if ( agent != 0 && strcmp(agent,"pangea") == 0 && jobj(json,"categoryhash") == 0 )
{
jaddbits256(json,"categoryhash",calc_categoryhashes(0,"pangea",0));
jaddbits256(json,"subhash",GENESIS_PUBKEY);
}
if ( remoteaddr == 0 )
{
if ( jobj(json,"timestamp") != 0 )

2
iguana/SuperNET_category.c

@ -43,7 +43,7 @@ struct category_info *category_find(bits256 categoryhash,bits256 subhash)
return(sub);
}
return(cat);
} else printf("category_find.(%s) not found\n",bits256_str(str,categoryhash));
} else printf("category_find.(%s) not found\n",bits256_str(str,categoryhash));//, getchar();
return(0);
}

16
iguana/pangea_api.c

@ -317,7 +317,8 @@ void pangea_update(struct supernet_info *myinfo)
{ "turn", pangea_turn }, { "confirm", pangea_confirm }, { "action", pangea_action },
{ "showdown", pangea_showdown }, { "summary", pangea_summary },
};
struct category_msg *m; bits256 pangeahash,tablehash; struct pangea_msghdr *pm; int32_t i,allocsize;
struct category_msg *m; bits256 pangeahash,tablehash; struct pangea_msghdr *pm;
int32_t i,allocsize; cJSON *argjson;
uint64_t cmdbits; char str[65]; struct table_info *tp; uint8_t buf[sizeof(pm->sig)];
if ( tablecmds[0].cmdbits == 0 )
{
@ -328,6 +329,19 @@ void pangea_update(struct supernet_info *myinfo)
while ( (m= category_gethexmsg(myinfo,pangeahash,GENESIS_PUBKEY)) != 0 )
{
pm = (struct pangea_msghdr *)m->msg;
if ( m->msg[m->len-1] == 0 )
{
if ( (argjson= cJSON_Parse((char *)m->msg)) != 0 )
{
printf("parsed pangea hex.(%s)\n",(char *)m->msg);
free_json(argjson);
free(m);
continue;
}
}
for (i=0; i<16; i++)
printf("%02x ",m->msg[i]);
printf("pangeahash.%s len.%d (%02x %02x)\n",bits256_str(str,pangeahash),m->len,m->msg[m->len-2],m->msg[m->len-1]);
acct777_rwsig(0,(void *)&pm->sig,(void *)buf), memcpy(&pm->sig,buf,sizeof(pm->sig));
iguana_rwbignum(0,pm->tablehash.bytes,sizeof(bits256),tablehash.bytes);
pm->tablehash = tablehash;

Loading…
Cancel
Save