Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
f2e856a954
  1. 4
      iguana/SuperNET.c
  2. 1
      iguana/SuperNET.h
  3. 2
      iguana/iguana_peers.c

4
iguana/SuperNET.c

@ -169,7 +169,7 @@ cJSON *SuperNET_bits2json(struct supernet_info *myinfo,bits256 senderpub,bits256
int32_t numbits,iter,flag=0,len = 0; uint32_t crc,checkcrc; cJSON *json = cJSON_CreateObject(); int32_t numbits,iter,flag=0,len = 0; uint32_t crc,checkcrc; cJSON *json = cJSON_CreateObject();
int32_t i; for (i=0; i<datalen; i++) int32_t i; for (i=0; i<datalen; i++)
printf("%02x ",serialized[i]); printf("%02x ",serialized[i]);
printf("bits[%d] iscompressed.%d\n",datalen,iscompressed); printf("bits[%d] iscompressed.%d %llx %llx\n",datalen,iscompressed,(long long)senderpub.txid,(long long)sharedseed.txid);
if ( iscompressed != 0 ) if ( iscompressed != 0 )
{ {
numbits = serialized[2]; numbits = serialized[2];
@ -459,12 +459,12 @@ char *SuperNET_p2p(struct iguana_info *coin,struct iguana_peer *addr,int32_t *de
{ {
decode_hex((uint8_t *)&othercheckc,sizeof(othercheckc),checkstr); decode_hex((uint8_t *)&othercheckc,sizeof(othercheckc),checkstr);
checkc = SuperNET_checkc(myinfo,senderpub,j64bits(json,"tag")); checkc = SuperNET_checkc(myinfo,senderpub,j64bits(json,"tag"));
printf("validpub.%d: %x vs %x\n",addr->validpub,checkc,othercheckc);
if ( checkc == othercheckc ) if ( checkc == othercheckc )
{ {
if ( addr->validpub++ > 1 ) if ( addr->validpub++ > 1 )
addr->sharedseed = SuperNET_sharedseed(myinfo,senderpub); addr->sharedseed = SuperNET_sharedseed(myinfo,senderpub);
} else addr->validpub = 0; } else addr->validpub = 0;
printf("validpub.%d: %x vs %x shared.%llx\n",addr->validpub,checkc,othercheckc,(long long)addr->sharedseed.txid);
} }
maxdelay = juint(json,"maxdelay"); maxdelay = juint(json,"maxdelay");
printf("GOT >>>>>>>> SUPERNET P2P.(%s) from.%s\n",jprint(json,0),coin->symbol); printf("GOT >>>>>>>> SUPERNET P2P.(%s) from.%s\n",jprint(json,0),coin->symbol);

1
iguana/SuperNET.h

@ -31,6 +31,7 @@
#define nn_errstr() nn_strerror(nn_errno()) #define nn_errstr() nn_strerror(nn_errno())
#define MAX_SERVERNAME 128 #define MAX_SERVERNAME 128
#define SUPERNET_MAXRECVBUF (1024 * 1024 * 16) #define SUPERNET_MAXRECVBUF (1024 * 1024 * 16)
#define SUPERNET_PINGGAP 6
#define SUPERNET_FORWARD 2 #define SUPERNET_FORWARD 2
#define SUPERNET_ISMINE 1 #define SUPERNET_ISMINE 1

2
iguana/iguana_peers.c

@ -1000,7 +1000,7 @@ void iguana_dedicatedloop(struct iguana_info *coin,struct iguana_peer *addr)
} }
if ( flag != 0 ) if ( flag != 0 )
run = 0; run = 0;
else if ( addr->supernet != 0 && time(NULL) > lastping+60 ) else if ( addr->supernet != 0 && time(NULL) > lastping+SUPERNET_PINGGAP )
{ {
iguana_send_supernet(coin,addr,"{\"agent\":\"SuperNET\",\"method\":\"getpeers\"}",0); iguana_send_supernet(coin,addr,"{\"agent\":\"SuperNET\",\"method\":\"getpeers\"}",0);
lastping = (uint32_t)time(NULL); lastping = (uint32_t)time(NULL);

Loading…
Cancel
Save