From e89441c160661c6570b6729bcf7c1065d258cc88 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 19 Mar 2016 03:37:21 -0300 Subject: [PATCH] test --- iguana/iguana777.c | 2 +- iguana/iguana_bundles.c | 12 +++++++----- iguana/iguana_recv.c | 9 ++++++++- iguana/main.c | 6 +++--- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/iguana/iguana777.c b/iguana/iguana777.c index 8d72820e5..743e72810 100755 --- a/iguana/iguana777.c +++ b/iguana/iguana777.c @@ -502,7 +502,7 @@ void iguana_coinloop(void *arg) coin->polltimeout = 100; coin->MAXPEERS = 8; } - if ( coin->isRT != 0 && coin->numverified >= coin->bundlescount-1 ) + if ( coin->isRT != 0 && coin->current != 0 && coin->numverified >= coin->current->hdrsi ) { static int32_t saved; if ( saved++ == 0 ) diff --git a/iguana/iguana_bundles.c b/iguana/iguana_bundles.c index 2cda9747e..e400e103f 100755 --- a/iguana/iguana_bundles.c +++ b/iguana/iguana_bundles.c @@ -379,10 +379,12 @@ int32_t iguana_bundleissue(struct iguana_info *coin,struct iguana_bundle *bp,int else starti = 0; lag = (bp->hdrsi - starti); lag *= lag; - if ( lag < 30 ) - lag = 30; - else if ( lag > 600 ) - lag = 600; + if ( (i= sqrt(bp->hdrsi)) < 2 ) + i = 2; + if ( lag < i ) + lag = i; + else if ( lag > 10*i ) + lag = 10*i; if ( (numpeers= coin->peers.numranked) > 8 )//&& bp->currentflag < bp->n ) { if ( bp->currentflag == 0 ) @@ -714,7 +716,7 @@ int32_t iguana_bundleiters(struct iguana_info *coin,struct iguana_bundle *bp,int } retval = 1; } - else if ( bp->hdrsi >= starti && bp->hdrsi <= starti+range ) + else if ( bp->hdrsi > starti && bp->hdrsi <= starti+range ) { max = sqrt(bp->n) - (bp->n/coin->MAXBUNDLES)*(bp->hdrsi - starti); if ( max > 100 ) diff --git a/iguana/iguana_recv.c b/iguana/iguana_recv.c index 56bf510a8..2dab808da 100755 --- a/iguana/iguana_recv.c +++ b/iguana/iguana_recv.c @@ -861,6 +861,13 @@ int32_t iguana_reqblocks(struct iguana_info *coin) printf("MAINCHAIN skip issue %d\n",bundlei+1); iguana_blockQ("mainskip",coin,bp,bundlei,bp->hashes[bundlei+1],0); } + else if ( bp != 0 && time(NULL) > bp->hdrtime+10 ) + { + char str[65]; + printf("MAINCHAIN gethdr %d\n",bp->bundleheight); + queue_enqueue("hdrsQ",&coin->hdrsQ,queueitem(bits256_str(str,bp->hashes[0])),1); + bp->hdrtime = (uint32_t)time(NULL); + } } } } @@ -927,7 +934,7 @@ int32_t iguana_reqhdrs(struct iguana_info *coin) int32_t i,lag,n = 0; struct iguana_bundle *bp; char hashstr[65]; if ( queue_size(&coin->hdrsQ) == 0 ) { - //if ( iguana_needhdrs(coin) > 0 ) + if ( iguana_needhdrs(coin) > 0 ) { for (i=0; ibundlescount; i++) { diff --git a/iguana/main.c b/iguana/main.c index 6cc7710cc..9f022b670 100755 --- a/iguana/main.c +++ b/iguana/main.c @@ -325,7 +325,7 @@ void sigcontinue_func() { printf("\nSIGCONT\n"); signal(SIGCONT,sigcontinue_func void mainloop(struct supernet_info *myinfo) { - int32_t i,flag; struct iguana_info *coin; struct iguana_helper *ptr; + int32_t i,flag; struct iguana_info *coin; struct iguana_helper *ptr; struct iguana_bundle *bp; sleep(3); printf("mainloop\n"); while ( 1 ) @@ -334,9 +334,9 @@ void mainloop(struct supernet_info *myinfo) if ( 1 ) { for (i=0; iactive != 0 )//&& (bp= coin->current) != 0 ) + if ( (coin= Coins[i]) != 0 && coin->active != 0 && (bp= coin->current) != 0 ) { - //iguana_bundleissue(coin,bp,bp->n,100); + iguana_bundleissue(coin,bp,bp->n,100); if ( (ptr= queue_dequeue(&balancesQ,0)) != 0 ) { if ( ptr->bp != 0 && ptr->coin != 0 )