From 551d79357f43e884d98bf4a62bca93c5077a0bf4 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 10 May 2016 18:43:41 -0500 Subject: [PATCH] test --- iguana/iguana777.c | 5 +++++ iguana/iguana_json.c | 5 ++++- iguana/iguana_msg.c | 2 +- iguana/iguana_peers.c | 4 ++-- iguana/iguana_recv.c | 2 +- 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/iguana/iguana777.c b/iguana/iguana777.c index 9c1d51267..c7ff74be9 100755 --- a/iguana/iguana777.c +++ b/iguana/iguana777.c @@ -235,6 +235,11 @@ uint32_t iguana_updatemetrics(struct iguana_info *coin) { expand_ipbits(ipaddr,(uint32_t)addr->ipbits); fprintf(fp,"%s\n",ipaddr); + if ( addr->msgcounts.verack == 0 ) + { + printf("iguana_sendblockreq (%s) addrind.%d hasn't verack'ed yet\n",addr->ipaddr,addr->addrind); + iguana_send_version(coin,addr,coin->myservices); + } } } } diff --git a/iguana/iguana_json.c b/iguana/iguana_json.c index 9d7ab2f86..d36f7805f 100755 --- a/iguana/iguana_json.c +++ b/iguana/iguana_json.c @@ -664,8 +664,11 @@ TWO_STRINGS(iguana,addnode,activecoin,ipaddr) if ( coin != 0 && ipaddr != 0 && is_ipaddr(ipaddr) != 0 ) { //iguana_possible_peer(coin,ipaddr); - if ( (addr= iguana_peerslot(coin,(uint32_t)calc_ipbits(ipaddr),0)) != 0 ) + if ( (addr= iguana_peerslot(coin,(uint32_t)calc_ipbits(ipaddr),1)) != 0 ) { + addr->supernet = 1; + if ( addr->usock >= 0 ) + return(clonestr("{\"result\":\"peer was already connected\"}")); if ( addr->pending == 0 ) { addr->pending = (uint32_t)time(NULL); diff --git a/iguana/iguana_msg.c b/iguana/iguana_msg.c index 2c5a0b6b6..3a2267fb7 100755 --- a/iguana/iguana_msg.c +++ b/iguana/iguana_msg.c @@ -171,7 +171,7 @@ void iguana_gotversion(struct iguana_info *coin,struct iguana_peer *addr,struct addr->dead = (uint32_t)time(NULL); if ( (vers->nServices & (1<<7)) == (1<<7) ) addr->supernet = 1; - if ( addr->supernet != 0 ) + //if ( addr->supernet != 0 ) printf("height.%d nServices.%lld nonce.%llu %srelay node.(%s) supernet.%d\n",vers->nStartingHeight,(long long)vers->nServices,(long long)vers->nonce,addr->relayflag==0?"non-":"",addr->ipaddr,addr->supernet); if ( (int32_t)vers->nStartingHeight > coin->longestchain ) { diff --git a/iguana/iguana_peers.c b/iguana/iguana_peers.c index 9e9b694e0..3967bd8d0 100755 --- a/iguana/iguana_peers.c +++ b/iguana/iguana_peers.c @@ -653,7 +653,7 @@ void iguana_startconnection(void *arg) if ( addr->usock < 0 || coin->peers.shuttingdown != 0 ) { strcpy(ipaddr,addr->ipaddr); - //printf("refused PEER KILLED. slot.%d for %s:%d usock.%d\n",addr->addrind,ipaddr,coin->chain->portp2p,addr->usock); + printf("refused PEER KILLED. slot.%d for %s:%d usock.%d\n",addr->addrind,ipaddr,coin->chain->portp2p,addr->usock); iguana_iAkill(coin,addr,1); } else @@ -1085,7 +1085,7 @@ void iguana_dedicatedloop(struct supernet_info *myinfo,struct iguana_info *coin, else { iguana_send_version(coin,addr,coin->myservices); - //printf("send version myservices.%llu to (%s)\n",(long long)coin->myservices,addr->ipaddr); + printf("send version myservices.%llu to (%s)\n",(long long)coin->myservices,addr->ipaddr); } //sleep(1+(rand()%5)); //iguana_queue_send(coin,addr,0,serialized,"getaddr",0,0,0); diff --git a/iguana/iguana_recv.c b/iguana/iguana_recv.c index 91a932277..7005ed871 100755 --- a/iguana/iguana_recv.c +++ b/iguana/iguana_recv.c @@ -88,7 +88,7 @@ int32_t iguana_sendblockreqPT(struct iguana_info *coin,struct iguana_peer *addr, if ( addr->msgcounts.verack == 0 ) { //printf("iguana_sendblockreq (%s) addrind.%d hasn't verack'ed yet\n",addr->ipaddr,addr->addrind); - //iguana_send_version(coin,addr,coin->myservices); + iguana_send_version(coin,addr,coin->myservices); return(-1); } lastreq2 = lastreq;