From 979813418f1dd2a0bdf63808cf344d9e4dc0647a Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 13 Jan 2016 15:45:00 -0300 Subject: [PATCH] test --- iguana/iguana777.c | 1 + iguana/iguana_recv.c | 14 ++++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/iguana/iguana777.c b/iguana/iguana777.c index 39f809936..820f55ad2 100755 --- a/iguana/iguana777.c +++ b/iguana/iguana777.c @@ -250,6 +250,7 @@ void iguana_mergeQ(struct iguana_info *coin,struct iguana_bundle *bp,struct igua void iguana_bundleQ(struct iguana_info *coin,struct iguana_bundle *bp,int32_t timelimit) { struct iguana_helper *ptr; + bp->queued = (uint32_t)time(NULL); ptr = mycalloc('i',1,sizeof(*ptr)); ptr->allocsize = sizeof(*ptr); ptr->coin = coin; diff --git a/iguana/iguana_recv.c b/iguana/iguana_recv.c index b166b19f8..4bfbf6855 100755 --- a/iguana/iguana_recv.c +++ b/iguana/iguana_recv.c @@ -309,7 +309,6 @@ uint32_t iguana_allhashcmp(struct iguana_info *coin,struct iguana_bundle *bp,bit // iguana_blockQ(coin,bp,i,block->RO.hash2,1), n++; } //printf("ALLHASHES FOUND! %d requested.%d\n",bp->bundleheight,n); - bp->queued = (uint32_t)time(NULL); iguana_bundleQ(coin,bp,500 + (rand() % 500)); return(bp->queued); } @@ -381,7 +380,7 @@ struct iguana_bundle *iguana_bundleset(struct iguana_info *coin,struct iguana_bl struct iguana_bundlereq *iguana_recvblockhdrs(struct iguana_info *coin,struct iguana_bundlereq *req,struct iguana_block *blocks,int32_t n,int32_t *newhwmp) { - int32_t i,bundlei; struct iguana_block *block; struct iguana_bundle *bp; + int32_t i,bundlei,match; struct iguana_block *block; struct iguana_bundle *bp,*firstbp = 0; if ( blocks == 0 ) { printf("iguana_recvblockhdrs null blocks?\n"); @@ -389,16 +388,19 @@ struct iguana_bundlereq *iguana_recvblockhdrs(struct iguana_info *coin,struct ig } if ( blocks != 0 && n > 0 ) { - for (i=0; ihdrsi < IGUANA_MAXACTIVEBUNDLES ) + if ( (bp= iguana_bundleset(coin,&block,&bundlei,&blocks[i])) != 0 ) { - //iguana_blockQ(coin,bp,bundlei,blocks[i].RO.hash2,1); if ( i == 0 ) - printf("GOT HDRS[%d] Q.(%d %d) ht.%d hashes.%d recv.%d\n",n,queue_size(&coin->priorityQ),queue_size(&coin->blocksQ),bp->bundleheight,bp->numhashes,bp->numrecv); + firstbp = bp; + if ( bundlei == i && bp == firstbp ) + match++; } } + if ( match == n && n == firstbp->n & firstbp->queued == 0 ) + iguana_bundleQ(coin,firstbp,1000 + 10*(rand() % (int32_t)(1+sqrt(bp->bundleheight)))); } return(req); }