From 923e97ab1bfbe5930d5edcf51eedeb759e9dce9a Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 6 Apr 2016 19:16:55 -0500 Subject: [PATCH] test --- iguana/iguana_bundles.c | 31 +++++++++++++++++-------------- iguana/iguana_recv.c | 2 +- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/iguana/iguana_bundles.c b/iguana/iguana_bundles.c index 9102b8526..e3dbf552b 100755 --- a/iguana/iguana_bundles.c +++ b/iguana/iguana_bundles.c @@ -828,21 +828,24 @@ int32_t iguana_bundlefinalize(struct iguana_info *coin,struct iguana_bundle *bp, return(0); } bp->emitfinish = 1; - iguana_bundletweak(coin,bp); - //sleep(3); // just in case data isnt totally sync'ed to HDD - coin->emitbusy++; - if ( iguana_bundlesaveHT(coin,mem,memB,bp,(uint32_t)time(NULL)) == 0 ) + sleep(3); // make sure new incoming packet didnt overwrite + if ( iguana_bundleready(coin,bp) == bp->n ) { - //fprintf(stderr,"emitQ done coin.%p bp.[%d] ht.%d\n",coin,bp->hdrsi,bp->bundleheight); - bp->emitfinish = (uint32_t)time(NULL) + 1; - coin->numemitted++; - } - else - { - fprintf(stderr,"emitQ done coin.%p bp.[%d] ht.%d error\n",coin,bp->hdrsi,bp->bundleheight); - bp->emitfinish = 0; - } - coin->emitbusy--; + coin->emitbusy++; + if ( iguana_bundlesaveHT(coin,mem,memB,bp,(uint32_t)time(NULL)) == 0 ) + { + //fprintf(stderr,"emitQ done coin.%p bp.[%d] ht.%d\n",coin,bp->hdrsi,bp->bundleheight); + bp->emitfinish = (uint32_t)time(NULL) + 1; + iguana_bundletweak(coin,bp); + coin->numemitted++; + } + else + { + fprintf(stderr,"emitQ done coin.%p bp.[%d] ht.%d error\n",coin,bp->hdrsi,bp->bundleheight); + bp->emitfinish = 0; + } + coin->emitbusy--; + } else printf("interloper! [%d] save interupted\n",bp->hdrsi); } return(1); } diff --git a/iguana/iguana_recv.c b/iguana/iguana_recv.c index 71f5921cb..f7f4b7833 100755 --- a/iguana/iguana_recv.c +++ b/iguana/iguana_recv.c @@ -1085,7 +1085,7 @@ int32_t iguana_reqblocks(struct iguana_info *coin) { hdrsi0 = (coin->blocks.hwmchain.height) / coin->chain->bundlesize; bundlei0 = (coin->blocks.hwmchain.height) % coin->chain->bundlesize; - if ( (block= iguana_bundleblock(coin,&hash2,coin->bundles[hdrsi0],bundlei0)) == 0 ) + if ( coin->bundles[hdrsi0] != 0 && (block= iguana_bundleblock(coin,&hash2,coin->bundles[hdrsi0],bundlei0)) != 0 ) next = block->hh.next; //, next/block->mainchain = 1; } }