From 9668b78f4c46fbf770ab09fa2b5f1a697850b4f5 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 13 Mar 2016 00:38:15 -0300 Subject: [PATCH] test --- iguana/iguana777.h | 4 ++-- iguana/iguana_recv.c | 14 ++++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/iguana/iguana777.h b/iguana/iguana777.h index 7d7a9f35a..6c01eadc0 100755 --- a/iguana/iguana777.h +++ b/iguana/iguana777.h @@ -38,8 +38,8 @@ typedef int32_t (*blockhashfunc)(uint8_t *blockhashp,uint8_t *serialized,int32_t #define IGUANA_TAILPERCENTAGE 1.0 #define IGUANA_MAXPENDHDRS 1 #define _IGUANA_MAXPENDING 13 -#define IGUANA_MAXPENDBUNDLES 1000 -#define IGUANA_BUNDLELOOP 64 +#define IGUANA_MAXPENDBUNDLES 128 +#define IGUANA_BUNDLELOOP 7 #define IGUANA_RPCPORT 7778 #define IGUANA_MAXRAMCHAINSIZE ((uint64_t)1024L * 1024L * 1024L * 16) diff --git a/iguana/iguana_recv.c b/iguana/iguana_recv.c index 7c2978c1f..e21df0787 100755 --- a/iguana/iguana_recv.c +++ b/iguana/iguana_recv.c @@ -154,7 +154,7 @@ struct iguana_txblock *iguana_peertxdata(struct iguana_info *coin,int32_t *bundl } #endif -static int32_t BLOCKnet; +static int32_t netBLOCKS; void iguana_gotblockM(struct iguana_info *coin,struct iguana_peer *addr,struct iguana_txblock *origtxdata,struct iguana_msgtx *txarray,struct iguana_msghdr *H,uint8_t *data,int32_t recvlen) { struct iguana_bundlereq *req; struct iguana_txblock *txdata = 0; int32_t valid,i,j,bundlei,copyflag; char fname[1024]; @@ -244,7 +244,7 @@ void iguana_gotblockM(struct iguana_info *coin,struct iguana_peer *addr,struct i coin->recvcount++; coin->recvtime = (uint32_t)time(NULL); req->addr = addr; - BLOCKnet++; + netBLOCKS++; queue_enqueue("bundlesQ",&coin->bundlesQ,&req->DL,0); } @@ -271,7 +271,7 @@ void iguana_gotheadersM(struct iguana_info *coin,struct iguana_peer *addr,struct req = iguana_bundlereq(coin,addr,'H',0); req->blocks = blocks, req->n = n; HDRnet++; - //char str[65]; printf("PTblockhdrs.%s net.%d blocks.%d\n",bits256_str(str,blocks[0].RO.hash2),HDRnet,BLOCKnet); + //char str[65]; printf("PTblockhdrs.%s net.%d blocks.%d\n",bits256_str(str,blocks[0].RO.hash2),HDRnet,netBLOCKS); queue_enqueue("bundlesQ",&coin->bundlesQ,&req->DL,0); } @@ -566,7 +566,7 @@ int32_t iguana_bundleiters(struct iguana_info *coin,struct iguana_bundle *bp,int } else printf("error getting block (%d:%d) %p vs %p\n",bp->hdrsi,i,block,iguana_blockfind(coin,bp->hashes[i])); } // merkle - printf(">>>>>>>>>>>>>>>>>>>>>>> EMIT bundle.%d | 1st.%d h.%d s.[%d] maxbundles.%d NET.(h%d b%d)\n",bp->bundleheight,coin->current!=0?coin->current->hdrsi:-1,coin->current!=0?coin->current->numhashes:-1,coin->current!=0?coin->current->numsaved:-1,coin->MAXBUNDLES,HDRnet,BLOCKnet); + printf(">>>>>>>>>>>>>>>>>>>>>>> EMIT bundle.%d | 1st.%d h.%d s.[%d] maxbundles.%d NET.(h%d b%d)\n",bp->bundleheight,coin->current!=0?coin->current->hdrsi:-1,coin->current!=0?coin->current->numhashes:-1,coin->current!=0?coin->current->numsaved:-1,coin->MAXBUNDLES,HDRnet,netBLOCKS); bp->emitfinish = 1; coin->MAXBUNDLES++; sleep(1); @@ -697,7 +697,7 @@ struct iguana_bundlereq *iguana_recvblockhdrs(struct iguana_info *coin,struct ig } } else printf("blockhash[%d] cant be found\n",i); } - char str[65]; printf("blockhdrs.%s hdrsi.%d\n",bits256_str(str,blocks[0].RO.hash2),firstbp!=0?firstbp->hdrsi:-1); + //char str[65]; printf("blockhdrs.%s hdrsi.%d\n",bits256_str(str,blocks[0].RO.hash2),firstbp!=0?firstbp->hdrsi:-1); if ( firstbp != 0 && match == coin->chain->bundlesize-1 && n == firstbp->n ) { if ( firstbp->queued == 0 ) @@ -868,7 +868,7 @@ int32_t iguana_processbundlesQ(struct iguana_info *coin,int32_t *newhwmp) // sin //fprintf(stderr,"%s bundlesQ.%p type.%c n.%d\n",req->addr != 0 ? req->addr->ipaddr : "0",req,req->type,req->n); if ( req->type == 'B' ) // one block with all txdata { - BLOCKnet--; + netBLOCKS--; req = iguana_recvblock(coin,req->addr,req,&req->block,req->numtx,req->datalen,req->recvlen,newhwmp); flag++; } @@ -1112,6 +1112,8 @@ int32_t iguana_pollQsPT(struct iguana_info *coin,struct iguana_peer *addr) hashstr = 0; } } + if ( netBLOCKS > coin->MAXPEERS*coin->MAXPENDING ) + return(0); if ( (limit= addr->recvblocks) > coin->MAXPENDING ) limit = coin->MAXPENDING; if ( limit < 1 )