Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
83f2c281b4
  1. 390
      basilisk/basilisk.c
  2. 9
      basilisk/basilisk.h
  3. 75
      basilisk/basilisk_bitcoin.c
  4. 172
      deprecated/obsolete.h
  5. 6
      iguana/SuperNET.c
  6. 83
      iguana/confs/SYS_hdrs.txt
  7. 27
      iguana/confs/SYS_peers.txt
  8. 4
      iguana/iguana777.h
  9. 8
      iguana/iguana_accept.c
  10. 17
      iguana/iguana_instantdex.c
  11. 547
      iguana/iguana_msg.c
  12. 2
      iguana/iguana_payments.c
  13. 23
      iguana/iguana_peers.c
  14. 2
      iguana/iguana_tx.c
  15. 2
      iguana/main.c

390
basilisk/basilisk.c

@ -37,64 +37,7 @@ char *basilisk_finish(struct basilisk_item *ptr,int32_t besti,char *errstr)
return(retstr); return(retstr);
} }
cJSON *basilisk_json(struct supernet_info *myinfo,cJSON *hexjson,uint32_t basilisktag,int32_t timeout) struct basilisk_item *basilisk_itemcreate(struct supernet_info *myinfo,uint32_t basilisktag,int32_t minresults,cJSON *vals,int32_t timeoutmillis,void *metricfunc)
{
char *str,*buf; cJSON *retjson;
if ( jobj(hexjson,"basilisktag") != 0 )
jdelete(hexjson,"basilisktag");
jaddnum(hexjson,"basilisktag",basilisktag);
str = jprint(hexjson,0);
buf = malloc(strlen(str)*2 + 1);
init_hexbytes_noT(buf,(uint8_t *)str,(int32_t)strlen(str));
free(str);
retjson = cJSON_CreateObject();
jaddstr(retjson,"hexmsg",buf);
free(buf);
jaddstr(retjson,"agent","SuperNET");
jaddstr(retjson,"method","DHT");
jaddnum(retjson,"request",1);
jaddnum(retjson,"plaintext",1);
jaddbits256(retjson,"categoryhash",myinfo->basilisk_category);
jaddnum(retjson,"timeout",timeout);
return(retjson);
}
/*char *basilisk_results(uint32_t basilisktag,cJSON *valsobj)
{
cJSON *resultobj = cJSON_CreateObject();
jadd(resultobj,"vals",valsobj);
jaddstr(resultobj,"agent","basilisk");
jaddstr(resultobj,"method","result");
jaddnum(resultobj,"plaintext",1);
if ( jobj(resultobj,"basilisktag") != 0 )
jdelete(resultobj,"basilisktag");
jaddnum(resultobj,"basilisktag",basilisktag);
return(jprint(resultobj,1));
}
cJSON *basilisk_resultsjson(struct supernet_info *myinfo,char *symbol,char *remoteaddr,uint32_t basilisktag,int32_t timeoutmillis,char *retstr)
{
cJSON *hexjson=0,*retjson=0;
if ( retstr != 0 )
{
if ( remoteaddr != 0 && remoteaddr[0] != 0 )
{
hexjson = cJSON_CreateObject();
jaddstr(hexjson,"agent","basilisk");
jaddstr(hexjson,"method","result");
if ( (retjson= cJSON_Parse(retstr)) != 0 )
jadd(hexjson,"vals",retjson);
retjson = basilisk_json(myinfo,hexjson,basilisktag,timeoutmillis);
free_json(hexjson);
printf("resultsjson.(%s)\n",jprint(retjson,0));
}
else // local request
retjson = cJSON_Parse(retstr);
}
return(retjson);
}*/
struct basilisk_item *basilisk_itemcreate(struct supernet_info *myinfo,uint32_t basilisktag,int32_t minresults,cJSON *vals,int32_t timeoutmillis,void *metricfunc,char *symbol)
{ {
struct basilisk_item *ptr; struct basilisk_item *ptr;
ptr = calloc(1,sizeof(*ptr)); ptr = calloc(1,sizeof(*ptr));
@ -103,59 +46,197 @@ struct basilisk_item *basilisk_itemcreate(struct supernet_info *myinfo,uint32_t
ptr->numrequired = 1; ptr->numrequired = 1;
if ( (ptr->metricfunc= metricfunc) != 0 ) if ( (ptr->metricfunc= metricfunc) != 0 )
ptr->vals = jduplicate(vals); ptr->vals = jduplicate(vals);
strcpy(ptr->symbol,symbol); safecopy(ptr->symbol,jstr(vals,"coin"),sizeof(ptr->symbol));
ptr->expiration = OS_milliseconds() + timeoutmillis; ptr->expiration = OS_milliseconds() + timeoutmillis;
queue_enqueue("submitQ",&myinfo->basilisks.submitQ,&ptr->DL,0); queue_enqueue("submitQ",&myinfo->basilisks.submitQ,&ptr->DL,0);
return(ptr); return(ptr);
} }
#include "basilisk_bitcoin.c" char *basilisk_hexmsg(struct supernet_info *myinfo,struct category_info *dontuse,void *ptr,int32_t len,char *remoteaddr) // incoming
#include "basilisk_nxt.c" {
#include "basilisk_ether.c" char *method="",*agent="",*retstr = 0; cJSON *array,*remotejson,*valsobj; struct iguana_info *coin=0; uint32_t basilisktag;
#include "basilisk_waves.c" array = 0;
#include "basilisk_lisk.c" if ( (remotejson= cJSON_Parse(ptr)) != 0 )
{
//printf("basilisk.(%s)\n",jprint(remotejson,0));
agent = jstr(remotejson,"agent");
method = jstr(remotejson,"method");
basilisktag = juint(remotejson,"basilisktag");
if ( strcmp(agent,"basilisk") == 0 && (valsobj= jobj(remotejson,"vals")) != 0 )
{
if ( jobj(valsobj,"coin") != 0 )
coin = iguana_coinfind(jstr(valsobj,"coin"));
else if ( jstr(remotejson,"activecoin") != 0 )
coin = iguana_coinfind(jstr(remotejson,"activecoin"));
//printf("coin.%p agent.%s method.%s vals.%p\n",coin,agent,method,valsobj);
if ( coin != 0 )
{
if ( coin->RELAYNODE != 0 || coin->VALIDATENODE != 0 )
{
if ( strcmp(method,"rawtx") == 0 )
retstr = basilisk_rawtx(myinfo,coin,0,remoteaddr,basilisktag,valsobj,coin->symbol);
else if ( strcmp(method,"balances") == 0 )
retstr = basilisk_balances(myinfo,coin,0,remoteaddr,basilisktag,valsobj,coin->symbol);
else if ( strcmp(method,"value") == 0 )
retstr = basilisk_value(myinfo,coin,0,remoteaddr,basilisktag,valsobj,coin->symbol);
if ( retstr != 0 )
free(retstr);
return(0);
// should automatically send to remote requester
}
else
{
if ( strcmp(method,"result") == 0 )
return(basilisk_result(myinfo,coin,0,remoteaddr,basilisktag,valsobj));
}
}
}
free_json(remotejson);
}
printf("unhandled bitcoin_hexmsg.(%d) from %s (%s)\n",len,remoteaddr,(char *)ptr);
return(retstr);
}
void basilisk_msgprocess(struct supernet_info *myinfo,struct iguana_peer *addr,uint32_t senderipbits,char *type,uint32_t basilisktag,uint8_t *data,int32_t datalen)
{
cJSON *argjson; char *retstr,*jsonstr,remoteaddr[64];
if ( strcmp(type,"BID") == 0 || strcmp(type,"ASK") == 0 )
{
instantdex_quotep2p(myinfo,0,addr,data,datalen);
}
else if ( (argjson= cJSON_Parse((char *)data)) != 0 )
{
jaddstr(argjson,"agent","basilisk");
jaddnum(argjson,"basilisktag",basilisktag);
if ( strcmp(type,"RET") == 0 )
{
jaddstr(argjson,"method","return");
}
else if ( strcmp(type,"RAW") == 0 )
{
jaddstr(argjson,"method","rawtx");
}
else if ( strcmp(type,"VAL") == 0 )
{
jaddstr(argjson,"method","value");
}
if ( senderipbits != 0 )
expand_ipbits(remoteaddr,senderipbits);
else remoteaddr[0] = 0;
jsonstr = jprint(argjson,1);
if ( (retstr= basilisk_hexmsg(myinfo,0,(void *)jsonstr,(int32_t)strlen(jsonstr)+1,remoteaddr)) != 0 )
free(retstr);
free(jsonstr);
free_json(argjson);
}
}
int32_t basilisk_submit(struct supernet_info *myinfo,cJSON *reqjson,int32_t timeout,int32_t fanout,struct basilisk_item *ptr) int32_t basilisk_sendcmd(struct supernet_info *myinfo,char *destipaddr,char *type,uint32_t basilisktag,int32_t encryptflag,int32_t delaymillis,uint8_t *data,int32_t datalen,int32_t fanout) // data must be offset by sizeof(iguana_msghdr)+sizeof(basilisktag)
{ {
int32_t i,j,k,l,r2,r,n; struct iguana_peer *addr; struct iguana_info *coin; char *reqstr; cJSON *tmpjson; int32_t i,j,r,r2,k,l,val,n=0,retval = -1; char cmd[12]; struct iguana_info *coin; struct iguana_peer *addr;
tmpjson = basilisk_json(myinfo,reqjson,ptr->basilisktag,timeout);
reqstr = jprint(tmpjson,1);
//printf("basilisk_submit.(%s)\n",reqstr);
if ( fanout <= 0 ) if ( fanout <= 0 )
fanout = BASILISK_MINFANOUT; fanout = BASILISK_MINFANOUT;
else if ( fanout > BASILISK_MAXFANOUT ) else if ( fanout > BASILISK_MAXFANOUT )
fanout = BASILISK_MAXFANOUT; fanout = BASILISK_MAXFANOUT;
r2 = rand(); r = rand(), r2 = rand();
for (l=n=0; l<IGUANA_MAXCOINS; l++) if ( type == 0 )
type = "";
if ( strlen(type) > 3 )
{ {
i = (l + r2) % IGUANA_MAXCOINS; printf("basilisk_sendcmd illegal type(%s)\n",type);
if ( (coin= Coins[i]) != 0 ) return(-1);
}
if ( destipaddr != 0 )
{
if ( destipaddr[0] == 0 )
destipaddr = 0; // broadcast
else if ( strcmp(destipaddr,"127.0.0.1") == 0 )
{
basilisk_msgprocess(myinfo,0,0,type,basilisktag,data,datalen);
return(0);
}
}
iguana_rwnum(1,&data[-sizeof(basilisktag)],sizeof(basilisktag),&basilisktag);
data -= sizeof(basilisktag), datalen += sizeof(basilisktag);
memset(cmd,0,sizeof(cmd));
sprintf(cmd,"SuperNET%s",type);
for (k=0; k<IGUANA_MAXCOINS; k++)
{
j = (r2 + k) % IGUANA_MAXCOINS;
if ( (coin= Coins[j]) == 0 )
continue;
for (l=0; l<IGUANA_MAXPEERS; l++)
{ {
r = rand(); i = (l + r) % IGUANA_MAXPEERS;
for (k=0; k<IGUANA_MAXPEERS; k++) if ( (addr= &coin->peers.active[i]) != 0 && addr->usock >= 0 )
{ {
j = (k + r) % IGUANA_MAXPEERS; if ( addr->supernet != 0 && (destipaddr == 0 || strcmp(addr->ipaddr,destipaddr) == 0) )
if ( (addr= &coin->peers.active[j]) != 0 && addr->supernet != 0 && addr->usock >= 0 )
{ {
ptr->submit = (uint32_t)time(NULL); //printf("send back.%s basilisk_result addr->supernet.%u to (%s).%d\n",retstr,addr->supernet,addr->ipaddr,addr->A.port);
printf("submit to (%s)\n",addr->ipaddr); if ( encryptflag != 0 && bits256_nonz(addr->pubkey) != 0 )
iguana_send_supernet(addr,reqstr,0); {
if ( n++ > fanout ) void *ptr; uint8_t *cipher,space[8192]; int32_t cipherlen; bits256 privkey;
break; cmd[6] = 'e', cmd[7] = 't';
memset(privkey.bytes,0,sizeof(privkey));
if ( (cipher= SuperNET_ciphercalc(&ptr,&cipherlen,&privkey,&addr->pubkey,data,datalen,space,sizeof(space))) != 0 )
{
if ( (val= iguana_queue_send(addr,delaymillis,&cipher[-sizeof(struct iguana_msghdr)],cmd,cipherlen)) >= cipherlen )
n++;
if ( ptr != 0 )
free(ptr);
}
}
else
{
cmd[6] = 'E', cmd[7] = 'T';
if ( (val= iguana_queue_send(addr,delaymillis,data,cmd,datalen)) >= datalen )
n++;
}
if ( destipaddr != 0 || n >= fanout )
return(val);
else if ( val > retval )
retval = val;
} }
} }
} }
} }
free(reqstr); return(retval);
return(n); }
void basilisk_p2p(void *_myinfo,void *_addr,int32_t *delaymillisp,char *senderip,uint8_t *data,int32_t datalen,char *type,int32_t encrypted)
{
uint32_t ipbits,basilisktag; int32_t msglen,len=0; void *ptr = 0; uint8_t space[8192]; bits256 senderpub; struct supernet_info *myinfo = _myinfo;
if ( encrypted != 0 )
{
memset(senderpub.bytes,0,sizeof(senderpub));
printf("basilisk_p2p.(%s) from %s\n",type,senderip!=0?senderip:"?");
if ( (data= SuperNET_deciphercalc(&ptr,&msglen,myinfo->privkey,senderpub,data,datalen,space,sizeof(space))) == 0 )
{
printf("basilisk_p2p decrytion error\n");
return;
} else datalen = msglen;
}
if ( senderip != 0 && senderip[0] != 0 && strcmp(senderip,"127.0.0.1") != 0 )
ipbits = (uint32_t)calc_ipbits(senderip);
else ipbits = 0;
len += iguana_rwnum(0,&data[len],sizeof(basilisktag),&basilisktag);
basilisk_msgprocess(myinfo,_addr,ipbits,type,basilisktag,&data[len],datalen - len);
if ( ptr != 0 )
free(ptr);
} }
struct basilisk_item *basilisk_issueremote(struct supernet_info *myinfo,char *methodstr,char *symbol,cJSON *vals,int32_t timeoutmillis,int32_t fanout,int32_t minresults,uint32_t basilisktag,void *_metricfunc,char *retstr) #include "basilisk_bitcoin.c"
#include "basilisk_nxt.c"
#include "basilisk_ether.c"
#include "basilisk_waves.c"
#include "basilisk_lisk.c"
struct basilisk_item *basilisk_issueremote(struct supernet_info *myinfo,char *type,cJSON *valsobj,int32_t fanout,int32_t minresults,uint32_t basilisktag,int32_t timeoutmillis,void *_metricfunc,char *retstr)
{ {
struct basilisk_item *ptr; cJSON *hexjson; basilisk_metricfunc metricfunc = _metricfunc; struct basilisk_item *ptr; uint8_t *data; int32_t datalen,delaymillis=0,encryptflag=0; basilisk_metricfunc metricfunc = _metricfunc;
if ( basilisktag == 0 ) if ( basilisktag == 0 )
basilisktag = rand(); basilisktag = rand();
ptr = basilisk_itemcreate(myinfo,basilisktag,minresults,vals,timeoutmillis,metricfunc,symbol); ptr = basilisk_itemcreate(myinfo,basilisktag,minresults,valsobj,timeoutmillis,metricfunc);
if ( retstr != 0 ) if ( retstr != 0 )
{ {
ptr->retstr = retstr; ptr->retstr = retstr;
@ -166,26 +247,9 @@ struct basilisk_item *basilisk_issueremote(struct supernet_info *myinfo,char *me
} }
else else
{ {
hexjson = cJSON_CreateObject(); data = basilisk_jsondata(&datalen,valsobj,basilisktag);
jaddstr(hexjson,"agent","basilisk"); basilisk_sendcmd(myinfo,0,"RET",basilisktag,encryptflag,delaymillis,data,datalen,0);
jaddnum(hexjson,"basilisktag",basilisktag); free(data);
jaddstr(hexjson,"method",methodstr);
jaddstr(hexjson,"activecoin",symbol);
jaddnum(hexjson,"timeout",timeoutmillis);
if ( vals != 0 )
jadd(hexjson,"vals",jduplicate(vals));
printf("issue.(%s) timeout.%d\n",jprint(hexjson,0),timeoutmillis);
if ( basilisk_submit(myinfo,hexjson,timeoutmillis,fanout,ptr) > 0 )
{
/*if ( timeoutmillis > 0 )
{
printf("unexpected blocking\n");
expiration = OS_milliseconds() + ((timeoutmillis == 0) ? BASILISK_TIMEOUT : timeoutmillis);
while ( OS_milliseconds() < expiration && ptr->finished == 0 && ptr->numresults < ptr->numrequired )
usleep(timeoutmillis/100 + 1);
}*/
}
free_json(hexjson);
} }
return(ptr); return(ptr);
} }
@ -276,39 +340,27 @@ char *basilisk_iscomplete(struct basilisk_item *ptr)
return(retstr); return(retstr);
} }
int32_t basilisk_sendcmd(char *ipaddr,char *msgstr) uint8_t *basilisk_jsondata(int32_t *datalenp,cJSON *sendjson,uint32_t basilisktag)
{ {
int32_t i,j,r,r2,k,l; struct iguana_info *coin; struct iguana_peer *addr; char *sendstr; uint8_t *data; int32_t datalen;
r = rand(), r2 = rand(); sendstr = jprint(sendjson,0);
for (k=0; k<IGUANA_MAXCOINS; k++) datalen = (int32_t)strlen(sendstr) + 1;
{ data = calloc(1,datalen + sizeof(struct iguana_msghdr) + sizeof(basilisktag));
j = (r2 + k) % IGUANA_MAXCOINS; data += sizeof(struct iguana_msghdr) + sizeof(basilisktag);
if ( (coin= Coins[j]) == 0 ) memcpy(data,sendstr,datalen);
continue; free(sendstr);
for (l=0; l<IGUANA_MAXPEERS; l++) *datalenp = datalen;
{ return(data);
i = (l + r) % IGUANA_MAXPEERS;
if ( (addr= &coin->peers.active[i]) != 0 && addr->usock >= 0 )
{
if ( addr->supernet != 0 && (ipaddr == 0 || ipaddr[0] == 0 || strcmp(addr->ipaddr,ipaddr) == 0) )
{
//printf("send back.%s basilisk_result addr->supernet.%u to (%s).%d\n",retstr,addr->supernet,addr->ipaddr,addr->A.port);
return(iguana_send_supernet(addr,msgstr,0));
}
}
}
}
return(-1);
} }
char *basilisk_block(struct supernet_info *myinfo,struct iguana_info *coin,char *remoteaddr,struct basilisk_item *Lptr,struct basilisk_item *ptr) char *basilisk_block(struct supernet_info *myinfo,struct iguana_info *coin,char *remoteaddr,struct basilisk_item *Lptr,struct basilisk_item *ptr)
{ {
char *retstr = 0; cJSON *hexobj,*retjson,*valsobj; char *retstr = 0; uint8_t *data; cJSON *valsobj; int32_t datalen,encryptflag=0,delaymillis=0;
if ( ptr == Lptr ) if ( ptr == Lptr )
{ {
if ( (retstr= Lptr->retstr) == 0 ) if ( (retstr= Lptr->retstr) == 0 )
retstr = clonestr("{\"result\":\"null return from local basilisk_issuecmd\"}"); retstr = clonestr("{\"result\":\"null return from local basilisk_issuecmd\"}");
ptr = basilisk_itemcreate(myinfo,Lptr->basilisktag,Lptr->numrequired,Lptr->vals,OS_milliseconds() - Lptr->expiration,Lptr->metricfunc,Lptr->symbol); ptr = basilisk_itemcreate(myinfo,Lptr->basilisktag,Lptr->numrequired,Lptr->vals,OS_milliseconds() - Lptr->expiration,Lptr->metricfunc);
//printf("block got local.(%s)\n",retstr); //printf("block got local.(%s)\n",retstr);
} }
else else
@ -325,21 +377,15 @@ char *basilisk_block(struct supernet_info *myinfo,struct iguana_info *coin,char
} }
if ( retstr != 0 && remoteaddr != 0 && remoteaddr[0] != 0 && strcmp(remoteaddr,"127.0.0.1") != 0 ) if ( retstr != 0 && remoteaddr != 0 && remoteaddr[0] != 0 && strcmp(remoteaddr,"127.0.0.1") != 0 )
{ {
hexobj = cJSON_CreateObject();
jaddstr(hexobj,"agent","basilisk");
jaddstr(hexobj,"method","result");
jaddnum(hexobj,"basilisktag",ptr->basilisktag);
if ( (valsobj= cJSON_Parse(retstr)) != 0 ) if ( (valsobj= cJSON_Parse(retstr)) != 0 )
{ {
if ( jobj(valsobj,"coin") == 0 ) if ( jobj(valsobj,"coin") == 0 )
jaddstr(valsobj,"coin",ptr->symbol); jaddstr(valsobj,"coin",ptr->symbol);
jadd(hexobj,"vals",valsobj); data = basilisk_jsondata(&datalen,valsobj,ptr->basilisktag);
basilisk_sendcmd(myinfo,remoteaddr,"RET",ptr->basilisktag,encryptflag,delaymillis,data,datalen,0);
free(data);
free_json(valsobj);
} }
retjson = basilisk_json(myinfo,hexobj,ptr->basilisktag,0);
free_json(hexobj);
free(retstr);
retstr = jprint(retjson,1);
basilisk_sendcmd(remoteaddr,retstr);
} }
return(retstr); return(retstr);
} }
@ -466,68 +512,6 @@ INT_AND_ARRAY(basilisk,result,basilisktag,vals)
} }
#include "../includes/iguana_apiundefs.h" #include "../includes/iguana_apiundefs.h"
char *basilisk_hexmsg(struct supernet_info *myinfo,struct category_info *cat,void *ptr,int32_t len,char *remoteaddr) // incoming
{
char *method="",*agent="",*retstr = 0,*tmpstr,*hexmsg; int32_t n; cJSON *array,*remotejson,*valsobj; struct iguana_info *coin=0; uint32_t basilisktag;
array = 0;
if ( (remotejson= cJSON_Parse(ptr)) != 0 )
{
//printf("basilisk.(%s)\n",jprint(remotejson,0));
agent = jstr(remotejson,"agent");
method = jstr(remotejson,"method");
if ( agent != 0 && method != 0 && strcmp(agent,"SuperNET") == 0 && strcmp(method,"DHT") == 0 && (hexmsg= jstr(remotejson,"hexmsg")) != 0 )
{
n = (int32_t)(strlen(hexmsg) >> 1);
tmpstr = calloc(1,n + 1);
decode_hex((void *)tmpstr,n,hexmsg);
free_json(remotejson);
printf("NESTED.(%s)\n",tmpstr);
if ( (remotejson= cJSON_Parse(tmpstr)) == 0 )
{
printf("couldnt parse decoded hexmsg.(%s)\n",tmpstr);
free(tmpstr);
return(0);
}
free(tmpstr);
agent = jstr(remotejson,"agent");
method = jstr(remotejson,"method");
}
basilisktag = juint(remotejson,"basilisktag");
if ( strcmp(agent,"basilisk") == 0 && (valsobj= jobj(remotejson,"vals")) != 0 )
{
if ( jobj(valsobj,"coin") != 0 )
coin = iguana_coinfind(jstr(valsobj,"coin"));
else if ( jstr(remotejson,"activecoin") != 0 )
coin = iguana_coinfind(jstr(remotejson,"activecoin"));
//printf("coin.%p agent.%s method.%s vals.%p\n",coin,agent,method,valsobj);
if ( coin != 0 )
{
if ( coin->RELAYNODE != 0 || coin->VALIDATENODE != 0 )
{
if ( strcmp(method,"rawtx") == 0 )
retstr = basilisk_rawtx(myinfo,coin,0,remoteaddr,basilisktag,valsobj,coin->symbol);
else if ( strcmp(method,"balances") == 0 )
retstr = basilisk_balances(myinfo,coin,0,remoteaddr,basilisktag,valsobj,coin->symbol);
else if ( strcmp(method,"value") == 0 )
retstr = basilisk_value(myinfo,coin,0,remoteaddr,basilisktag,valsobj,coin->symbol);
if ( retstr != 0 )
free(retstr);
return(0);
// should automatically send to remote requester
}
else
{
if ( strcmp(method,"result") == 0 )
return(basilisk_result(myinfo,coin,0,remoteaddr,basilisktag,valsobj));
}
}
}
free_json(remotejson);
}
printf("unhandled bitcoin_hexmsg.(%d) from %s (%s)\n",len,remoteaddr,(char *)ptr);
return(retstr);
}
void basilisks_loop(void *arg) void basilisks_loop(void *arg)
{ {
basilisk_metricfunc metricfunc; struct basilisk_item *ptr,*tmp,*pending,*parent; int32_t i,iter,flag,n; struct supernet_info *myinfo = arg; basilisk_metricfunc metricfunc; struct basilisk_item *ptr,*tmp,*pending,*parent; int32_t i,iter,flag,n; struct supernet_info *myinfo = arg;

9
basilisk/basilisk.h

@ -39,8 +39,13 @@ struct basilisk_info
struct basilisk_value values[8192]; int32_t numvalues; struct basilisk_value values[8192]; int32_t numvalues;
}; };
struct basilisk_item *basilisk_issueremote(struct supernet_info *myinfo,char *methodstr,char *symbol,cJSON *vals,int32_t timeoutmillis,int32_t fanout,int32_t minresults,uint32_t basilisktag,void *metricfunc,char *retstr); struct basilisk_item *basilisk_issueremote(struct supernet_info *myinfo,char *type,cJSON *vals,int32_t fanout,int32_t minresults,uint32_t basilisktag,int32_t timeoutmillis,void *metricfunc,char *retstr);
void basilisks_init(struct supernet_info *myinfo); void basilisks_init(struct supernet_info *myinfo);
int32_t basilisk_sendcmd(char *ipaddr,char *msgstr); int32_t basilisk_sendcmd(struct supernet_info *myinfo,char *destipaddr,char *type,uint32_t basilisktag,int32_t encryptflag,int32_t delaymillis,uint8_t *data,int32_t datalen,int32_t fanout); // data must be offset by sizeof(iguana_msghdr)
void basilisk_p2p(void *myinfo,void *_addr,int32_t *delaymillisp,char *ipaddr,uint8_t *data,int32_t datalen,char *type,int32_t encrypted);
uint8_t *basilisk_jsondata(int32_t *datalenp,cJSON *sendjson,uint32_t basilisktag);
uint8_t *SuperNET_ciphercalc(void **ptrp,int32_t *cipherlenp,bits256 *privkeyp,bits256 *destpubkeyp,uint8_t *data,int32_t datalen,uint8_t *space2,int32_t space2size);
void *SuperNET_deciphercalc(void **ptrp,int32_t *msglenp,bits256 privkey,bits256 srcpubkey,uint8_t *cipher,int32_t cipherlen,uint8_t *buf,int32_t bufsize);
#endif #endif

75
basilisk/basilisk_bitcoin.c

@ -301,82 +301,18 @@ int32_t basilisk_bitcoinavail(struct iguana_info *coin)
void *basilisk_bitcoinbalances(struct basilisk_item *Lptr,struct supernet_info *myinfo,struct iguana_info *coin,char *remoteaddr,uint32_t basilisktag,int32_t timeoutmillis,cJSON *vals) void *basilisk_bitcoinbalances(struct basilisk_item *Lptr,struct supernet_info *myinfo,struct iguana_info *coin,char *remoteaddr,uint32_t basilisktag,int32_t timeoutmillis,cJSON *vals)
{ {
/* cJSON *array=0,*result,*item,*retjson,*hexjson; int32_t i,n,besti=-1; char *coinaddr,*balancestr=0,*retstr=0; int64_t total=0,amount,most=0; struct basilisk_item *ptr;
array = cJSON_CreateArray();
if ( coin != 0 && basilisk_bitcoinavail(coin) != 0 )
{
if ( (n= cJSON_GetArraySize(addresses)) > 0 )
{
for (i=0; i<n; i++)
{
coinaddr = jstri(addresses,i);
if ( coin->VALIDATENODE != 0 || coin->RELAYNODE != 0 )
balancestr = iguana_balance(myinfo,coin,0,remoteaddr,coin->symbol,coinaddr,lastheight,minconf);
//else balancestr = bitcoin_balance(coin,coinaddr,lastheight,minconf);
if ( balancestr != 0 )
{
if ( (result= cJSON_Parse(balancestr)) != 0 )
{
if ( jobj(result,"balance") != 0 )
{
item = cJSON_CreateObject();
amount = SATOSHIDEN * jdouble(result,"balance");
total += amount;
jaddnum(item,coinaddr,dstr(amount));
jaddi(array,item);
}
free_json(result);
}
free(balancestr);
}
}
}
}
else
{
hexjson = cJSON_CreateObject();
jaddnum(hexjson,"basilisktag",basilisktag);
jadd(hexjson,"addresses",jduplicate(addresses));
jaddnum(hexjson,"minconf",minconf);
jaddnum(hexjson,"lastheight",lastheight);
jaddstr(hexjson,"agent","basilisk");
jaddstr(hexjson,"method","balances");
if ( (ptr= basilisk_issue(myinfo,hexjson,timeoutmillis,0,1,basilisktag)) != 0 )
{
for (i=0; i<ptr->numresults; i++)
{
if ( ptr->results[i] == 0 )
continue;
if ( retstr != 0 && strcmp(ptr->results[i],retstr) == 0 )
ptr->numexact++;
if ( (retjson= cJSON_Parse(ptr->results[i])) != 0 )
{
if ( (total= j64bits(retjson,"balance")) > most )
{
most = total;
besti = i;
}
free_json(retjson);
}
}
retstr = basilisk_finish(ptr,arrayp,besti);
}
free_json(hexjson);
}
*arrayp = array;
return(most);*/
return(0); return(0);
} }
char *basilisk_valuestr(struct iguana_info *coin,char *coinaddr,uint64_t value,int32_t height,bits256 txid,int16_t vout) char *basilisk_valuestr(struct iguana_info *coin,char *coinaddr,uint64_t value,int32_t height,bits256 txid,int16_t vout)
{ {
cJSON *retjson = cJSON_CreateObject(); cJSON *retjson = cJSON_CreateObject();
jaddnum(retjson,"result",dstr(value));
jaddstr(retjson,"address",coinaddr); jaddstr(retjson,"address",coinaddr);
jadd64bits(retjson,"satoshis",value); jadd64bits(retjson,"satoshis",value);
jaddnum(retjson,"height",height); jaddnum(retjson,"height",height);
jaddbits256(retjson,"txid",txid); jaddbits256(retjson,"txid",txid);
jaddnum(retjson,"vout",vout); jaddnum(retjson,"vout",vout);
jaddstr(retjson,"coin",coin->symbol);
return(jprint(retjson,1)); return(jprint(retjson,1));
} }
@ -426,12 +362,14 @@ void *basilisk_bitcoinvalue(struct basilisk_item *Lptr,struct supernet_info *myi
if ( v->vout == vout && bits256_cmp(txid,v->txid) == 0 && strcmp(v->coinaddr,coinaddr) == 0 ) if ( v->vout == vout && bits256_cmp(txid,v->txid) == 0 && strcmp(v->coinaddr,coinaddr) == 0 )
{ {
printf("bitcoinvalue local ht.%d %s %.8f\n",v->height,v->coinaddr,dstr(v->value)); printf("bitcoinvalue local ht.%d %s %.8f\n",v->height,v->coinaddr,dstr(v->value));
return(basilisk_issueremote(myinfo,"value",coin->symbol,valsobj,timeoutmillis,juint(valsobj,"fanout"),juint(valsobj,"minresults"),basilisktag,coin->basilisk_valuemetric,basilisk_valuestr(coin,v->coinaddr,v->value,v->height,txid,vout))); Lptr->retstr = basilisk_valuestr(coin,v->coinaddr,v->value,v->height,txid,vout);
return(Lptr);
//return(basilisk_issueremote(myinfo,"VAL",valsobj,juint(valsobj,"fanout"),juint(valsobj,"minresults"),basilisktag,coin->basilisk_valuemetric,basilisk_valuestr(coin,v->coinaddr,v->value,v->height,txid,vout)));
} }
} }
} }
printf("bitcoinvalue issue remote\n"); printf("bitcoinvalue issue remote\n");
return(basilisk_issueremote(myinfo,"value",coin->symbol,valsobj,timeoutmillis,juint(valsobj,"fanout"),juint(valsobj,"minresults"),basilisktag,coin->basilisk_valuemetric,0)); return(basilisk_issueremote(myinfo,"VAL",valsobj,juint(valsobj,"fanout"),juint(valsobj,"minresults"),basilisktag,timeoutmillis,coin->basilisk_valuemetric,0));
} }
double basilisk_bitcoin_rawtxmetric_dependents(struct supernet_info *myinfo,struct iguana_info *coin,struct basilisk_item *ptr,struct bitcoin_rawtxdependents *dependents) double basilisk_bitcoin_rawtxmetric_dependents(struct supernet_info *myinfo,struct iguana_info *coin,struct basilisk_item *ptr,struct bitcoin_rawtxdependents *dependents)
@ -679,6 +617,7 @@ void *basilisk_bitcoinrawtx(struct basilisk_item *Lptr,struct supernet_info *myi
valsobj = cJSON_CreateObject(); valsobj = cJSON_CreateObject();
jadd(valsobj,"vins",vins); jadd(valsobj,"vins",vins);
jaddstr(valsobj,"rawtx",rawtx); jaddstr(valsobj,"rawtx",rawtx);
jaddstr(valsobj,"coin",coin->symbol);
free(rawtx); free(rawtx);
Lptr->retstr = jprint(valsobj,1); Lptr->retstr = jprint(valsobj,1);
return(Lptr); return(Lptr);
@ -691,6 +630,6 @@ void *basilisk_bitcoinrawtx(struct basilisk_item *Lptr,struct supernet_info *myi
Lptr->retstr = clonestr("{\"error\":\"couldnt create rawtx\"}"); Lptr->retstr = clonestr("{\"error\":\"couldnt create rawtx\"}");
return(Lptr); return(Lptr);
} }
return(basilisk_issueremote(myinfo,"rawtx",coin->symbol,valsobj,timeoutmillis,juint(valsobj,"fanout"),juint(valsobj,"minresults"),basilisktag,coin->basilisk_rawtxmetric,0)); return(basilisk_issueremote(myinfo,"RAW",valsobj,juint(valsobj,"fanout"),juint(valsobj,"minresults"),basilisktag,timeoutmillis,coin->basilisk_rawtxmetric,0));
} }

172
deprecated/obsolete.h

@ -17058,6 +17058,178 @@ len = 0;
return(retstr); return(retstr);
} }
int32_t basilisk_submit(struct supernet_info *myinfo,cJSON *reqjson,int32_t timeout,int32_t fanout,struct basilisk_item *ptr)
{
int32_t i,j,k,l,r2,r,n; struct iguana_peer *addr; struct iguana_info *coin; char *reqstr; cJSON *tmpjson;
tmpjson = basilisk_json(myinfo,reqjson,ptr->basilisktag,timeout);
reqstr = jprint(tmpjson,1);
//printf("basilisk_submit.(%s)\n",reqstr);
if ( fanout <= 0 )
fanout = BASILISK_MINFANOUT;
else if ( fanout > BASILISK_MAXFANOUT )
fanout = BASILISK_MAXFANOUT;
r2 = rand();
for (l=n=0; l<IGUANA_MAXCOINS; l++)
{
i = (l + r2) % IGUANA_MAXCOINS;
if ( (coin= Coins[i]) != 0 )
{
r = rand();
for (k=0; k<IGUANA_MAXPEERS; k++)
{
j = (k + r) % IGUANA_MAXPEERS;
if ( (addr= &coin->peers.active[j]) != 0 && addr->supernet != 0 && addr->usock >= 0 )
{
ptr->submit = (uint32_t)time(NULL);
printf("submit to (%s)\n",addr->ipaddr);
iguana_send_supernet(addr,reqstr,0);
if ( n++ > fanout )
break;
}
}
}
}
free(reqstr);
return(n);
}
/*cJSON *basilisk_json(struct supernet_info *myinfo,cJSON *hexjson,uint32_t basilisktag,int32_t timeout)
{
char *str,*buf; cJSON *retjson;
if ( jobj(hexjson,"basilisktag") != 0 )
jdelete(hexjson,"basilisktag");
jaddnum(hexjson,"basilisktag",basilisktag);
str = jprint(hexjson,0);
buf = malloc(strlen(str)*2 + 1);
init_hexbytes_noT(buf,(uint8_t *)str,(int32_t)strlen(str));
free(str);
retjson = cJSON_CreateObject();
jaddstr(retjson,"hexmsg",buf);
free(buf);
jaddstr(retjson,"agent","SuperNET");
jaddstr(retjson,"method","DHT");
jaddnum(retjson,"request",1);
jaddnum(retjson,"plaintext",1);
jaddbits256(retjson,"categoryhash",myinfo->basilisk_category);
jaddnum(retjson,"timeout",timeout);
return(retjson);
}
char *basilisk_results(uint32_t basilisktag,cJSON *valsobj)
{
cJSON *resultobj = cJSON_CreateObject();
jadd(resultobj,"vals",valsobj);
jaddstr(resultobj,"agent","basilisk");
jaddstr(resultobj,"method","result");
jaddnum(resultobj,"plaintext",1);
if ( jobj(resultobj,"basilisktag") != 0 )
jdelete(resultobj,"basilisktag");
jaddnum(resultobj,"basilisktag",basilisktag);
return(jprint(resultobj,1));
}
cJSON *basilisk_resultsjson(struct supernet_info *myinfo,char *symbol,char *remoteaddr,uint32_t basilisktag,int32_t timeoutmillis,char *retstr)
{
cJSON *hexjson=0,*retjson=0;
if ( retstr != 0 )
{
if ( remoteaddr != 0 && remoteaddr[0] != 0 )
{
hexjson = cJSON_CreateObject();
jaddstr(hexjson,"agent","basilisk");
jaddstr(hexjson,"method","result");
if ( (retjson= cJSON_Parse(retstr)) != 0 )
jadd(hexjson,"vals",retjson);
retjson = basilisk_json(myinfo,hexjson,basilisktag,timeoutmillis);
free_json(hexjson);
printf("resultsjson.(%s)\n",jprint(retjson,0));
}
else // local request
retjson = cJSON_Parse(retstr);
}
return(retjson);
}*/
/* cJSON *array=0,*result,*item,*retjson,*hexjson; int32_t i,n,besti=-1; char *coinaddr,*balancestr=0,*retstr=0; int64_t total=0,amount,most=0; struct basilisk_item *ptr;
array = cJSON_CreateArray();
if ( coin != 0 && basilisk_bitcoinavail(coin) != 0 )
{
if ( (n= cJSON_GetArraySize(addresses)) > 0 )
{
for (i=0; i<n; i++)
{
coinaddr = jstri(addresses,i);
if ( coin->VALIDATENODE != 0 || coin->RELAYNODE != 0 )
balancestr = iguana_balance(myinfo,coin,0,remoteaddr,coin->symbol,coinaddr,lastheight,minconf);
//else balancestr = bitcoin_balance(coin,coinaddr,lastheight,minconf);
if ( balancestr != 0 )
{
if ( (result= cJSON_Parse(balancestr)) != 0 )
{
if ( jobj(result,"balance") != 0 )
{
item = cJSON_CreateObject();
amount = SATOSHIDEN * jdouble(result,"balance");
total += amount;
jaddnum(item,coinaddr,dstr(amount));
jaddi(array,item);
}
free_json(result);
}
free(balancestr);
}
}
}
}
else
{
hexjson = cJSON_CreateObject();
jaddnum(hexjson,"basilisktag",basilisktag);
jadd(hexjson,"addresses",jduplicate(addresses));
jaddnum(hexjson,"minconf",minconf);
jaddnum(hexjson,"lastheight",lastheight);
jaddstr(hexjson,"agent","basilisk");
jaddstr(hexjson,"method","balances");
if ( (ptr= basilisk_issue(myinfo,hexjson,timeoutmillis,0,1,basilisktag)) != 0 )
{
for (i=0; i<ptr->numresults; i++)
{
if ( ptr->results[i] == 0 )
continue;
if ( retstr != 0 && strcmp(ptr->results[i],retstr) == 0 )
ptr->numexact++;
if ( (retjson= cJSON_Parse(ptr->results[i])) != 0 )
{
if ( (total= j64bits(retjson,"balance")) > most )
{
most = total;
besti = i;
}
free_json(retjson);
}
}
retstr = basilisk_finish(ptr,arrayp,besti);
}
free_json(hexjson);
}
*arrayp = array;
return(most);*/
if ( agent != 0 && method != 0 && strcmp(agent,"SuperNET") == 0 && strcmp(method,"DHT") == 0 && (hexmsg= jstr(remotejson,"hexmsg")) != 0 )
{
n = (int32_t)(strlen(hexmsg) >> 1);
tmpstr = calloc(1,n + 1);
decode_hex((void *)tmpstr,n,hexmsg);
free_json(remotejson);
printf("NESTED.(%s)\n",tmpstr);
if ( (remotejson= cJSON_Parse(tmpstr)) == 0 )
{
printf("couldnt parse decoded hexmsg.(%s)\n",tmpstr);
free(tmpstr);
return(0);
}
free(tmpstr);
agent = jstr(remotejson,"agent");
method = jstr(remotejson,"method");
}
#endif #endif
#endif #endif

6
iguana/SuperNET.c

@ -164,7 +164,7 @@ void *SuperNET_deciphercalc(void **ptrp,int32_t *msglenp,bits256 privkey,bits256
if ( bits256_nonz(srcpubkey) == 0 ) if ( bits256_nonz(srcpubkey) == 0 )
{ {
memcpy(srcpubkey.bytes,cipher,sizeof(srcpubkey)); memcpy(srcpubkey.bytes,cipher,sizeof(srcpubkey));
//char str[65]; printf("use attached pubkey.(%s)\n",bits256_str(str,srcpubkey)); char str[65]; printf("use attached pubkey.(%s)\n",bits256_str(str,srcpubkey));
cipher += sizeof(srcpubkey); cipher += sizeof(srcpubkey);
cipherlen -= sizeof(srcpubkey); cipherlen -= sizeof(srcpubkey);
} }
@ -492,7 +492,7 @@ int32_t iguana_send_supernet(struct iguana_peer *addr,char *jsonstr,int32_t dela
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); 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 ( 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); qlen = iguana_queue_send(addr,delaymillis,serialized,"SuperNET",datalen+1);
//printf("send broadcast\n"); //printf("send broadcast\n");
} }
else else
@ -509,7 +509,7 @@ int32_t iguana_send_supernet(struct iguana_peer *addr,char *jsonstr,int32_t dela
printf("encrypted mypriv.%llx destpub.%llx\n",(long long)privkey.txid,(long long)destpub.txid); printf("encrypted mypriv.%llx destpub.%llx\n",(long long)privkey.txid,(long long)destpub.txid);
} // else printf("decrypted\n"); } // else printf("decrypted\n");
//printf("send to (%s)\n",addr->ipaddr); //printf("send to (%s)\n",addr->ipaddr);
qlen = iguana_queue_send(addr,delaymillis,&cipher[-sizeof(struct iguana_msghdr)],"SuperNETb",cipherlen,0,0); qlen = iguana_queue_send(addr,delaymillis,&cipher[-sizeof(struct iguana_msghdr)],"SuperNETb",cipherlen);
if ( ptr != 0 ) if ( ptr != 0 )
free(ptr); free(ptr);
} }

83
iguana/confs/SYS_hdrs.txt

@ -0,0 +1,83 @@
40503
0 0000072d66e51ab87de265765cc8bdd2d229a4307c672a1b3d5af692519cf765 e8b81e2aface344e9e37bc97bedcf5cca2aa5d2c136150d7816b32f0d77a612f 00000ddd21c846f0bd83fc70f0503544f8779b6953e1ef30e3442c8de24a242f
500 fa79861e076377878c0939c724daf44b9407983bb846dd169609803bedc3bc05 0fb6c4f5cf8048a02313eb83d135cf5e77fbfdf2b7d5658e243414434e976c83 62ace40fb7acf7a267ff5fda224db29b0b5061639f0bc7ca02b4c7c3796ea34e
1000 f7ed3c9a5879f7539cff5419d8104f9e7d4991ce6a473e57e20ff1b3128784a3 6118ef801c629b7f6246f9814f074e83d15db40d4659953d42159ba8b2c307f1 11409120c632957a4f0003eda2528d1af668ddc4a08f42f23e57cdee75b38b7d
1500 0beeef46b5cc8696cab8e44d89f522218d3c79964c12e219f6e824957d56b464 ccd5da5b405830053eb0cbd823ce98c128f807847f2ce2232c520f74088b1558 ddc9a2421cfbe49bb121551a2c2e7b472ae10cbecb8c71ce364e5d183e17c765
2000 177d59135fdaacffcc7f0c5a55ba21410d8a7f3949c7f70bbbf60bf5480f936f a2fa1fa4e7351603281fdd69019357a042c6dd43e26243ca1c097c66eb26be13 9072c4e219440d5726662b589c388e64083a584b2cde8d43bfbc4d6c9c4cfe94
2500 67ffcb7b11d838b6dc6d28e6813471759ae9e4edaeb14707380484df421d2dba 7855f66d714a6b5daf076753f027733ee785545deb6d4f53311387db46c82e85 9674242b8384ccbc49ec71383f058a5d1ed20a8ba72063926832e1ec7855f55b
3000 a8df24c51242d0c1d353d70c4e4ef316b467457a1d19428e1a9bbecf159d8b69 c2c6b5514c21e296441bd7eb444e976042bfa75a3670fba0714bb222d77f4de7 ecc16c1c3eb819ba740597c96eba515a7474e2f6dddb70cd6fe1eb51a1136579
3500 f73baae6133ddd3e1277005148a48da4c9f360f62f4e43ffd6e70701c2085202 11910dbdd14cec9f51fd1a5233782fcb98610c46f39176f716b875e7b429ad2e dd059c2044bd9a7ba25dd3125e24e2c396022b1a446eb68d6ec0f7d81d8d2f4c
4000 f0ca176b56b5049f64c2cdb15ec253d698f5804ac5bebd1a54a7b1fb57b8a95b 58ba6fc2bb5fa640e405c184b2b4ceff3cb92e939f3c70b64e3c36969c0dddb0 60670221d1e61416ced153715d468bc007fdcc6244a2af80a840008e3da5d7f8
4500 5dfb112bc62ecba929d227947b1d0cbcdf17fd0abefa59880d6a6c3d8a888420 38bff7b10085c82b0a7c995a77caa91686a042f5f6eacf4814b41ca3852906c1 6b8298d258165c85c71e99df73cd539e11d1490e787ee2fa199e739f3595e705
5000 0690f2ef5a50b5179fec7df880fc697187790748920826ac88c689ebc6d8ca8e 8b64e2840cbc6cb0f5d8040b1b897bbd9a589a597230aed3b3a564fcffc6670a 8fe42c6cd592cce325acb363fb23a4001d6f36f390c504a08142ce80dcbfb4b2
5500 a4f07cd5dbe444df9432a4b5b3a4ec749cb911ac047ec8d411af510e8fddc0b3 1b7aadd77efbf455a2762c93f188094db46ac611ddeb5c42d89c0be4bbadc5f8 2a9f90900cfef739ba422dadcc831019be0ffdfaab326313e3db1506a79e093d
6000 de4fb22629b591e55ec70761209e90a5e344994ab776311edd64e523fefe0c21 7bec997c9fdc5a3e0d1731b67dd4b1843103dd8cffe27b15c17ddde9512b8dfa ef9e66610cba2b6109998ad90f1788a7367cf1105ce9ab09a1e69a0b820101ad
6500 81a3fcae2704cf3479c2b561ae456a93efb1ca5fa90233a9a4424fe5c0aa351b a89254d7960e6c324021eb8037af9f7c4390d6d92c121c7f6ecddd808945e3e8 9909ff4d9dd7b7b3d6ed659952ae9db3761f14d6cb789ff1e28d18eb961ec9f8
7000 c2acef78393e78aed7ed8711736fd90907643e8db804024444a4865d1c15ec59 9538166baa0e7824fbe2095b4e369843014f9ec2232544178d3ffcc8410e6709 5b02307a5f79a7c1b22f0c262ad837b361e90b43bd03192372803c2053e06714
7500 c8597562c4d5767f19f2847b57860a2296cdd56339123bed3bd849d231122ceb e5455bcc8e33699163de1ab6e96c6315b1176b56899a310c97577530405f87f1 71f13e2070d20d64ea90b4f3adbc2c90ec8b0bb4f99d93ea565aa0984bb30dc4
8000 132fd7654f0401f3050671a9b722f9dceefbc85a83400ba322deac9b499cd8b2 b4929785533ee58ce4f4c7093325ce0806288794498dc43acfddc75f5713f1c4 29488016109e1b83c84fa450006c5428e0f15cc3d6722875ececb0e024eb43bb
8500 a2195f8491123bf5d06119cc989e0b812a07e14190d542450cb2775fa1268ea7 b760ca0e2ae365d8bdba34a236bbda82aaaeb2f5d9d401120f92fe137a577d30 f259b7e915551b7a89ff3e4dfc5797722f7779d554fd2fee0652cb1320259f7b
9000 e886970f09959c4e233710747bb432cebd75c112ab2847c40412bc5c92dc057b 646e7502bb25191a06ae7fdc0cebed07ad3267dd789f15e51ae48fca6e97ada7 9936cc8b58db522e9ee70b50e9affbca51db4613781fa9c994d8bec88b439190
9500 de80fa64e663fda56d387cb6ec45953c448cbe284ee0b470e97ceb84cd522cfc 6c7d8eb2b3ae1fc9e23fbf31c6e9929b5dc57c451d0b09af94a1c732454d9465 4b0ec07cd40b0c79122cad3b2eb3d7c7de13bc13cf6263880fb9be5f774a4d3b
10000 45e9c45102be0767d4e8be3933af8dfc20e4be61003dcb6f34a8cd21cac744de 1a41ea1f389139eb54845837d25b16ca77416e7a0d8281855cad573f02294192 018a3fc6b2d0fd6468749c4e4608558e4a13dcc3bd6c1338c2b6335d5c965edb
10500 466c06897be76a8b606e98ffa13ef349f5c4ee7489b240038a17d4dfe13d2b57 2be4b8065d74f883342503595bad48d33c889bb0989caf3a9d350da776a0c9ef 61990d8c4f641dab727af195b3a90a7b4128addb0e27db4aca4d190a83eb23af
11000 eccc9702f708d70f6f9d259db6c2dcfabd8a9bef6fcef4238b170ac8fa658181 5fa35c88428d21c6df628704799c1fbeb1d6b56375605b2c60e4fced2e817532 59f9842954b693b34e41013d8b33506cb92ac7964c3aad0e758c96c1d32bf336
11500 5f4c3777ec5634db2f2fb12ee17fd6fec416bd3c912b7ef4b46b9f001f155652 ce2db5f98415549acea46e5f16a5b61aced4cd7a872b9bcd43f4e37579e9a405 420443e9389ce8e15ae4b24e01801023a096fb84105bbfb1b93b980242ba4ca0
12000 5ae40e4a0760eb6fbc2f18f13733d074fd0449dd4cb60422e157b3d5241f03fc 27eb7e587706776a7713ee24f9bac463bb111f4edba1ca2b40d8cd3425e25781 88cd1959037a5f611aebfe33c6a927a12ef7d96bb4c39b1ffd928729d9abb2b5
12500 540c527967d466016ef565bfa28d3fe31b24ca1433589efca84b30172628e672 dbb02226e70e90e65c4599c0ded9f2c5596e389f0bfdf648e25c35e92f7fc867 ca7d66d6b7148cd51f2e8550fc28cc40ada4caaf6b11d7d45c3c517b665ad487
13000 e93df24ce023b71a558b735e9a99c3c8b21c9ee2db022a33a90ae73c47c8645c 898d7f6b82cb09cadd5342e1adaeb6759f8f6ffad5c59ea8f916e17d7742ce3b 6be69ba7606362c518583e50ce37b77bf42bbffe096b40ebf9efe0d8e2793979
13500 6fb565932932a9630592b0a07426a7be1e85a1683c8eb20a1e7af9407df8cede e14d3d8a61613cd9831e868f17355d4be060d1666aa14bceeb8ff2703a2541ad 636301b57f6c634769232e920b4c592c21c70e693224a69e168d203f3067be70
14000 98159d9d969254ce61596279ba194a3676d0e89c12e01cd2db074b6446a3afb2 2ca24dcd514a091d0bd51317171f4cf887260bdaab826e65405ba546d1d30bdd 4c4f4705381a8fb6a15bbf14c1147b8e59bc8cc619b4f3620fb7c3f2b5576daa
14500 291c3cc81cdd88a12384a85f8ef010fb951f87d27d258c8b2caad81c6da62508 3c7d0f989d8f4af47574b94b3404334fa6ec4bdb12e09188e79569e0db44579b 222b622494594d3daeb68a5f170d2422f414f6fc2f67555e0bc04c0aaf34c0c4
15000 c65efef1bbb2aff501a836876c6351b01b5ad132622fbe50302f8dd192888037 aca17d2240118c7c8f4cf6a5d8d2f1725880f04d975decebf578bf62afb35642 1016410d46785c171ce699549ec674699cd967190deea12d929f0f4f7e5d062e
15500 31c4d232331bf639d1b739f9fd3bd69d89e7e161b60d70f1386cff78bdd9a8ca 1b71028803e2c752793443d5e6ea7c9e37acc2d601f9e80b4b67db7f101be016 df3c1bcd882fa2e185cf3cc3f7aa67fd6e58ab8fc96f4503c5dc57c016d7950b
16000 401e0069109c8998a09e012038492c197e16331c09f930da957713d908baf958 05d6d2d328c0f9e58cba6694c92af62d6149d178cb703c8042843af036f445c5 7fee64c96a21c0a8435cee8c9b19e475f77c27b96570d6acfd0c6f52bcc8af5d
16500 6d48f6153e3400e86a9e933e7b7f2155a6076759c1ab2b22e7c8a58ea4f6b1bd 321cd6206367f4bf7d19e15d1afccaf5bd6fd0967f42b79b517af7a6d2086a1a 88e194c0a5a6edf82cf17d6eaab33bad5f0b53f3ed66990241d28c986b921944
17000 eba82c062e25003b98b3912431b179b128f8e3649db579ba103f4c5d75e74c18 aeaef8c548d0ba8c440db0e513edd56d70132058f7d6b9d35282f8db966a5647 28e2a04e791161abf4081d80e9819667161be97c1115d05b9673cdc5d5ae6c73
17500 7c94cd6caa1510e638dd962c965c815fc89f7e69d0f78a146532b782630a426f 11158121f035b62583f080197087967ca02536e0646ea905fb0f9e13b7452d5a b709e61432432b51b76688e478d887a667a504cc2772acfa3872dd97cc7e61f2
18000 8d6b073588a170af1a98689629130c33199f4afc2bbcbf46053e462b925a8e38 6a453fe2cc14f282f136b4484ee983f59d0af74d85392ba5859c8bb44cb37bbb 4db256d99066bea91364d92b8daad7bcefbe32d4dfb8b2d22fa7cc27121ae9c6
18500 c530a6acc39edbed3b4086e6200d53c600b479ff49a505aafc6497784609c567 554712310aaf6095f56116e330ee414d66b06fd34f6b6c75f6ce488085348e5e f332bf0263305f7885064a76453c9ff8d7cfc0871cf0ba3845adc2d658b6764b
19000 e782271de899069ecce11bcea2ea2ec9c45ff98f00c6b6ca1ef90f6bbca31706 d44cd3f1f45c2222b14ff897f6889a80faaeb3f920ec07eba8c6b5c792d8c32b b8a227e269954e90da21e1b99e0c5fe4073ffd36087b790c1bed41f3546df354
19500 af61f2343c4c6929dc1a1b907bd5e0b92b44448e96695ce508665cef5ff7faa9 d98fcd8648f94d115bd615928c5e295c3ac02757b55936b132dbcf54a91bfab2 64c4097d50385dad8351f89962e10a4bd7980a892421db29fff5a0aa2cad9d0a
20000 dd24e07b348e8f8dcdd851b3e3bfca61303a02d29278eef0c8b8ed39341f1525 839042d1177852cee875021a9fa9c750a71b32cb317dd944e218493a2ff82836 4bfe27d71c4e9157f52a060f1d33205d3370f3018547180f1665afa5f3799a7c
20500 fb61302a4fe8e6d694a5dba7f362ad02d96fbd972b52a2ef070978cf53f0300d f5b844908666ce55858a2d710727e830ac423beae5b7878bec0cec3a45e27251 3bdabb1a36f9eb246fad309dc6eaf4201c4667c53193e179344729aa4dae42c0
21000 64071e795589d3bc669934012c163f54143b6db3d361f777a8a20087dbc822af 4c007ece66118854c715a5f6246cda3d4801833fd3d44b4e68636d44c8bf1587 e2087dfe45867b5aaaac7f89d6986ac7b777bca1fa9ce5423890802efc753ba4
21500 feb6e9006a5cb00924eb2e784bacb5624ffdc9ac789ba0ae4273eade650a05dd 27c688bd4651009351c3f751547a8f3f4cb59ba3d727ba8871e32631b65abf7e 75bfefa10416b2e8e4c76e00c26c0b146848e4d401b9efa4f85212ab3425275b
22000 b8d6cbbf537fd37a57da7657e53d5d3657b761d8068efa6f74ce33f4ef3c27da 93476387fad6b83eaac97b97a0fd6c638959f5dd38896c24a8a7ffc42c66b9d5 2534e282d8baff568fb4df19dd35000631fa1756997c3ef354ffcf7e23f1a705
22500 53f49caef44e23d5054ade0fb4fec26053584feafa69e4815c890f29df68c9e4 5a5fe9d10275008d02ad6fe044001f493732212530809c84e0e96acf51d52bff 36209fb0947a27963ee6e76e3cdd2a41f148cbbeb615441ccf762e7964c18797
23000 c8a20d9fdb74b610f7c3973a0d75eeb76dee1f8da3914cb1e6b9773f1d80768f cad6755a86e81f62b93237a55193d7fe391d8d5e58dc0db8ef03b7b43359d986 2b020a0029d6dc9fd7636e78563520515cb63480a5c03d121eba5824a716319b
23500 29e7fdd98c5a69ae9241caa89758701f6ee53d3fbe8629f889d41480ea251877 ebe40caf6e5c9d78105aed442087cc55275836644babadbe7e8511a9a06288de 9f418406f4da6295d8c9f75caee78d8cea4c6a497541b5cf1846397dcd98d2df
24000 a9048ea78538c9c1d9a93f53030c1e3032974b9c8bd0b4f6f7ab6e7759cd85c9 372e362dbf574a72f314f604a67b0e29e364f00ea739f7ef0bfa5c26cc742563 3b898addf2735e44004df24df32e1f9a32b6796505c5946a77144d8e55574a6e
24500 88c8450e323288f57323d8f1283533fdb414930431ae66eb6817ea31333626b6 cdeb60f3a6e5bc6eb322db1ded8e7b38cc7aff05627fce0793708e3f8cb83e31 0412b876de9aa59ac169680ba3268d0ee9d4b6c4985c0ea04c8be09a92037d10
25000 d2b9b655d4cb6e0a785ec811e345b76efbbfe3dab5039d500200a396f39f0a64 d94103fcba2202ced4a0bb3f9d1a914e971dde2a425fc8408e6ce397bd83b15c ccaf5f6571c9b95078f39fd3079e9cf7f2e69358e710491e3b34f264a37b3ca2
25500 3b4e3b406e1d218be61556990c662be26295849fb172e402cf1340e5b68b920d 9c84ca80017afff26c8f54a82d3d28b0052605d1658a60170b5d39c88e5e045a 3267a190cfc338a844c4aa6445665bf8e87363db276237d3ce008122008bb538
26000 f06feb3f9230732886a8c51a403614eac03d83317a669c7e5a0f60554cf4e0f9 1fd2a8166acd4291bc182baeb0584e60a4f12c0b370e5e771ad4f0807374188c e2296366eb1c6ec9aec24e17ae5342b3aa1e673b0b460d7799f4956d5d7da5b7
26500 170ccac4f6bd306be93da58ea6e4ed18f5770985752f1510978c41e8fb29f483 a70be8eb85446fc54bb99a488bcdf5e79973bdd2ea7f1d2643998febee2bfd02 a9ab11402dd1a3e12411665c4a7ffb13630d0a4381129fa58937b6e3335c15a1
27000 cfba59862a3d1ff5b5031457b80bf5e3d874bb497e30666780e8f4110decea6e 86621af3c1d6fccdf58b7e9979ee9ac8fae6688ffcf06e4b9a50d1dc5f584813 776aa5e3269a0dc7d3e18b3903f49f45f17ad7ac83123033621ed67a3620c9fb
27500 44ef215843d644673e4c45c0b5c31f5c4ae753c33ecc264721b2bbb04ddcdf72 a7af079d8447ea482fbc71d0afa674a51ec48277957ec28f62a24938f3862751 ca5df28436914c0f4747853225486fe0fb499f7c2ef5bb9c66a9287a4b6f2ca6
28000 467a5450ccb04080bc616b85fb41872777f51ba2387052b462e17c2bf1a54021 8d4d8ef2761ecc4cd62908a7e904bd2772380a8ca770156b49efa99b056691e4 2a8684a8bdbd46d082d76cf53ffebfdbe317b94deaac7d7c3e9d5e4c0b98827d
28500 db28211be85463b383c1dc903acc6ce59333d1dd01e5a25354769bb9139e5962 5ca824f85cfa3ca37d6f6885c4d3abc042647dfceaf75591ca72bd0fe9e370e8 2edc2eb5c81480632beb51d8dc65b2ba40d423218c54ac4ce2f0a604c403d087
29000 52fd8949d9d5098cf1169c3660f664799c9aafa7751d134b97a3e5e2f1dc4a5a d48b59c84e963a192929a911893ccd1e2231cb4dc49f645b49bcdb04529a9540 fb9248c8c7f45c6abdf4adcf492c8451185ead5902305c1d7e96e2943a58fb28
29500 b5f4434b0c20ed0b939c67675e0778fcab863134841fede458693dd853c78312 47d59a73b028ef9c3993a4348307372c8baaa1ff0b5a5b6933f24409335686a8 86912a70e6b575b55b92791427609d7548d4aa6823b4cad54aee407766db4d7c
30000 8c8606904d64828e5de90e9d78813d09e578b2157fcc8190a885fc886d618900 c4929890ea2cc05206d48e5b2238e5f9122580b8ef197482cd928ca12df00f05 20c5f1e2a6fb1970f3e91bed6ef8b91de5a61b20c9af764d49ad265f1bf0b6e3
30500 34d8c7f470b34adf7376c40d175b4a279e156bd26675195a7640dc3b527ee520 b647a6e70d4cf43f3f86506f008eb9560ca318eb03da32121951c54f965cb15a c34c8127a7aa9b5ac6c7aa75a9f8a69e2fcb02bd087bafcd467ba1bfb85d7829
31000 606cd084c987637917088a94d11e125826d72b2872cd26b0162ed3894dbbee20 551b44fcd72d0df353d9f0d5579f3af7e057877e86bb0c4e6488c2bf9ff33720 83e583e306b386f3e650379d1f8998412208efd064943d187f06441e2bd941e4
31500 58f65ddeafea45611b24b39ff3e87be4189a070070e2fea34347a479597d9513 e2a2b260c6495fd29e4f655569b24356580c5bc278950181c704187d04963e94 ddb9fd8989dd4f09ccee575ffc5be33f329483ea4cdbc43b24b37de393b6d730
32000 642f185bc285def960ca94b300132204eb7a7442f842534d582ce52f35e348eb 98f8b0f56871dd1313165e7780fd3fd63c9ce876d3603298d8a5e914924f64c7 70b193ecad99743f056a0e4d540c98163bf077fa6fa341490854d3c36624d48b
32500 6af2d7cc52f6e0734fbf6d2a120c696940471328a8220fc90d06a072b805dc4a 065fcdf48560e981cd3643271437201b2296d772cba72ea637b462e3faa4687d 85adeaf47c831de2d47a6e082a574e8913a3b78d9b9c7e75807bfb95a4bf643e
33000 557bb539f89804145ee10307039d595137950f512ff8e9c184414d33a5253829 e6d385a80e90af44c1df7fe6144c522aaf2eef5f958d3c762023bffa6d240cdc c44d3def406bd415ccfb91f400b746055a315d493fbd4d5d0b93022ccd537d40
33500 857a35081ebe6603035645ca2345e9b5580af1139a802eccf74d0e2c349f2818 11e5d63cc6ebd28b0a1546dfd85e82840ee815ae644ac4a6b661bc818f186f5b 69d9232f6bd9e749eca860024ac997ec65382b633ae1b0100b438349ae407063
34000 a4902edb7afeabda78ce4a7d169f2fb6d8efbd5b8de26db1c216d514ba9ea0cb 4d6c6147920051ff450a50e1478c2ab4122e5193bf52bbf50787a53cf284ca90 229e5d11a695a0efd41f062bac7d71d376abdf604c95af64f41d35f3b4a09a2c
34500 5d23e19a75ed938d5b042b5e2796557e51bc0c637ef1afdb8d230cecb5f7b1ee be5155b7cc2a54a4b6e6a3c3f2fd755313ac454bf6e2956fb2a67a32d8940cdb c75d318b70d60fb8839186c5f0db91d19c2a5f62b5312961d291c2bf96f83624
35000 1f535affae86ece833538a4d7ea39d748c550c0896044f2d3635428a43f2f613 055be35bd34f34e129d8ecf63ca1d58cd501199c0d47bc414adbd28e2d9f1737 ca4f3f181cd82e79771302f09765a7e2e3f4302ed235798f262c46e855688a0d
35500 82fd76ce3dc839b33ce9db16c42014ffcf2feee919164cf84405edc9625013f7 12c5ba4ca9d25dfa5f743be72be9d295ed869a32bff1e1d1b324992c462eb599 39836d5e4aa7e39707747c321caca2898a21dfa647fbd8ec9eb2089d32313ae8
36000 840f24491b2508eaebf25694fb99f7aa4bb9f0dddcba0869ce8b0ed9f721a72d 993fc9953b31cb31ca176924a902518d590c440cd75aa7e324364308919a4aea d2e5dc3ba356ff0baf8f31319ecab0ff26ebf26deae2c83aaca2811b23f1347c
36500 5b6109058bc4f6d3fef756bafb6f55499117299000429aa53ed86c6c47fe96ca 5e641d9626e6e871776f1ed9b9ce83d94629e3de73a1197325c25cf2f0c1e069 13808b8ffc1771bf64957c4411e5baf2d144c838e6369ea0233490901e4087d6
37000 a4455717cf676f40d17e78cf8ecec0aa4dff51565ac01320d67ced92b1c150a9 9034e9a05724f543b83bb309ba18257b608514a7b4afd5fb32f34858bbd31393 b4b7ebcb3bc79c753d08d5a10c1a5329696abccb06731438357422bd1d3ee73e
37500 cfcdf92937607bc50e839dbc1724fe1920e0f7f1b5805a2857b0f677c67bb1a5 5810db5bba6e02fa969d29f9af0abc1148a4b03f1ddc246b649a6b3694c4dcce c452d23a7646f5a53a481aa741b1ee444931c4e405b1d148d08c0b2e6575a027
38000 dbe0f9477252a72d883ed03bd6f21ab4dfa9cc26ab984e91b4458fdea43e485f 45dc699a6afb746db1882368c64055df43404f06ce7348c13fc4df92089ec20b 5798988a19da261d8cbdc81c4619878733ead8a1b6eecd24808bb7a54c35b100
38500 2a33d0f442892b799e96d132cef2d19ce535be5ebc17c719b1f1e6bf699628c3 ec304298b286521079a95f75403f66a6ce9d0448aa04df9276c2b7d391e52fd3 fea149291d66f324adb956dc83b86c9a4ba3d32a5b69399333b93f8b056bf547
39000 c40c4d92b267b959ca0f85c85a76c5675ca49310f935b516e3086d433a6a612b cf643490a19f6a39273b135c41d05d6741385088ebf0d974a00366a5078e85ea f1052808652f34ed6154f05d616941f1c6d6bd35b833ac20b9a779ff7aab508b
39500 ca0e62703c23e320d0c4a299714761dc1408a1eac16bff6deb0b99ddc5cf216b 711f932410b9f454a6e617fca4d998ff7101d7b9ddc46443fca28d2c3dd14595 de290e61f8d518cdcd6b41a837e702a0f870d6b0530a37061838ad0d8b62a22f
40000 182ffbb00f28bb18e5597b7eeceda0a20d438b1266eedbb8a14688212b2ee164 12ad4de0c7f7be0de9dadda0a304770d74bcc5117bb7626c32d4386e3eb85744 d20ce50121c88abfa1e568272eb3dc65f1c56ee24255900d4e2d2056cc856849
40500 36d03273e6e91c1c840b41b834dd4ebe1a49e6bc2e8b21bbfa4b935657adefaa

27
iguana/confs/SYS_peers.txt

@ -1,2 +1,25 @@
198.147.29.138 176.9.13.13
118.244.207.7 162.210.92.46
146.0.32.101
144.76.94.38
50.157.173.168
188.165.3.6
88.198.15.19
192.95.29.72
108.61.10.90
71.97.31.194
40.86.87.8
45.79.215.60
97.124.163.6
192.241.200.33
184.164.147.82
162.243.59.178
107.178.109.224
198.15.127.242
98.115.147.74
194.135.90.38
86.131.170.245
107.170.185.5
216.14.119.170
108.170.26.210
183.131.213.30

4
iguana/iguana777.h

@ -36,7 +36,7 @@ typedef int32_t (*blockhashfunc)(uint8_t *blockhashp,uint8_t *serialized,int32_t
#define IGUANA_MAXHEIGHT (1 << 30) #define IGUANA_MAXHEIGHT (1 << 30)
#define IGUANA_MAXCOINS 64 #define IGUANA_MAXCOINS 64
#define IGUANA_MAXDELAY_MILLIS (3600 * 1000) #define IGUANA_MAXDELAY_MILLIS (3600 * 1000 * 24)
#define IGUANA_DEFAULT_POLLTIMEOUT 10 #define IGUANA_DEFAULT_POLLTIMEOUT 10
#define IGUANA_EXCHANGEIDLE 10 #define IGUANA_EXCHANGEIDLE 10
@ -590,7 +590,7 @@ struct bitcoin_spend
int32_t iguana_verifypeer(struct iguana_info *coin,void *key,void *value,int32_t itemind,int32_t itemsize); int32_t iguana_verifypeer(struct iguana_info *coin,void *key,void *value,int32_t itemind,int32_t itemsize);
int32_t iguana_peermetrics(struct supernet_info *myinfo,struct iguana_info *coin); int32_t iguana_peermetrics(struct supernet_info *myinfo,struct iguana_info *coin);
void iguana_peersloop(void *arg); void iguana_peersloop(void *arg);
int32_t iguana_queue_send(struct iguana_peer *addr,int32_t delay,uint8_t *serialized,char *cmd,int32_t len,int32_t getdatablock,int32_t forceflag); int32_t iguana_queue_send(struct iguana_peer *addr,int32_t delay,uint8_t *serialized,char *cmd,int32_t len);
uint32_t iguana_rwiAddrind(struct iguana_info *coin,int32_t rwflag,struct iguana_iAddr *iA,uint32_t ind); uint32_t iguana_rwiAddrind(struct iguana_info *coin,int32_t rwflag,struct iguana_iAddr *iA,uint32_t ind);
void iguana_connections(void *arg); void iguana_connections(void *arg);
uint32_t iguana_possible_peer(struct iguana_info *coin,char *ip_port); uint32_t iguana_possible_peer(struct iguana_info *coin,char *ip_port);

8
iguana/iguana_accept.c

@ -199,7 +199,7 @@ int32_t iguana_process_msgrequestQ(struct supernet_info *myinfo,struct iguana_in
if ( (addr= msg->addr) != 0 && (len= iguana_peerblockrequest(coin,coin->blockspace,(int32_t)(sizeof(coin->blockspace) - sizeof(struct iguana_msghdr)),0,msg->hash2,0)) > 0 ) if ( (addr= msg->addr) != 0 && (len= iguana_peerblockrequest(coin,coin->blockspace,(int32_t)(sizeof(coin->blockspace) - sizeof(struct iguana_msghdr)),0,msg->hash2,0)) > 0 )
{ {
//char str[65]; printf("msg Sendlen.%d block %s to %s\n",len,bits256_str(str,msg->hash2),addr->ipaddr); //char str[65]; printf("msg Sendlen.%d block %s to %s\n",len,bits256_str(str,msg->hash2),addr->ipaddr);
iguana_queue_send(addr,0,coin->blockspace,"block",len,0,0); iguana_queue_send(addr,0,coin->blockspace,"block",len);
} }
} }
} }
@ -213,7 +213,7 @@ int32_t iguana_process_msgrequestQ(struct supernet_info *myinfo,struct iguana_in
{ {
char str[65],str2[65]; char str[65],str2[65];
if ( bits256_cmp(msg->hash2,checktxid) == 0 ) if ( bits256_cmp(msg->hash2,checktxid) == 0 )
iguana_queue_send(msg->addr,0,coin->blockspace,"block",len,0,0); iguana_queue_send(msg->addr,0,coin->blockspace,"block",len);
else printf("checktxid mismatch (%s) != (%s)\n",bits256_str(str,msg->hash2),bits256_str(str2,checktxid)); else printf("checktxid mismatch (%s) != (%s)\n",bits256_str(str,msg->hash2),bits256_str(str2,checktxid));
} }
} }
@ -237,7 +237,7 @@ int32_t iguana_process_msgrequestQ(struct supernet_info *myinfo,struct iguana_in
{ {
//iguana_sethdr((void *)coin->blockspace,coin->chain->netmagic,"quote",&coin->blockspace[sizeof(struct iguana_msghdr)],len); //iguana_sethdr((void *)coin->blockspace,coin->chain->netmagic,"quote",&coin->blockspace[sizeof(struct iguana_msghdr)],len);
//iguana_msgparser(coin,msg->addr,0,0,0,(void *)coin->blockspace,&coin->blockspace[sizeof(struct iguana_msghdr)],len); //iguana_msgparser(coin,msg->addr,0,0,0,(void *)coin->blockspace,&coin->blockspace[sizeof(struct iguana_msghdr)],len);
iguana_queue_send(msg->addr,0,coin->blockspace,"quote",len,0,0); iguana_queue_send(msg->addr,0,coin->blockspace,"quote",len);
} }
} }
} }
@ -313,7 +313,7 @@ int32_t iguana_peerhdrrequest(struct iguana_info *coin,uint8_t *serialized,int32
} }
} }
if ( flag != 0 ) if ( flag != 0 )
retval = iguana_queue_send(addr,0,serialized,"headers",len,0,0); retval = iguana_queue_send(addr,0,serialized,"headers",len);
//printf("hdrs request retval.%d len.%d\n",retval,len); //printf("hdrs request retval.%d len.%d\n",retval,len);
} //else printf("couldnt find header\n"); } //else printf("couldnt find header\n");
return(retval); return(retval);

17
iguana/iguana_instantdex.c

@ -389,7 +389,7 @@ bits256 instantdex_rwoffer(int32_t rwflag,int32_t *lenp,uint8_t *serialized,stru
char *instantdex_sendcmd(struct supernet_info *myinfo,struct instantdex_offer *offer,cJSON *argjson,char *cmdstr,bits256 desthash,int32_t hops,void *extraser,int32_t extralen,struct iguana_peer *addr,struct bitcoin_swapinfo *swap) char *instantdex_sendcmd(struct supernet_info *myinfo,struct instantdex_offer *offer,cJSON *argjson,char *cmdstr,bits256 desthash,int32_t hops,void *extraser,int32_t extralen,struct iguana_peer *addr,struct bitcoin_swapinfo *swap)
{ {
cJSON *sendjson; char *reqstr,*hexstr,*retstr,*str; struct instantdex_msghdr *msg; bits256 orderhash,tmphash; int32_t i,j,len,serflag,olen,slen,datalen; uint8_t *buf,serialized[sizeof(*offer) + sizeof(struct iguana_msghdr) + 4096 + INSTANTDEX_DECKSIZE*33]; uint64_t x,nxt64bits; cJSON *sendjson; char *reqstr,*hexstr,*retstr; struct instantdex_msghdr *msg; bits256 orderhash,tmphash; int32_t i,j,len,dir=0,serflag,olen,slen,datalen; uint8_t *buf,serialized[sizeof(*offer) + sizeof(struct iguana_msghdr) + 4096 + INSTANTDEX_DECKSIZE*33]; uint64_t x,nxt64bits;
//if ( strcmp(cmdstr,"poll") == 0 ) //if ( strcmp(cmdstr,"poll") == 0 )
// return(clonestr("{\"result\":\"skip sending poll\"}")); // return(clonestr("{\"result\":\"skip sending poll\"}"));
//category_subscribe(myinfo,myinfo->instantdex_category,GENESIS_PUBKEY); //category_subscribe(myinfo,myinfo->instantdex_category,GENESIS_PUBKEY);
@ -460,7 +460,7 @@ char *instantdex_sendcmd(struct supernet_info *myinfo,struct instantdex_offer *o
} }
} }
free(reqstr); free(reqstr);
int32_t delaymillis=0,encryptflag=0; uint8_t *data; uint32_t basilisktag=0;
buf = malloc(datalen*2 + 1); buf = malloc(datalen*2 + 1);
init_hexbytes_noT((char *)buf,(uint8_t *)msg,datalen); init_hexbytes_noT((char *)buf,(uint8_t *)msg,datalen);
sendjson = cJSON_CreateObject(); sendjson = cJSON_CreateObject();
@ -473,9 +473,10 @@ char *instantdex_sendcmd(struct supernet_info *myinfo,struct instantdex_offer *o
jaddnum(sendjson,"plaintext",1); jaddnum(sendjson,"plaintext",1);
jaddbits256(sendjson,"categoryhash",myinfo->instantdex_category); jaddbits256(sendjson,"categoryhash",myinfo->instantdex_category);
jaddbits256(sendjson,"traderpub",myinfo->myaddr.persistent); jaddbits256(sendjson,"traderpub",myinfo->myaddr.persistent);
str = jprint(sendjson,1); data = basilisk_jsondata(&datalen,sendjson,basilisktag);
basilisk_sendcmd(0,str); basilisk_sendcmd(myinfo,addr->ipaddr,dir > 0 ? "BID" : "ASK",basilisktag,encryptflag,delaymillis,data,datalen,1);
free(str); free_json(sendjson);
free(data);
return(clonestr("{\"result\":\"success\"}")); return(clonestr("{\"result\":\"success\"}"));
if ( instantdex_msgcreate(myinfo,msg,datalen) != 0 ) if ( instantdex_msgcreate(myinfo,msg,datalen) != 0 )
@ -485,7 +486,7 @@ char *instantdex_sendcmd(struct supernet_info *myinfo,struct instantdex_offer *o
{ {
memset(serialized,0,sizeof(struct iguana_msghdr)); memset(serialized,0,sizeof(struct iguana_msghdr));
memcpy(&serialized[sizeof(struct iguana_msghdr)],(uint8_t *)msg,msg->sig.allocsize); memcpy(&serialized[sizeof(struct iguana_msghdr)],(uint8_t *)msg,msg->sig.allocsize);
iguana_queue_send(addr,0,serialized,"InstantDEX",msg->sig.allocsize,0,0); iguana_queue_send(addr,0,serialized,"InstantDEX",msg->sig.allocsize);
} }
else else
{ {
@ -968,7 +969,7 @@ int32_t instantdex_inv2data(struct supernet_info *myinfo,struct iguana_info *coi
printf(" nhashes for (%s)\n",addr->ipaddr); printf(" nhashes for (%s)\n",addr->ipaddr);
len = iguana_inv2packet(serialized,sizeof(serialized),MSG_QUOTE,hashes,n); len = iguana_inv2packet(serialized,sizeof(serialized),MSG_QUOTE,hashes,n);
//printf("Send inv2[%d] -> (%s)\n",n,addr->ipaddr); //printf("Send inv2[%d] -> (%s)\n",n,addr->ipaddr);
return(iguana_queue_send(addr,0,serialized,"inv2",len,0,0)); return(iguana_queue_send(addr,0,serialized,"inv2",len));
} }
return(-1); return(-1);
} }
@ -1082,7 +1083,7 @@ void instantdex_propagate(struct supernet_info *myinfo,struct exchange_info *exc
if ( (addr= coin->peers.ranked[i]) != 0 && addr->supernet != 0 && addr->usock >= 0 && GETBIT(ap->peerhas,addr->addrind) == 0 && strcmp("0.0.0.0",addr->ipaddr) != 0 && strcmp("127.0.0.1",addr->ipaddr) != 0 ) if ( (addr= coin->peers.ranked[i]) != 0 && addr->supernet != 0 && addr->usock >= 0 && GETBIT(ap->peerhas,addr->addrind) == 0 && strcmp("0.0.0.0",addr->ipaddr) != 0 && strcmp("127.0.0.1",addr->ipaddr) != 0 )
{ {
char str[65]; printf("send quote.(%s) <- [%d] %s %llx\n",addr->ipaddr,len,bits256_str(str,orderhash),(long long)orderhash.txid); char str[65]; printf("send quote.(%s) <- [%d] %s %llx\n",addr->ipaddr,len,bits256_str(str,orderhash),(long long)orderhash.txid);
iguana_queue_send(addr,0,serialized,"quote",len,0,0); iguana_queue_send(addr,0,serialized,"quote",len);
} }
} }
} }

547
iguana/iguana_msg.c

@ -256,7 +256,7 @@ void iguana_gotversion(struct iguana_info *coin,struct iguana_peer *addr,struct
addr->height = vers->nStartingHeight; addr->height = vers->nStartingHeight;
addr->relayflag = 1; addr->relayflag = 1;
iguana_gotdata(coin,addr,addr->height); iguana_gotdata(coin,addr,addr->height);
iguana_queue_send(addr,0,serialized,"verack",0,0,0); iguana_queue_send(addr,0,serialized,"verack",0);
//iguana_send_ping(coin,addr); //iguana_send_ping(coin,addr);
} }
else if ( (vers->nServices & (1<<7)) == 0 ) else if ( (vers->nServices & (1<<7)) == 0 )
@ -273,7 +273,7 @@ void iguana_gotversion(struct iguana_info *coin,struct iguana_peer *addr,struct
addr->dead = 1; addr->dead = 1;
} else coin->longestchain = vers->nStartingHeight; } else coin->longestchain = vers->nStartingHeight;
} }
iguana_queue_send(addr,0,serialized,"getaddr",0,0,0); iguana_queue_send(addr,0,serialized,"getaddr",0);
} }
int32_t iguana_send_version(struct iguana_info *coin,struct iguana_peer *addr,uint64_t myservices) int32_t iguana_send_version(struct iguana_info *coin,struct iguana_peer *addr,uint64_t myservices)
@ -291,7 +291,7 @@ int32_t iguana_send_version(struct iguana_info *coin,struct iguana_peer *addr,ui
msg.nStartingHeight = coin->blocks.hwmchain.height; msg.nStartingHeight = coin->blocks.hwmchain.height;
iguana_gotdata(coin,addr,msg.nStartingHeight); iguana_gotdata(coin,addr,msg.nStartingHeight);
len = iguana_rwversion(1,&serialized[sizeof(struct iguana_msghdr)],&msg,addr->ipaddr,0); len = iguana_rwversion(1,&serialized[sizeof(struct iguana_msghdr)],&msg,addr->ipaddr,0);
return(iguana_queue_send(addr,0,serialized,"version",len,0,1)); return(iguana_queue_send(addr,0,serialized,"version",len));
} }
int32_t iguana_send_VPNversion(struct iguana_info *coin,struct iguana_peer *addr,uint64_t myservices) int32_t iguana_send_VPNversion(struct iguana_info *coin,struct iguana_peer *addr,uint64_t myservices)
@ -305,7 +305,7 @@ int32_t iguana_send_VPNversion(struct iguana_info *coin,struct iguana_peer *addr
sprintf(msg.strSubVer,"/Satoshi:0.11.99/"); sprintf(msg.strSubVer,"/Satoshi:0.11.99/");
msg.nStartingHeight = coin->blocks.hwmchain.height; msg.nStartingHeight = coin->blocks.hwmchain.height;
len = iguana_rwversion(1,&serialized[sizeof(struct iguana_msghdr)],(void *)&msg,addr->ipaddr,117); len = iguana_rwversion(1,&serialized[sizeof(struct iguana_msghdr)],(void *)&msg,addr->ipaddr,117);
return(iguana_queue_send(addr,0,serialized,"version",len,0,1)); return(iguana_queue_send(addr,0,serialized,"version",len));
} }
void iguana_gotverack(struct iguana_info *coin,struct iguana_peer *addr) void iguana_gotverack(struct iguana_info *coin,struct iguana_peer *addr)
@ -315,7 +315,7 @@ void iguana_gotverack(struct iguana_info *coin,struct iguana_peer *addr)
{ {
//printf("gotverack from %s\n",addr->ipaddr); //printf("gotverack from %s\n",addr->ipaddr);
addr->A.nTime = (uint32_t)time(NULL); addr->A.nTime = (uint32_t)time(NULL);
iguana_queue_send(addr,0,serialized,"getaddr",0,0,0); iguana_queue_send(addr,0,serialized,"getaddr",0);
if ( addr->supernet != 0 ) if ( addr->supernet != 0 )
{ {
//printf("send getpeers to %s\n",addr->ipaddr); //printf("send getpeers to %s\n",addr->ipaddr);
@ -350,7 +350,7 @@ void iguana_gotping(struct iguana_info *coin,struct iguana_peer *addr,uint64_t n
len = iguana_rwnum(1,&serialized[sizeof(struct iguana_msghdr)],sizeof(uint64_t),&nonce); len = iguana_rwnum(1,&serialized[sizeof(struct iguana_msghdr)],sizeof(uint64_t),&nonce);
if ( memcmp(data,&serialized[sizeof(struct iguana_msghdr)],sizeof(nonce)) != 0 ) if ( memcmp(data,&serialized[sizeof(struct iguana_msghdr)],sizeof(nonce)) != 0 )
printf("ping ser error %llx != %llx\n",(long long)nonce,*(long long *)data); printf("ping ser error %llx != %llx\n",(long long)nonce,*(long long *)data);
iguana_queue_send(addr,0,serialized,"pong",len,0,0); iguana_queue_send(addr,0,serialized,"pong",len);
if ( addr->supernet != 0 ) if ( addr->supernet != 0 )
{ {
iguana_send_supernet(addr,SUPERNET_GETPEERSTR,0); iguana_send_supernet(addr,SUPERNET_GETPEERSTR,0);
@ -367,11 +367,11 @@ int32_t iguana_send_ping(struct iguana_info *coin,struct iguana_peer *addr)
addr->pingtime = (uint32_t)time(NULL); addr->pingtime = (uint32_t)time(NULL);
} }
//printf("pingnonce.%llx from (%s)\n",(long long)nonce,addr->ipaddr); //printf("pingnonce.%llx from (%s)\n",(long long)nonce,addr->ipaddr);
iguana_queue_send(addr,0,serialized,"getaddr",0,0,0); iguana_queue_send(addr,0,serialized,"getaddr",0);
len = iguana_rwnum(1,&serialized[sizeof(struct iguana_msghdr)],sizeof(uint64_t),&nonce); len = iguana_rwnum(1,&serialized[sizeof(struct iguana_msghdr)],sizeof(uint64_t),&nonce);
if ( addr->supernet != 0 ) if ( addr->supernet != 0 )
iguana_send_supernet(addr,SUPERNET_GETPEERSTR,0); iguana_send_supernet(addr,SUPERNET_GETPEERSTR,0);
return(iguana_queue_send(addr,0,serialized,"ping",len,0,0)); return(iguana_queue_send(addr,0,serialized,"ping",len));
} }
int32_t iguana_send_ConnectTo(struct iguana_info *coin,struct iguana_peer *addr) int32_t iguana_send_ConnectTo(struct iguana_info *coin,struct iguana_peer *addr)
@ -380,7 +380,7 @@ int32_t iguana_send_ConnectTo(struct iguana_info *coin,struct iguana_peer *addr)
r = rand(); r = rand();
len = iguana_rwnum(1,&serialized[sizeof(struct iguana_msghdr)],sizeof(uint32_t),&r); len = iguana_rwnum(1,&serialized[sizeof(struct iguana_msghdr)],sizeof(uint32_t),&r);
len += iguana_rwnum(1,&serialized[sizeof(struct iguana_msghdr)+len],sizeof(port),&port); len += iguana_rwnum(1,&serialized[sizeof(struct iguana_msghdr)+len],sizeof(port),&port);
return(iguana_queue_send(addr,0,serialized,"ConnectTo",len,0,0)); return(iguana_queue_send(addr,0,serialized,"ConnectTo",len));
} }
void iguana_gotpong(struct iguana_info *coin,struct iguana_peer *addr,uint64_t nonce) void iguana_gotpong(struct iguana_info *coin,struct iguana_peer *addr,uint64_t nonce)
@ -591,7 +591,7 @@ int32_t iguana_send_hashes(struct iguana_info *coin,char *command,struct iguana_
nVersion = 0; nVersion = 0;
len = iguana_rwblockhash(1,&serialized[sizeof(struct iguana_msghdr)],&nVersion,&varint,hashes,&stophash); len = iguana_rwblockhash(1,&serialized[sizeof(struct iguana_msghdr)],&nVersion,&varint,hashes,&stophash);
//printf("%s send_hashes.%d %s height.%d\n",addr->ipaddr,n,bits256_str(hashes[0]),iguana_height(coin,hashes[0])); //printf("%s send_hashes.%d %s height.%d\n",addr->ipaddr,n,bits256_str(hashes[0]),iguana_height(coin,hashes[0]));
retval = iguana_queue_send(addr,0,serialized,command,len,0,0); retval = iguana_queue_send(addr,0,serialized,command,len);
myfree(serialized,size); myfree(serialized,size);
} else printf("iguana_send_hashes: unexpected n.%d\n",n); } else printf("iguana_send_hashes: unexpected n.%d\n",n);
return(retval); return(retval);
@ -670,351 +670,320 @@ int32_t iguana_intvectors(struct iguana_info *coin,struct iguana_peer *addr,int3
int32_t iguana_msgparser(struct iguana_info *coin,struct iguana_peer *addr,struct OS_memspace *rawmem,struct OS_memspace *txmem,struct OS_memspace *hashmem,struct iguana_msghdr *H,uint8_t *data,int32_t recvlen) int32_t iguana_msgparser(struct iguana_info *coin,struct iguana_peer *addr,struct OS_memspace *rawmem,struct OS_memspace *txmem,struct OS_memspace *hashmem,struct iguana_msghdr *H,uint8_t *data,int32_t recvlen)
{ {
uint8_t serialized[16384]; char *retstr; struct supernet_info *myinfo = SuperNET_MYINFO(0); uint8_t serialized[16384]; char *ipaddr; struct supernet_info *myinfo = SuperNET_MYINFO(0);
int32_t i,n,retval,ishost,delay,srvmsg,bloom,sendlen=0,intvectors,len= -100; uint64_t nonce,x; bits256 hash2; int32_t i,n,retval=-1,ishost,delay=0,srvmsg,bloom,sendlen=0,intvectors,len= -100; uint64_t nonce,x; bits256 hash2;
bloom = intvectors = srvmsg = -1; bloom = intvectors = srvmsg = -1;
if ( strncmp(H->command,"SuperNET",strlen("SuperNET")) == 0 || strncmp(H->command,"SuperNet",strlen("SuperNet")) == 0 )
{
if ( addr != 0 )
{
addr->supernet = 1;
ipaddr = addr->ipaddr;
} else ipaddr = 0;
len = recvlen;
basilisk_p2p(myinfo,addr,&delay,ipaddr,data,recvlen,&H->command[strlen("SuperNET")],H->command[6] == 'e' && H->command[7] == 't');
//printf("GOT.(%s) len.%d from %s -> ret.(%s)\n",H->command,recvlen,addr->ipaddr,retstr==0?"null":retstr);
return(0);
}
if ( addr != 0 ) if ( addr != 0 )
{ {
//printf("iguana_msgparser from (%s) parse.(%s) len.%d\n",addr->ipaddr,H->command,recvlen); //printf("iguana_msgparser from (%s) parse.(%s) len.%d\n",addr->ipaddr,H->command,recvlen);
//iguana_peerblockrequest(coin,addr->blockspace,IGUANA_MAXPACKETSIZE,addr,iguana_blockhash(coin,100),0); //iguana_peerblockrequest(coin,addr->blockspace,IGUANA_MAXPACKETSIZE,addr,iguana_blockhash(coin,100),0);
addr->lastcontact = (uint32_t)time(NULL); addr->lastcontact = (uint32_t)time(NULL);
strcpy(addr->lastcommand,H->command); strcpy(addr->lastcommand,H->command);
if ( strncmp(H->command,"SuperNET",strlen("SuperNET")) == 0 ) retval = 0;
if ( (ishost= (strcmp(H->command,"getblocks") == 0)) || strcmp(H->command,"block") == 0 )
{ {
addr->supernet = 1; if ( addr != 0 )
addr->msgcounts.verack++;
len = recvlen;
if ( (retstr= SuperNET_p2p(coin,addr,&delay,addr->ipaddr,data,recvlen,H->command[strlen("SuperNET")]=='b')) != 0 )
{ {
cJSON *rawtxjson; struct iguana_txblock txdata;
if ( (rawtxjson= cJSON_Parse(retstr)) != 0 ) iguana_memreset(rawmem), iguana_memreset(txmem);
memset(&txdata,0,sizeof(txdata));
if ( ishost == 0 )
{ {
if ( jstr(rawtxjson,"method") != 0 && strcmp(jstr(rawtxjson,"method"),"rawtx_return") == 0 ) if ( 0 && coin->chain->auxpow != 0 )
{
int32_t i; for (i=0; i<recvlen; i++)
printf("%02x",data[i]);
printf(" auxblock\n");
}
addr->msgcounts.block++;
if ( (n= iguana_gentxarray(coin,rawmem,&txdata,&len,data,recvlen)) == recvlen )
{
len = n;
iguana_gotblockM(coin,addr,&txdata,rawmem->ptr,H,data,recvlen);
}
else
{ {
; //for (i=0; i<recvlen; i++)
// printf("%02x",data[i]);
printf(" parse error block txn_count.%d, n.%d len.%d vs recvlen.%d from.(%s)\n",txdata.block.RO.txn_count,n,len,recvlen,addr->ipaddr);
} }
} }
iguana_send_supernet(addr,retstr,delay); else
free(retstr); {
len = iguana_peergetrequest(coin,addr,data,recvlen,1);
}
} }
//printf("GOT.(%s) len.%d from %s -> ret.(%s)\n",H->command,recvlen,addr->ipaddr,retstr==0?"null":retstr);
return(0);
} }
else if ( strcmp(H->command,"InstantDEX") == 0 ) else if ( (ishost= (strncmp(H->command,"inv",3) == 0)) || strncmp(H->command,"getdata",7) == 0 )
{ {
char *str; if ( addr != 0 )
printf("peer InstantDEX message datalen.%d\n",recvlen);
if ( (str= InstantDEX_hexmsg(myinfo,category_find(myinfo->instantdex_category,GENESIS_PUBKEY),data,recvlen,addr->ipaddr)) != 0 )
free(str);
//SuperNET_hexmsgadd(myinfo,myinfo->instantdex_category,GENESIS_PUBKEY,(char *)serialized,tai_now(),addr->ipaddr);
return(0);
}
else if ( strcmp(H->command,"pangea") == 0 )
{
//init_hexbytes_noT(0,data,recvlen);
printf("skip pangea InstantDEX message\n");
//SuperNET_hexmsgadd(myinfo,myinfo->pangea_category,GENESIS_PUBKEY,0,tai_now(),addr->ipaddr);
return(0);
}
else if ( strcmp(H->command,"quote") == 0 )
{
printf("got full quote from %s\n",addr->ipaddr);
instantdex_quotep2p(myinfo,coin,addr,data,recvlen);
return(0);
}
}
retval = 0;
if ( (ishost= (strcmp(H->command,"getblocks") == 0)) || strcmp(H->command,"block") == 0 )
{
if ( addr != 0 )
{
struct iguana_txblock txdata;
iguana_memreset(rawmem), iguana_memreset(txmem);
memset(&txdata,0,sizeof(txdata));
if ( ishost == 0 )
{ {
if ( 0 && coin->chain->auxpow != 0 ) if ( ishost == 0 )
{ {
int32_t i; for (i=0; i<recvlen; i++) addr->msgcounts.getdata++;
printf("%02x",data[i]); len = iguana_peerdatarequest(coin,addr,data,recvlen);
printf(" auxblock\n");
}
addr->msgcounts.block++;
if ( (n= iguana_gentxarray(coin,rawmem,&txdata,&len,data,recvlen)) == recvlen )
{
len = n;
iguana_gotblockM(coin,addr,&txdata,rawmem->ptr,H,data,recvlen);
} }
else else
{ {
//for (i=0; i<recvlen; i++) intvectors = 'I', addr->msgcounts.inv++;
// printf("%02x",data[i]); if ( 0 && strcmp(H->command,"inv2") == 0 )
printf(" parse error block txn_count.%d, n.%d len.%d vs recvlen.%d from.(%s)\n",txdata.block.RO.txn_count,n,len,recvlen,addr->ipaddr); printf("GOT INV2.%d\n",recvlen);
len = iguana_intvectors(coin,addr,1,data,recvlen); // indirectly issues getdata
} }
} }
else
{
len = iguana_peergetrequest(coin,addr,data,recvlen,1);
}
}
}
else if ( (ishost= (strncmp(H->command,"inv",3) == 0)) || strncmp(H->command,"getdata",7) == 0 )
{
if ( addr != 0 )
{
if ( ishost == 0 )
{
addr->msgcounts.getdata++;
len = iguana_peerdatarequest(coin,addr,data,recvlen);
}
else
{
intvectors = 'I', addr->msgcounts.inv++;
if ( 0 && strcmp(H->command,"inv2") == 0 )
printf("GOT INV2.%d\n",recvlen);
len = iguana_intvectors(coin,addr,1,data,recvlen); // indirectly issues getdata
}
} }
} else if ( (ishost= (strcmp(H->command,"getheaders") == 0)) || strcmp(H->command,"headers") == 0 )
else if ( (ishost= (strcmp(H->command,"getheaders") == 0)) || strcmp(H->command,"headers") == 0 )
{
struct iguana_msgblock msg; struct iguana_block *blocks; uint32_t tmp,n=0;
len = 0;
if ( addr != 0 )
{ {
if ( ishost == 0 ) struct iguana_msgblock msg; struct iguana_block *blocks; uint32_t tmp,n=0;
len = 0;
if ( addr != 0 )
{ {
len = iguana_rwvarint32(0,data,&n); if ( ishost == 0 )
if ( n <= IGUANA_MAXINV )
{ {
bits256 auxhash2,prevhash2; struct iguana_msgtx *tx; struct iguana_msgmerkle coinbase_branch,blockchain_branch; struct iguana_msgblock parentblock; len = iguana_rwvarint32(0,data,&n);
if ( rawmem->totalsize == 0 ) if ( n <= IGUANA_MAXINV )
iguana_meminit(rawmem,"bighdrs",0,IGUANA_MAXPACKETSIZE * 2,0);
memset(prevhash2.bytes,0,sizeof(prevhash2));
blocks = mycalloc('i',1,sizeof(*blocks) * n);
//printf("%s got %d headers len.%d\n",coin->symbol,n,recvlen);
for (i=0; i<n; i++)
{ {
if ( coin->chain->auxpow != 0 ) bits256 auxhash2,prevhash2; struct iguana_msgtx *tx; struct iguana_msgmerkle coinbase_branch,blockchain_branch; struct iguana_msgblock parentblock;
if ( rawmem->totalsize == 0 )
iguana_meminit(rawmem,"bighdrs",0,IGUANA_MAXPACKETSIZE * 2,0);
memset(prevhash2.bytes,0,sizeof(prevhash2));
blocks = mycalloc('i',1,sizeof(*blocks) * n);
//printf("%s got %d headers len.%d\n",coin->symbol,n,recvlen);
for (i=0; i<n; i++)
{ {
tmp = iguana_rwblock80(0,&data[len],&msg); if ( coin->chain->auxpow != 0 )
hash2 = iguana_calcblockhash(coin->symbol,coin->chain->hashalgo,&data[len],tmp);
len += tmp;
if ( (msg.H.version & 0x100) != 0 )
{ {
iguana_memreset(rawmem); tmp = iguana_rwblock80(0,&data[len],&msg);
tx = iguana_memalloc(rawmem,sizeof(*tx),1); hash2 = iguana_calcblockhash(coin->symbol,coin->chain->hashalgo,&data[len],tmp);
len += iguana_rwtx(0,rawmem,&data[len],tx,recvlen-len,&tx->txid,coin->chain->hastimestamp,strcmp(coin->symbol,"VPN")==0); len += tmp;
len += iguana_rwbignum(0,&data[len],sizeof(auxhash2),auxhash2.bytes); if ( (msg.H.version & 0x100) != 0 )
len += iguana_rwmerklebranch(0,&data[len],&coinbase_branch); {
len += iguana_rwmerklebranch(0,&data[len],&blockchain_branch); iguana_memreset(rawmem);
len += iguana_rwblock80(0,&data[len],&parentblock); tx = iguana_memalloc(rawmem,sizeof(*tx),1);
} len += iguana_rwtx(0,rawmem,&data[len],tx,recvlen-len,&tx->txid,coin->chain->hastimestamp,strcmp(coin->symbol,"VPN")==0);
len += iguana_rwvarint32(0,&data[len],&tmp); len += iguana_rwbignum(0,&data[len],sizeof(auxhash2),auxhash2.bytes);
char str[65],str2[65]; len += iguana_rwmerklebranch(0,&data[len],&coinbase_branch);
if ( 0 && coin->chain->auxpow != 0 ) len += iguana_rwmerklebranch(0,&data[len],&blockchain_branch);
printf("%d %d of %d: %s %s v.%08x numtx.%d cmp.%d\n",len,i,n,bits256_str(str,hash2),bits256_str(str2,msg.H.prev_block),msg.H.version,tmp,bits256_cmp(prevhash2,msg.H.prev_block)); len += iguana_rwblock80(0,&data[len],&parentblock);
} else len += iguana_rwblock(coin->chain->symbol,coin->chain->hashalgo,0,&hash2,&data[len],&msg); }
iguana_blockconv(&blocks[i],&msg,hash2,-1); len += iguana_rwvarint32(0,&data[len],&tmp);
prevhash2 = hash2; char str[65],str2[65];
} if ( 0 && coin->chain->auxpow != 0 )
if ( 0 && coin->chain->auxpow != 0 ) printf("%d %d of %d: %s %s v.%08x numtx.%d cmp.%d\n",len,i,n,bits256_str(str,hash2),bits256_str(str2,msg.H.prev_block),msg.H.version,tmp,bits256_cmp(prevhash2,msg.H.prev_block));
{ } else len += iguana_rwblock(coin->chain->symbol,coin->chain->hashalgo,0,&hash2,&data[len],&msg);
len += iguana_rwvarint32(0,&data[len],&n); iguana_blockconv(&blocks[i],&msg,hash2,-1);
for (i=0; i<n; i++) prevhash2 = hash2;
len += iguana_eatauxpow(0,coin->symbol,&data[len]); }
} if ( 0 && coin->chain->auxpow != 0 )
iguana_gotheadersM(coin,addr,blocks,n); {
//myfree(blocks,sizeof(*blocks) * n); len += iguana_rwvarint32(0,&data[len],&n);
if ( len == recvlen && addr != 0 ) for (i=0; i<n; i++)
addr->msgcounts.headers++; len += iguana_eatauxpow(0,coin->symbol,&data[len]);
} else printf("got unexpected n.%d for headers\n",n); }
} iguana_gotheadersM(coin,addr,blocks,n);
else if ( addr->headerserror == 0 ) //myfree(blocks,sizeof(*blocks) * n);
len = iguana_peergetrequest(coin,addr,data,recvlen,0); if ( len == recvlen && addr != 0 )
} addr->msgcounts.headers++;
} } else printf("got unexpected n.%d for headers\n",n);
else if ( (ishost= (strcmp(H->command,"version") == 0)) || strcmp(H->command,"verack") == 0 ) }
{ else if ( addr->headerserror == 0 )
if ( addr != 0 ) len = iguana_peergetrequest(coin,addr,data,recvlen,0);
{
if ( ishost != 0 )
{
struct iguana_msgversion recvmv;
len = iguana_rwversion(0,data,&recvmv,addr->ipaddr,recvlen);
if ( len <= recvlen )
iguana_gotversion(coin,addr,&recvmv);
addr->msgcounts.version++;
}
else
{
iguana_gotverack(coin,addr);
addr->msgcounts.verack++;
len = 0;
} }
} }
} else if ( (ishost= (strcmp(H->command,"version") == 0)) || strcmp(H->command,"verack") == 0 )
else if ( (ishost= (strcmp(H->command,"ping") == 0)) || strcmp(H->command,"pong") == 0 )
{
len = 0;
if ( recvlen == sizeof(uint64_t) && addr != 0 )
{ {
len = iguana_rwnum(0,data,sizeof(uint64_t),&nonce);
if ( addr != 0 ) if ( addr != 0 )
{ {
//printf("%u got nonce.%llx from %s\n",(uint32_t)time(NULL),(long long)nonce,addr->ipaddr);
if ( ishost != 0 ) if ( ishost != 0 )
{ {
iguana_gotping(coin,addr,nonce,data); struct iguana_msgversion recvmv;
addr->msgcounts.ping++; len = iguana_rwversion(0,data,&recvmv,addr->ipaddr,recvlen);
if ( len <= recvlen )
iguana_gotversion(coin,addr,&recvmv);
addr->msgcounts.version++;
} }
else else
{ {
iguana_gotpong(coin,addr,nonce); iguana_gotverack(coin,addr);
addr->msgcounts.pong++; addr->msgcounts.verack++;
len = 0;
} }
iguana_queue_send(addr,0,serialized,"getaddr",0,0,0);
} }
} }
} else if ( (ishost= (strcmp(H->command,"ping") == 0)) || strcmp(H->command,"pong") == 0 )
else if ( (ishost= (strcmp(H->command,"getaddr") == 0)) || strcmp(H->command,"addr") == 0 )
{
struct iguana_msgaddress A;
//printf("iguana_msgparser from (%s) parse.(%s) len.%d\n",addr->ipaddr,H->command,recvlen);
if ( addr != 0 )
{ {
if ( ishost == 0 ) len = 0;
if ( recvlen == sizeof(uint64_t) && addr != 0 )
{ {
//for (i=0; i<recvlen; i++) len = iguana_rwnum(0,data,sizeof(uint64_t),&nonce);
// printf("%02x",data[i]); if ( addr != 0 )
//printf(" addr recvlen.%d\n",recvlen);
len = iguana_rwvarint(0,data,&x);
for (i=0; i<x; i++)
{ {
memset(&A,0,sizeof(A)); //printf("%u got nonce.%llx from %s\n",(uint32_t)time(NULL),(long long)nonce,addr->ipaddr);
len += iguana_rwaddr(0,&data[len],&A,CADDR_TIME_VERSION);//(int32_t)addr->protover); if ( ishost != 0 )
iguana_gotaddr(coin,addr,&A); {
} iguana_gotping(coin,addr,nonce,data);
if ( len == recvlen ) addr->msgcounts.ping++;
{ }
addr->lastgotaddr = (uint32_t)time(NULL); else
addr->msgcounts.addr++; {
iguana_gotpong(coin,addr,nonce);
addr->msgcounts.pong++;
}
iguana_queue_send(addr,0,serialized,"getaddr",0);
} }
} }
else }
else if ( (ishost= (strcmp(H->command,"getaddr") == 0)) || strcmp(H->command,"addr") == 0 )
{
struct iguana_msgaddress A;
//printf("iguana_msgparser from (%s) parse.(%s) len.%d\n",addr->ipaddr,H->command,recvlen);
if ( addr != 0 )
{ {
len = 0; if ( ishost == 0 )
if ( (sendlen= iguana_peeraddrrequest(coin,addr,&addr->blockspace[sizeof(H)],IGUANA_MAXPACKETSIZE)) > 0 )
{ {
if ( 0 ) //for (i=0; i<recvlen; i++)
// printf("%02x",data[i]);
//printf(" addr recvlen.%d\n",recvlen);
len = iguana_rwvarint(0,data,&x);
for (i=0; i<x; i++)
{ {
int32_t checklen; uint32_t checkbits; char checkaddr[64]; memset(&A,0,sizeof(A));
checklen = iguana_rwvarint(0,&addr->blockspace[sizeof(H)],&x); len += iguana_rwaddr(0,&data[len],&A,CADDR_TIME_VERSION);//(int32_t)addr->protover);
printf("\nSENDING:\n"); iguana_gotaddr(coin,addr,&A);
for (i=0; i<sendlen; i++) }
printf("%02x",addr->blockspace[sizeof(H)+i]); if ( len == recvlen )
printf(" %p addr sendlen.%d N.%d\n",&addr->blockspace[sizeof(H)],sendlen,(int32_t)x); {
for (i=0; i<x; i++) addr->lastgotaddr = (uint32_t)time(NULL);
addr->msgcounts.addr++;
}
}
else
{
len = 0;
if ( (sendlen= iguana_peeraddrrequest(coin,addr,&addr->blockspace[sizeof(H)],IGUANA_MAXPACKETSIZE)) > 0 )
{
if ( 0 )
{ {
memset(&A,0,sizeof(A)); int32_t checklen; uint32_t checkbits; char checkaddr[64];
checklen += iguana_rwaddr(0,&addr->blockspace[sizeof(H) + checklen],&A,CADDR_TIME_VERSION); checklen = iguana_rwvarint(0,&addr->blockspace[sizeof(H)],&x);
iguana_rwnum(0,&A.ip[12],sizeof(uint32_t),&checkbits); printf("\nSENDING:\n");
expand_ipbits(checkaddr,checkbits); for (i=0; i<sendlen; i++)
printf("checkaddr.(%s:%02x%02x) ",checkaddr,((uint8_t *)&A.port)[1],((uint8_t *)&A.port)[0]); printf("%02x",addr->blockspace[sizeof(H)+i]);
printf(" %p addr sendlen.%d N.%d\n",&addr->blockspace[sizeof(H)],sendlen,(int32_t)x);
for (i=0; i<x; i++)
{
memset(&A,0,sizeof(A));
checklen += iguana_rwaddr(0,&addr->blockspace[sizeof(H) + checklen],&A,CADDR_TIME_VERSION);
iguana_rwnum(0,&A.ip[12],sizeof(uint32_t),&checkbits);
expand_ipbits(checkaddr,checkbits);
printf("checkaddr.(%s:%02x%02x) ",checkaddr,((uint8_t *)&A.port)[1],((uint8_t *)&A.port)[0]);
}
printf("x.%d\n",(int32_t)x);
} }
printf("x.%d\n",(int32_t)x); retval = iguana_queue_send(addr,0,addr->blockspace,"addr",sendlen);
} }
retval = iguana_queue_send(addr,0,addr->blockspace,"addr",sendlen,0,0); addr->msgcounts.getaddr++;
} }
addr->msgcounts.getaddr++;
} }
//printf("%s -> addr recvlen.%d num.%d\n",addr->ipaddr,recvlen,(int32_t)x);
} }
//printf("%s -> addr recvlen.%d num.%d\n",addr->ipaddr,recvlen,(int32_t)x); else if ( strcmp(H->command,"notfound") == 0 )
}
else if ( strcmp(H->command,"notfound") == 0 )
{
if ( addr != 0 )
{ {
printf("%s SERVER notfound\n",addr->ipaddr); if ( addr != 0 )
intvectors = 'N', addr->msgcounts.notfound++; {
len = iguana_intvectors(coin,addr,1,data,recvlen); printf("%s SERVER notfound\n",addr->ipaddr);
intvectors = 'N', addr->msgcounts.notfound++;
len = iguana_intvectors(coin,addr,1,data,recvlen);
}
} }
} else if ( strcmp(H->command,"mempool") == 0 )
else if ( strcmp(H->command,"mempool") == 0 )
{
if ( addr != 0 )
{ {
printf("%s SERVER mempool\n",addr->ipaddr); if ( addr != 0 )
srvmsg = 'M', addr->msgcounts.mempool++; {
printf("%s SERVER mempool\n",addr->ipaddr);
srvmsg = 'M', addr->msgcounts.mempool++;
}
} }
} else if ( strcmp(H->command,"tx") == 0 )
else if ( strcmp(H->command,"tx") == 0 )
{
struct iguana_msgtx *tx;
iguana_memreset(rawmem);
tx = iguana_memalloc(rawmem,sizeof(*tx),1);//mycalloc('u',1,sizeof(*tx));
len = iguana_rwtx(0,rawmem,data,tx,recvlen,&tx->txid,coin->chain->hastimestamp,strcmp(coin->symbol,"VPN")==0);
if ( addr != 0 )
{ {
iguana_gotunconfirmedM(coin,addr,tx,data,recvlen); struct iguana_msgtx *tx;
printf("tx recvlen.%d vs len.%d\n",recvlen,len); iguana_memreset(rawmem);
addr->msgcounts.tx++; tx = iguana_memalloc(rawmem,sizeof(*tx),1);//mycalloc('u',1,sizeof(*tx));
len = iguana_rwtx(0,rawmem,data,tx,recvlen,&tx->txid,coin->chain->hastimestamp,strcmp(coin->symbol,"VPN")==0);
if ( addr != 0 )
{
iguana_gotunconfirmedM(coin,addr,tx,data,recvlen);
printf("tx recvlen.%d vs len.%d\n",recvlen,len);
addr->msgcounts.tx++;
}
} }
} else if ( addr != 0 && strcmp(H->command,"ConnectTo") == 0 )
else if ( addr != 0 && strcmp(H->command,"ConnectTo") == 0 ) {
{ iguana_queue_send(addr,0,serialized,"getaddr",0);
iguana_queue_send(addr,0,serialized,"getaddr",0,0,0); len = 6;
len = 6; }
} else if ( strcmp(H->command,"reject") == 0 )
else if ( strcmp(H->command,"reject") == 0 )
{
if ( addr != 0 )
{ {
if ( strncmp((char *)data+1,"headers",7) == 0 ) if ( addr != 0 )
addr->headerserror++;
else
{ {
for (i=0; i<recvlen; i++) if ( strncmp((char *)data+1,"headers",7) == 0 )
printf("%02x ",data[i]); addr->headerserror++;
printf("reject.(%s) recvlen.%d %s proto.%d\n",data+1,recvlen,addr->ipaddr,addr->protover); else
addr->msgcounts.reject++; {
for (i=0; i<recvlen; i++)
printf("%02x ",data[i]);
printf("reject.(%s) recvlen.%d %s proto.%d\n",data+1,recvlen,addr->ipaddr,addr->protover);
addr->msgcounts.reject++;
}
} }
len = recvlen;
}
else if ( strcmp(H->command,"alert") == 0 )
{
struct iguana_msgalert alert;
memset(&alert,0,sizeof(alert));
len = iguana_rwmsgalert(coin,0,data,&alert);
if ( len == recvlen && addr != 0 )
addr->msgcounts.alert++;
}
else if ( addr != 0 )
{
if ( strcmp(H->command,"filterload") == 0 ) // for bloom
bloom = 'L', addr->msgcounts.filterload++;
else if ( strcmp(H->command,"filteradd") == 0 ) // for bloom
bloom = 'A', addr->msgcounts.filteradd++;
else if ( strcmp(H->command,"filterclear") == 0 ) // for bloom
bloom = 'C', addr->msgcounts.filterclear++;
else if ( strcmp(H->command,"merkleblock") == 0 ) // for bloom
bloom = 'M', addr->msgcounts.merkleblock++;
}
if ( bloom >= 0 || srvmsg >= 0 )
len = recvlen; // just mark as valid
if ( len != recvlen && len != recvlen-1 && len != recvlen-2 )
{
//printf("error.(%s) (%s): len.%d != recvlen.%d\n",H->command,addr->ipaddr,len,recvlen);
//for (i=0; i<len; i++)
// printf("%02x",data[i]);
if ( strcmp(H->command,"addr") != 0 && (coin->chain->auxpow == 0 || strcmp(H->command,"headers") != 0) )
printf("%s %s.%s len mismatch %d != %d\n",coin->symbol,addr!=0?addr->ipaddr:"local",H->command,len,recvlen);
}
else if ( len != recvlen )
{
printf("%s extra byte.[%02x] command.%s len.%d recvlen.%d\n",addr->ipaddr,data[recvlen-1],H->command,len,recvlen);
//retval = -1;
} }
len = recvlen;
}
else if ( strcmp(H->command,"alert") == 0 )
{
struct iguana_msgalert alert;
memset(&alert,0,sizeof(alert));
len = iguana_rwmsgalert(coin,0,data,&alert);
if ( len == recvlen && addr != 0 )
addr->msgcounts.alert++;
}
else if ( addr != 0 )
{
if ( strcmp(H->command,"filterload") == 0 ) // for bloom
bloom = 'L', addr->msgcounts.filterload++;
else if ( strcmp(H->command,"filteradd") == 0 ) // for bloom
bloom = 'A', addr->msgcounts.filteradd++;
else if ( strcmp(H->command,"filterclear") == 0 ) // for bloom
bloom = 'C', addr->msgcounts.filterclear++;
else if ( strcmp(H->command,"merkleblock") == 0 ) // for bloom
bloom = 'M', addr->msgcounts.merkleblock++;
}
if ( bloom >= 0 || srvmsg >= 0 )
len = recvlen; // just mark as valid
if ( len != recvlen && len != recvlen-1 && len != recvlen-2 )
{
//printf("error.(%s) (%s): len.%d != recvlen.%d\n",H->command,addr->ipaddr,len,recvlen);
//for (i=0; i<len; i++)
// printf("%02x",data[i]);
if ( strcmp(H->command,"addr") != 0 && (coin->chain->auxpow == 0 || strcmp(H->command,"headers") != 0) )
printf("%s %s.%s len mismatch %d != %d\n",coin->symbol,addr!=0?addr->ipaddr:"local",H->command,len,recvlen);
}
else if ( len != recvlen )
{
printf("%s extra byte.[%02x] command.%s len.%d recvlen.%d\n",addr->ipaddr,data[recvlen-1],H->command,len,recvlen);
//retval = -1;
} }
return(retval); return(retval);
} }

2
iguana/iguana_payments.c

@ -307,7 +307,7 @@ bits256 iguana_sendrawtransaction(struct supernet_info *myinfo,struct iguana_inf
for (i=0; i<8; i++) for (i=0; i<8; i++)
{ {
if ( (addr= coin->peers.ranked[i]) != 0 && addr->dead == 0 && addr->usock >= 0 ) if ( (addr= coin->peers.ranked[i]) != 0 && addr->dead == 0 && addr->usock >= 0 )
iguana_queue_send(addr,0,serialized,"tx",len,0,0); iguana_queue_send(addr,0,serialized,"tx",len);
} }
free(serialized); free(serialized);
txid = bits256_doublesha256(0,&serialized[sizeof(struct iguana_msghdr)],len); txid = bits256_doublesha256(0,&serialized[sizeof(struct iguana_msghdr)],len);

23
iguana/iguana_peers.c

@ -20,19 +20,24 @@ struct iguana_iAddr *iguana_iAddrhashfind(struct iguana_info *coin,uint64_t ipbi
int32_t iguana_validatehdr(char *symbol,struct iguana_msghdr *H) int32_t iguana_validatehdr(char *symbol,struct iguana_msghdr *H)
{ {
int32_t i = 0,len = -1; int32_t i = 0,valid=0,len = -1;
if ( strcmp(symbol,"VPN") != 0 ) if ( strcmp(symbol,"VPN") == 0 || strncmp("SuperNET",H->command,strlen("SuperNET")) == 0 )
valid = 1;
else
{ {
for (i=0; Iguana_validcommands[i]!=0&&Iguana_validcommands[i][0]!=0; i++) for (i=0; Iguana_validcommands[i]!=0&&Iguana_validcommands[i][0]!=0; i++)
if ( strcmp(H->command,Iguana_validcommands[i]) == 0 ) if ( strcmp(H->command,Iguana_validcommands[i]) == 0 )
{
valid = 1;
break; break;
}
} }
if ( Iguana_validcommands[i][0] != 0 ) if ( valid != 0 )
{ {
iguana_rwnum(0,H->serdatalen,sizeof(H->serdatalen),(uint32_t *)&len); iguana_rwnum(0,H->serdatalen,sizeof(H->serdatalen),(uint32_t *)&len);
if ( len > IGUANA_MAXPACKETSIZE ) if ( len > IGUANA_MAXPACKETSIZE )
return(-1); return(-1);
} } else return(-1);
return(len); return(len);
} }
@ -455,7 +460,7 @@ int32_t iguana_send(struct iguana_info *coin,struct iguana_peer *addr,uint8_t *s
return(len); return(len);
} }
int32_t iguana_queue_send(struct iguana_peer *addr,int32_t delay,uint8_t *serialized,char *cmd,int32_t len,int32_t getdatablock,int32_t forceflag) int32_t iguana_queue_send(struct iguana_peer *addr,int32_t delay,uint8_t *serialized,char *cmd,int32_t len)
{ {
struct iguana_packet *packet; int32_t datalen; struct iguana_packet *packet; int32_t datalen;
if ( addr == 0 ) if ( addr == 0 )
@ -464,18 +469,10 @@ int32_t iguana_queue_send(struct iguana_peer *addr,int32_t delay,uint8_t *serial
exit(-1); exit(-1);
return(-1); return(-1);
} }
else if ( forceflag != 0 )
{
//printf("forceflag not supported\n");
//return(iguana_send(coin,addr,serialized,len));
}
if ( (datalen= iguana_sethdr((void *)serialized,addr->netmagic,cmd,&serialized[sizeof(struct iguana_msghdr)],len)) < 0 ) if ( (datalen= iguana_sethdr((void *)serialized,addr->netmagic,cmd,&serialized[sizeof(struct iguana_msghdr)],len)) < 0 )
return(-1); return(-1);
if ( strcmp("getaddr",cmd) == 0 && time(NULL) < addr->lastgotaddr+300 ) if ( strcmp("getaddr",cmd) == 0 && time(NULL) < addr->lastgotaddr+300 )
return(0); return(0);
//if ( strcmp("version",cmd) == 0 )
// return(iguana_send(coin,addr,serialized,datalen));
packet = mycalloc('S',1,sizeof(struct iguana_packet) + datalen); packet = mycalloc('S',1,sizeof(struct iguana_packet) + datalen);
packet->datalen = datalen; packet->datalen = datalen;
packet->addr = addr; packet->addr = addr;

2
iguana/iguana_tx.c

@ -303,7 +303,7 @@ int32_t iguana_peerblockrequest(struct iguana_info *coin,uint8_t *blockspace,int
if ( (checklen= iguana_gentxarray(coin,&RAWMEM,&txdata,&checklen,&blockspace[sizeof(struct iguana_msghdr)],total)) != total ) if ( (checklen= iguana_gentxarray(coin,&RAWMEM,&txdata,&checklen,&blockspace[sizeof(struct iguana_msghdr)],total)) != total )
printf("Error reconstructing txarray checklen.%d total.%d\n",checklen,total); printf("Error reconstructing txarray checklen.%d total.%d\n",checklen,total);
} }
return(iguana_queue_send(addr,0,blockspace,"block",total,0,0)); return(iguana_queue_send(addr,0,blockspace,"block",total));
} }
else else
{ {

2
iguana/main.c

@ -53,7 +53,7 @@ int32_t myfclose(FILE *fp)
// ALL globals must be here! // ALL globals must be here!
char *Iguana_validcommands[] = char *Iguana_validcommands[] =
{ {
"SuperNET", "SuperNETb", "inv2", "getdata2", "InstantDEX", "pangea", "quote", "ConnectTo", "SuperNET", "inv2", "getdata2", "ConnectTo",
"version", "verack", "getaddr", "addr", "inv", "getdata", "notfound", "getblocks", "getheaders", "headers", "tx", "block", "mempool", "ping", "pong", "version", "verack", "getaddr", "addr", "inv", "getdata", "notfound", "getblocks", "getheaders", "headers", "tx", "block", "mempool", "ping", "pong",
"reject", "filterload", "filteradd", "filterclear", "merkleblock", "alert", "" "reject", "filterload", "filteradd", "filterclear", "merkleblock", "alert", ""
}; };

Loading…
Cancel
Save