From 666363d2df5e65a499eec52407d0e932a70492fe Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 24 Jan 2016 03:03:57 -0300 Subject: [PATCH] test --- iguana/SuperNET.c | 6 ++++++ iguana/SuperNET_category.c | 2 +- iguana/pangea_api.c | 16 +++++++++++++++- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/iguana/SuperNET.c b/iguana/SuperNET.c index cf6b66879..ba2f46a74 100644 --- a/iguana/SuperNET.c +++ b/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 ) diff --git a/iguana/SuperNET_category.c b/iguana/SuperNET_category.c index 7c36a27da..4508c30ea 100644 --- a/iguana/SuperNET_category.c +++ b/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); } diff --git a/iguana/pangea_api.c b/iguana/pangea_api.c index 6718c92e1..a1f3eb8a6 100755 --- a/iguana/pangea_api.c +++ b/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;