Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
91db614eb7
  1. 2
      iguana/SuperNET.c
  2. 38
      iguana/iguana_instantdex.c
  3. 2
      iguana/iguana_peers.c

2
iguana/SuperNET.c

@ -490,7 +490,7 @@ int32_t iguana_send_supernet(struct iguana_peer *addr,char *jsonstr,int32_t dela
{
if ( 0 && jstr(json,"method") != 0 && strcmp("getpeers",jstr(json,"method")) != 0 )
printf("SUPERSEND -> (%s) (%s) delaymillis.%d datalen.%d checkc.%x\n",jprint(SuperNET_bits2json(&serialized[sizeof(struct iguana_msghdr)],datalen),1),addr->ipaddr,delaymillis,datalen,checkc);
if ( 1 && memcmp(destpub.bytes,GENESIS_PUBKEY.bytes,sizeof(destpub)) == 0 )
if ( memcmp(destpub.bytes,GENESIS_PUBKEY.bytes,sizeof(destpub)) == 0 )
{
qlen = iguana_queue_send(addr,delaymillis,serialized,"SuperNET",datalen+1,0,0);
//printf("send broadcast\n");

38
iguana/iguana_instantdex.c

@ -393,24 +393,6 @@ char *instantdex_sendcmd(struct supernet_info *myinfo,struct instantdex_offer *o
//if ( strcmp(cmdstr,"poll") == 0 )
// return(clonestr("{\"result\":\"skip sending poll\"}"));
//category_subscribe(myinfo,myinfo->instantdex_category,GENESIS_PUBKEY);
str = jprint(argjson,0);
buf = malloc(strlen(str)*2 + 1);
init_hexbytes_noT((char *)buf,(uint8_t *)str,(int32_t)strlen(str));
free(str);
sendjson = cJSON_CreateObject();
jaddstr(sendjson,"hexmsg",(char *)buf);
free(buf);
jaddstr(sendjson,"cmd",cmdstr);
jaddstr(sendjson,"agent","SuperNET");
jaddstr(sendjson,"method","DHT");
jaddstr(sendjson,"handle",myinfo->handle);
jaddnum(sendjson,"plaintext",1);
jaddbits256(sendjson,"categoryhash",myinfo->instantdex_category);
jaddbits256(sendjson,"traderpub",myinfo->myaddr.persistent);
str = jprint(sendjson,1);
basilisk_sendcmd(0,str);
free(str);
return(clonestr("{\"result\":\"success\"}"));
orderhash = instantdex_rwoffer(1,&olen,serialized,offer);
if ( 1 )
@ -478,6 +460,24 @@ char *instantdex_sendcmd(struct supernet_info *myinfo,struct instantdex_offer *o
}
}
free(reqstr);
buf = malloc(datalen*2 + 1);
init_hexbytes_noT((char *)buf,(uint8_t *)msg,datalen);
sendjson = cJSON_CreateObject();
jaddstr(sendjson,"hexmsg",(char *)buf);
free(buf);
jaddstr(sendjson,"cmd",cmdstr);
jaddstr(sendjson,"agent","SuperNET");
jaddstr(sendjson,"method","DHT");
jaddstr(sendjson,"handle",myinfo->handle);
jaddnum(sendjson,"plaintext",1);
jaddbits256(sendjson,"categoryhash",myinfo->instantdex_category);
jaddbits256(sendjson,"traderpub",myinfo->myaddr.persistent);
str = jprint(sendjson,1);
basilisk_sendcmd(0,str);
free(str);
return(clonestr("{\"result\":\"success\"}"));
if ( instantdex_msgcreate(myinfo,msg,datalen) != 0 )
{
//printf(">>>>>>>>>>>> instantdex send.(%s) datalen.%d allocsize.%d crc.%x\n",cmdstr,datalen,msg->sig.allocsize,calc_crc32(0,(void *)((long)msg + 8),datalen-8));
@ -1461,7 +1461,7 @@ char *InstantDEX_hexmsg(struct supernet_info *myinfo,struct category_info *cat,v
free_json(argjson);
return(clonestr("{\"error\":\"string base packets deprecated\"}"));
}
else if ( (signerbits= acct777_validate(&msg->sig,acct777_msgprivkey(serdata,datalen),msg->sig.pubkey)) != 0 || 1 )
else if ( (signerbits= acct777_validate(&msg->sig,acct777_msgprivkey(serdata,datalen),msg->sig.pubkey)) != 0 )
{
flag++;
if ( signerbits == myinfo->myaddr.nxt64bits )

2
iguana/iguana_peers.c

@ -420,7 +420,7 @@ int32_t iguana_send(struct iguana_info *coin,struct iguana_peer *addr,uint8_t *s
}
else if ( addr->msgcounts.verack == 0 && (strcmp(cmdstr,"version") != 0 && strcmp(cmdstr,"ConnectTo") != 0 && strcmp(cmdstr,"verack") != 0) != 0 )
{
printf("skip.(%s) since no verack yet\n",cmdstr);
//printf("skip.(%s) since no verack yet\n",cmdstr);
return(-1);
}
if ( strcmp(cmdstr,"ping") == 0 )

Loading…
Cancel
Save