Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
f178fb645c
  1. 2
      iguana/iguana777.h
  2. 6
      iguana/iguana_bundles.c
  3. 21
      iguana/iguana_recv.c

2
iguana/iguana777.h

@ -40,7 +40,7 @@ typedef int32_t (*blockhashfunc)(uint8_t *blockhashp,uint8_t *serialized,int32_t
#define _IGUANA_MAXPENDING 3 #define _IGUANA_MAXPENDING 3
#define IGUANA_MINPENDBUNDLES 16 #define IGUANA_MINPENDBUNDLES 16
#define IGUANA_MAXPENDBUNDLES 64 #define IGUANA_MAXPENDBUNDLES 64
#define IGUANA_BUNDLELOOP 7777 #define IGUANA_BUNDLELOOP 777
#define IGUANA_RPCPORT 7778 #define IGUANA_RPCPORT 7778
#define IGUANA_MAXRAMCHAINSIZE ((uint64_t)1024L * 1024L * 1024L * 16) #define IGUANA_MAXRAMCHAINSIZE ((uint64_t)1024L * 1024L * 1024L * 16)

6
iguana/iguana_bundles.c

@ -419,7 +419,7 @@ int64_t iguana_bundlecalcs(struct iguana_info *coin,struct iguana_bundle *bp,int
bp->checkedtmp++; bp->checkedtmp++;
} }
} }
bp->estsize = (bp->datasize * bp->n) / (bp->numrecv+1); bp->estsize = ((int64_t)bp->datasize * bp->n) / (bp->numrecv+1);
//bp->metric = bp->numhashes; //bp->metric = bp->numhashes;
bp->metric = coin->bundlescount - bp->hdrsi;//1000 + sqrt(sqrt(bp->n * (1 + bp->numsaved + bp->numrecv)) * (10 + coin->bundlescount - bp->hdrsi)); bp->metric = coin->bundlescount - bp->hdrsi;//1000 + sqrt(sqrt(bp->n * (1 + bp->numsaved + bp->numrecv)) * (10 + coin->bundlescount - bp->hdrsi));
if ( done > coin->bundlescount*IGUANA_HEADPERCENTAGE && bp->hdrsi > coin->bundlescount*IGUANA_TAILPERCENTAGE ) if ( done > coin->bundlescount*IGUANA_HEADPERCENTAGE && bp->hdrsi > coin->bundlescount*IGUANA_TAILPERCENTAGE )
@ -477,9 +477,11 @@ void iguana_bundlestats(struct iguana_info *coin,char *str)
firstgap = lastpending = bp; firstgap = lastpending = bp;
else if ( ++pending == coin->MAXBUNDLES ) else if ( ++pending == coin->MAXBUNDLES )
lastpending = bp; lastpending = bp;
spaceused += bp->estsize;
if ( spaceused < coin->MAXMEM ) if ( spaceused < coin->MAXMEM )
{
spaceused += bp->estsize;
lastpending = bp; lastpending = bp;
}
sortbuf[m*2] = bp->metric; sortbuf[m*2] = bp->metric;
sortbuf[m*2 + 1] = i; sortbuf[m*2 + 1] = i;
m++; m++;

21
iguana/iguana_recv.c

@ -377,8 +377,8 @@ uint32_t iguana_allhashcmp(struct iguana_info *coin,struct iguana_bundle *bp,bit
prev->hh.next = block; prev->hh.next = block;
block->hh.prev = prev; block->hh.prev = prev;
} }
if ( bp->hdrsi < coin->MAXBUNDLES ) //if ( bp->hdrsi < coin->MAXBUNDLES )
iguana_blockQ(coin,bp,i,blockhashes[i],0); // iguana_blockQ(coin,bp,i,blockhashes[i],0);
} else printf("no allhashes block.%p or mismatch.%p\n",block,bp->blocks[i]); } else printf("no allhashes block.%p or mismatch.%p\n",block,bp->blocks[i]);
prev = block; prev = block;
} }
@ -1050,9 +1050,11 @@ int32_t iguana_blockQ(struct iguana_info *coin,struct iguana_bundle *bp,int32_t
block = iguana_blockfind(coin,hash2); block = iguana_blockfind(coin,hash2);
if ( priority != 0 || block == 0 || (block->queued == 0 && block->fpipbits == 0) ) if ( priority != 0 || block == 0 || (block->queued == 0 && block->fpipbits == 0) )
{ {
if ( bp != 0 && bundlei >= 0 && bundlei < bp->n && block == 0 )
block = bp->blocks[bundlei];
if ( block != 0 && bits256_cmp(coin->APIblockhash,hash2) != 0 ) if ( block != 0 && bits256_cmp(coin->APIblockhash,hash2) != 0 )
{ {
if ( block->fpipbits != 0 || block->queued != 0 || block->issued > time(NULL)-60 ) if ( block->fpipbits != 0 || block->queued != 0 || block->RO.recvlen != 0 )//block->issued > time(NULL)-60 )
return(0); return(0);
} }
if ( priority != 0 ) if ( priority != 0 )
@ -1060,19 +1062,6 @@ int32_t iguana_blockQ(struct iguana_info *coin,struct iguana_bundle *bp,int32_t
else str = "blocksQ", Q = &coin->blocksQ; else str = "blocksQ", Q = &coin->blocksQ;
if ( Q != 0 ) if ( Q != 0 )
{ {
if ( bp != 0 && bundlei >= 0 && bundlei < bp->n )
{
if ( bp->issued[bundlei] == 0 || time(NULL) > bp->issued[bundlei]+30 )
{
bp->issued[bundlei] = (uint32_t)time(NULL);
if ( bp->bundleheight >= 0 )
height = (bp->bundleheight + bundlei);
}
else
{
return(1);
}
}
req = mycalloc('y',1,sizeof(*req)); req = mycalloc('y',1,sizeof(*req));
req->hash2 = hash2; req->hash2 = hash2;
req->bp = bp; req->bp = bp;

Loading…
Cancel
Save