Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
000ed9badb
  1. 1
      iguana/SuperNET.c
  2. 11
      iguana/SuperNET_category.c
  3. 11
      iguana/SuperNET_hexmsg.c
  4. 1
      iguana/main.c
  5. 1
      iguana/pangea_api.c
  6. 1
      iguana/pangea_json.c
  7. 4
      includes/iguana_apideclares.h

1
iguana/SuperNET.c

@ -625,6 +625,7 @@ int32_t SuperNET_destination(struct supernet_info *myinfo,uint32_t *destipbitsp,
{
if ( category_peer(myinfo,0,*categoryp,*subhashp) > 0 )
destflag |= SUPERNET_ISMINE;
if ( juint(json,"broadcast") > 0 )
destflag |= SUPERNET_FORWARD;
}
if ( remoteaddr == 0 || remoteaddr[0] == 0 || strcmp(remoteaddr,"127.0.0.1") == 0 )

11
iguana/SuperNET_category.c

@ -32,17 +32,18 @@ bits256 calc_categoryhashes(bits256 *subhashp,char *category,char *subcategory)
struct category_info *category_find(bits256 categoryhash,bits256 subhash)
{
struct category_info *cat,*sub = 0;
char str[65]; struct category_info *cat=0,*sub = 0;
HASH_FIND(hh,Categories,categoryhash.bytes,sizeof(categoryhash),cat);
if ( cat != 0 )
{
if ( bits256_nonz(subhash) > 0 && memcmp(GENESIS_PUBKEY.bytes,subhash.bytes,sizeof(subhash)) != 0 )
{
HASH_FIND(hh,cat->sub,subhash.bytes,sizeof(subhash),sub);
if ( sub != 0 )
return(sub);
}
return(cat);
}
} else printf("category_find.(%s) not found\n",bits256_str(str,categoryhash));
return(0);
}
@ -92,10 +93,10 @@ void category_posthexmsg(struct supernet_info *myinfo,bits256 categoryhash,bits2
m->t = now, m->len = len;
decode_hex(m->msg,m->len,hexmsg);
queue_enqueue("categoryQ",Q,&m->DL,0);
char str[65]; printf("HEXMSG.(%s) -> %s.%llx\n",hexmsg,bits256_str(str,categoryhash),(long long)subhash.txid);
char str[65]; printf("POST HEXMSG.(%s) -> %s.%llx\n",hexmsg,bits256_str(str,categoryhash),(long long)subhash.txid);
return;
}
//char str[65]; printf("no subscription for category.(%s) %llx\n",bits256_str(str,categoryhash),(long long)subhash.txid); getchar();
char str[65]; printf("no subscription for category.(%s) %llx\n",bits256_str(str,categoryhash),(long long)subhash.txid);
}
void *category_sub(struct supernet_info *myinfo,bits256 categoryhash,bits256 subhash)
@ -106,6 +107,7 @@ void *category_sub(struct supernet_info *myinfo,bits256 categoryhash,bits256 sub
{
cat = mycalloc('c',1,sizeof(*cat));
cat->hash = hash = categoryhash;
char str[65]; printf("ADD cat.(%s)\n",bits256_str(str,categoryhash));
HASH_ADD(hh,Categories,hash,sizeof(hash),cat);
}
if ( bits256_nonz(subhash) > 0 && memcmp(GENESIS_PUBKEY.bytes,subhash.bytes,sizeof(subhash)) != 0 && cat != 0 )
@ -115,6 +117,7 @@ void *category_sub(struct supernet_info *myinfo,bits256 categoryhash,bits256 sub
{
sub = mycalloc('c',1,sizeof(*sub));
sub->hash = hash = subhash;
char str[65],str2[65]; printf("subadd.(%s) -> (%s)\n",bits256_str(str,hash),bits256_str(str2,categoryhash));
HASH_ADD(hh,cat->sub,hash,sizeof(hash),sub);
}
}

11
iguana/SuperNET_hexmsg.c

@ -57,17 +57,18 @@ int32_t SuperNET_hexmsgfind(struct supernet_info *myinfo,bits256 category,bits25
return(-1);
}
void SuperNET_hexmsgadd(struct supernet_info *myinfo,bits256 category,bits256 subhash,char *hexmsg,struct tai now)
void SuperNET_hexmsgadd(struct supernet_info *myinfo,bits256 categoryhash,bits256 subhash,char *hexmsg,struct tai now)
{
char str[512],str2[65];
if ( memcmp(category.bytes,GENESIS_PUBKEY.bytes,sizeof(category)) == 0 )
str[0] = 0;
if ( memcmp(categoryhash.bytes,GENESIS_PUBKEY.bytes,sizeof(categoryhash)) == 0 )
strcpy(str,"BROADCAST.");
else bits256_str(str,category);
else bits256_str(str+strlen(str),category);
if ( memcmp(subhash.bytes,GENESIS_PUBKEY.bytes,sizeof(subhash)) != 0 )
{
bits256_str(str2,subhash);
strcat(str,str2);
}
category_posthexmsg(myinfo,category,subhash,hexmsg,now);
//printf("HEXMSG.(%s) -> %s\n",hexmsg,str);
category_posthexmsg(myinfo,categoryhash,subhash,hexmsg,now);
printf("HEXMSG.(%s).%llx -> %s\n",hexmsg,(long long)subhash.txid,str);
}

1
iguana/main.c

@ -457,6 +457,7 @@ void iguana_main(void *arg)
if ( IGUANA_NUMHELPERS == 0 )
IGUANA_NUMHELPERS = 1;
category_sub(&MYINFO,GENESIS_PUBKEY,GENESIS_PUBKEY);
category_sub(myinfo,calc_categoryhashes(0,"pangea",0),GENESIS_PUBKEY);
for (i=0; i<IGUANA_NUMHELPERS; i++)
{
sprintf(helperstr,"{\"name\":\"helper.%d\"}",i);

1
iguana/pangea_api.c

@ -296,6 +296,7 @@ void pangea_tablecreate(PANGEA_HANDARGS)
}
else if ( (json= cJSON_Parse((char *)pm->serialized)) != 0 )
{
printf("create table\n");
pangea_gamecreate(&tp->G,pm->sig.timestamp,pm->tablehash,json);
tp->G.creatorbits = pm->sig.signer64bits;
free_json(json);

1
iguana/pangea_json.c

@ -74,6 +74,7 @@ void pangea_gamecreate(struct game_info *gp,uint32_t timestamp,bits256 tablehash
gp->bigblind = jdouble(json,"bigblind") * SATOSHIDEN;
gp->ante = jdouble(json,"ante") * SATOSHIDEN;
gp->opentime = timestamp;
printf("opentime timestamp.%u\n",timestamp);
}
int32_t pangea_opentable(struct game_info *gp)

4
includes/iguana_apideclares.h

@ -159,7 +159,7 @@ STRING_ARG(hash,sha1,message);
STRING_ARG(hash,md2,message);
STRING_ARG(hash,md4,message);
STRING_ARG(hash,md5,message);
STRING_ARG(hash,tiger,message);
STRING_ARG(hash,tiger192,message);
STRING_ARG(hash,whirlpool,message);
TWO_STRINGS(hmac,sha224,message,passphrase);
@ -174,5 +174,5 @@ TWO_STRINGS(hmac,sha1,message,passphrase);
TWO_STRINGS(hmac,md2,message,passphrase);
TWO_STRINGS(hmac,md4,message,passphrase);
TWO_STRINGS(hmac,md5,message,passphrase);
TWO_STRINGS(hmac,tiger,message,passphrase);
TWO_STRINGS(hmac,tiger192,message,passphrase);
TWO_STRINGS(hmac,whirlpool,message,passphrase);

Loading…
Cancel
Save