Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
2eddc1d57e
  1. 3
      iguana/iguana777.h
  2. 8
      iguana/iguana_msg.c
  3. 15
      iguana/iguana_recv.c

3
iguana/iguana777.h

@ -461,7 +461,8 @@ struct iguana_info
uint64_t instance_nonce,myservices,totalsize,totalrecv,totalpackets,sleeptime; uint64_t instance_nonce,myservices,totalsize,totalrecv,totalpackets,sleeptime;
int64_t mining,totalfees,TMPallocated,MAXRECVCACHE,MAXMEM,estsize,activebundles; int64_t mining,totalfees,TMPallocated,MAXRECVCACHE,MAXMEM,estsize,activebundles;
int32_t MAXPEERS,MAXPENDING,MAXBUNDLES,active,closestbundle,numemitted,lastsweep,startutc,newramchain,numcached,cachefreed,helperdepth,startPEND,endPEND,enableCACHE,RELAYNODE,VALIDATENODE,balanceswritten,RTheight; bits256 balancehash; int32_t MAXPEERS,MAXPENDING,MAXBUNDLES,active,closestbundle,numemitted,lastsweep,startutc,newramchain,numcached,cachefreed,helperdepth,startPEND,endPEND,enableCACHE,RELAYNODE,VALIDATENODE,balanceswritten,RTheight; bits256 balancehash;
uint32_t longestchain,lastsync,parsetime,numiAddrs,firstblock,lastpossible,bundlescount,savedblocks; uint32_t lastsync,parsetime,numiAddrs,firstblock,lastpossible,bundlescount,savedblocks;
int32_t longestchain,badlongestchain,longestchain_strange;
struct tai starttime; double startmillis; struct tai starttime; double startmillis;
struct iguana_chain *chain; struct iguana_chain *chain;
struct iguana_iAddr *iAddrs; struct iguana_iAddr *iAddrs;

8
iguana/iguana_msg.c

@ -172,7 +172,13 @@ void iguana_gotversion(struct iguana_info *coin,struct iguana_peer *addr,struct
addr->supernet = 1; addr->supernet = 1;
//else printf("nServices.%lld nonce.%llu %srelay node.(%s) supernet.%d\n",(long long)vers->nServices,(long long)vers->nonce,addr->relayflag==0?"non-":"",addr->ipaddr,addr->supernet); //else printf("nServices.%lld nonce.%llu %srelay node.(%s) supernet.%d\n",(long long)vers->nServices,(long long)vers->nonce,addr->relayflag==0?"non-":"",addr->ipaddr,addr->supernet);
if ( vers->nStartingHeight > coin->longestchain ) if ( vers->nStartingHeight > coin->longestchain )
coin->longestchain = (vers->nStartingHeight + coin->longestchain + 1) >> 1; {
if ( coin->badlongestchain != 0 && vers->nStartingHeight >= coin->badlongestchain )
{
printf("peer.(%s) gives badlongestchain.%d\n",addr->ipaddr,vers->nStartingHeight);
addr->dead = 1;
} else coin->longestchain = (vers->nStartingHeight + coin->longestchain + 1) >> 1;
}
iguana_queue_send(coin,addr,0,serialized,"getaddr",0,0,0); iguana_queue_send(coin,addr,0,serialized,"getaddr",0,0,0);
} }

15
iguana/iguana_recv.c

@ -630,7 +630,20 @@ struct iguana_bundlereq *iguana_recvblockhashes(struct iguana_info *coin,struct
return(req); return(req);
//printf("done allhashes\n"); //printf("done allhashes\n");
} }
if ( bp != 0 && (bp->speculative == 0 || num > bp->numspec) && bp->emitfinish == 0 ) else if ( bp->hdrsi == coin->bundlescount-1 )
{
if ( num < bp->n && coin->longestchain > bp->bundleheight+bp->n )
{
printf("suspicious longestchain.%d vs [%d:%d] %d\n",coin->longestchain,bp->hdrsi,num,bp->bundleheight+num);
if ( coin->longestchain_strange++ > 10 )
{
coin->badlongestchain = coin->longestchain;
coin->longestchain = bp->bundleheight+num;
coin->longestchain_strange = 0;
}
}
}
if ( (bp->speculative == 0 || num > bp->numspec) && bp->emitfinish == 0 )
{ {
//printf("FOUND speculative.%s BLOCKHASHES[%d] ht.%d\n",bits256_str(str,blockhashes[1]),num,bp->bundleheight); //printf("FOUND speculative.%s BLOCKHASHES[%d] ht.%d\n",bits256_str(str,blockhashes[1]),num,bp->bundleheight);
if ( bp->speculative == 0 ) if ( bp->speculative == 0 )

Loading…
Cancel
Save