Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
64656f1887
  1. 11
      iguana/iguana777.c
  2. 2
      iguana/iguana777.h
  3. 8
      iguana/iguana_bundles.c
  4. 4
      iguana/iguana_recv.c
  5. 2
      iguana/main.c

11
iguana/iguana777.c

@ -573,7 +573,7 @@ void iguana_coinargs(char *symbol,int64_t *maxrecvcachep,int32_t *minconfirmsp,i
struct iguana_info *iguana_setcoin(char *symbol,void *launched,int32_t maxpeers,int64_t maxrecvcache,uint64_t services,int32_t initialheight,int32_t maphash,int32_t minconfirms,int32_t maxpending,int32_t maxbundles,cJSON *json) struct iguana_info *iguana_setcoin(char *symbol,void *launched,int32_t maxpeers,int64_t maxrecvcache,uint64_t services,int32_t initialheight,int32_t maphash,int32_t minconfirms,int32_t maxpending,int32_t maxbundles,cJSON *json)
{ {
struct iguana_chain *iguana_createchain(cJSON *json); struct iguana_chain *iguana_createchain(cJSON *json);
struct iguana_info *coin; int32_t j,m,mapflags; char dirname[512]; cJSON *peers; struct iguana_info *coin; int32_t j,m,mult,mapflags; char dirname[512]; cJSON *peers;
mapflags = IGUANA_MAPRECVDATA | maphash*IGUANA_MAPTXIDITEMS | maphash*IGUANA_MAPPKITEMS | maphash*IGUANA_MAPBLOCKITEMS | maphash*IGUANA_MAPPEERITEMS; mapflags = IGUANA_MAPRECVDATA | maphash*IGUANA_MAPTXIDITEMS | maphash*IGUANA_MAPPKITEMS | maphash*IGUANA_MAPBLOCKITEMS | maphash*IGUANA_MAPPEERITEMS;
coin = iguana_coinadd(symbol,json); coin = iguana_coinadd(symbol,json);
coin->launched = launched; coin->launched = launched;
@ -594,16 +594,17 @@ struct iguana_info *iguana_setcoin(char *symbol,void *launched,int32_t maxpeers,
sprintf(dirname,"%s/%s",GLOBALTMPDIR,symbol), OS_ensure_directory(dirname); sprintf(dirname,"%s/%s",GLOBALTMPDIR,symbol), OS_ensure_directory(dirname);
coin->initialheight = initialheight; coin->initialheight = initialheight;
coin->mapflags = mapflags; coin->mapflags = mapflags;
mult = (strcmp("BTC",coin->symbol) != 0) ? 64 : 1;
if ( (coin->startPEND= juint(json,"startpend")) == 0 ) if ( (coin->startPEND= juint(json,"startpend")) == 0 )
coin->startPEND = IGUANA_MAXPENDBUNDLES; coin->startPEND = IGUANA_MAXPENDBUNDLES * mult;
else if ( coin->startPEND > 1024 ) if ( coin->startPEND > 1024 )
coin->startPEND = 1024; coin->startPEND = 1024;
else if ( coin->startPEND < 2 ) else if ( coin->startPEND < 2 )
coin->startPEND = 2; coin->startPEND = 2;
coin->MAXBUNDLES = coin->startPEND; coin->MAXBUNDLES = coin->startPEND;
if ( (coin->endPEND= juint(json,"endpend")) == 0 ) if ( (coin->endPEND= juint(json,"endpend")) == 0 )
coin->endPEND = IGUANA_MINPENDBUNDLES; coin->endPEND = IGUANA_MINPENDBUNDLES * mult;
else if ( coin->endPEND > 1024 ) if ( coin->endPEND > 1024 )
coin->endPEND = 1024; coin->endPEND = 1024;
else if ( coin->endPEND < 2 ) else if ( coin->endPEND < 2 )
coin->endPEND = 2; coin->endPEND = 2;

2
iguana/iguana777.h

@ -37,7 +37,7 @@ typedef int32_t (*blockhashfunc)(uint8_t *blockhashp,uint8_t *serialized,int32_t
#define IGUANA_HEADPERCENTAGE 0. #define IGUANA_HEADPERCENTAGE 0.
#define IGUANA_TAILPERCENTAGE 1.0 #define IGUANA_TAILPERCENTAGE 1.0
#define IGUANA_MAXPENDHDRS 1 #define IGUANA_MAXPENDHDRS 1
#define _IGUANA_MAXPENDING 64 #define _IGUANA_MAXPENDING 3
#define IGUANA_MINPENDBUNDLES 2 #define IGUANA_MINPENDBUNDLES 2
#define IGUANA_MAXPENDBUNDLES 2 #define IGUANA_MAXPENDBUNDLES 2
#define IGUANA_BUNDLELOOP 77 #define IGUANA_BUNDLELOOP 77

8
iguana/iguana_bundles.c

@ -576,7 +576,7 @@ int32_t iguana_bundlehdr(struct iguana_info *coin,struct iguana_bundle *bp,int32
int32_t counter=0; int32_t counter=0;
//if ( bp->speculative != 0 ) //if ( bp->speculative != 0 )
// printf("hdr ITERATE bundle.%d vs %d: h.%d n.%d r.%d s.%d finished.%d speculative.%p\n",bp->bundleheight,coin->longestchain-coin->chain->bundlesize,bp->numhashes,bp->n,bp->numrecv,bp->numsaved,bp->emitfinish,bp->speculative); // printf("hdr ITERATE bundle.%d vs %d: h.%d n.%d r.%d s.%d finished.%d speculative.%p\n",bp->bundleheight,coin->longestchain-coin->chain->bundlesize,bp->numhashes,bp->n,bp->numrecv,bp->numsaved,bp->emitfinish,bp->speculative);
int32_t i; struct iguana_block *block; int32_t i; struct iguana_block *block; uint32_t now;
if ( coin->enableCACHE != 0 && bp->speculative == 0 && bp->numhashes < bp->n ) if ( coin->enableCACHE != 0 && bp->speculative == 0 && bp->numhashes < bp->n )
{ {
char str[64]; char str[64];
@ -584,10 +584,14 @@ int32_t iguana_bundlehdr(struct iguana_info *coin,struct iguana_bundle *bp,int32
} }
else if ( bp->speculative != 0 ) else if ( bp->speculative != 0 )
{ {
now = (uint32_t)time(NULL);
for (i=0; i<bp->numspec; i++) for (i=0; i<bp->numspec; i++)
if ( bits256_nonz(bp->speculative[i]) != 0 && ((block= iguana_blockfind(coin,bp->speculative[i])) == 0 || block->req == 0) ) if ( bits256_nonz(bp->speculative[i]) != 0 && bp->issued[i] > now+10 && ((block= iguana_blockfind(coin,bp->speculative[i])) == 0 || block->req == 0) )
{
bp->issued[i] = now;
iguana_blockQ("speculative",coin,0,-1,bp->speculative[i],0); iguana_blockQ("speculative",coin,0,-1,bp->speculative[i],0);
} }
}
return(counter); return(counter);
} }

4
iguana/iguana_recv.c

@ -891,7 +891,7 @@ int32_t iguana_reqblocks(struct iguana_info *coin)
else threshold = coin->avetime; else threshold = coin->avetime;
threshold *= 100. * sqrt(threshold) * .000777;*/ threshold *= 100. * sqrt(threshold) * .000777;*/
double threshold,lag = OS_milliseconds() - coin->backstopmillis; double threshold,lag = OS_milliseconds() - coin->backstopmillis;
threshold = 1000; threshold = 300;
if ( coin->blocks.hwmchain.height < coin->longestchain && (coin->backstop != coin->blocks.hwmchain.height+1 || lag > threshold) ) if ( coin->blocks.hwmchain.height < coin->longestchain && (coin->backstop != coin->blocks.hwmchain.height+1 || lag > threshold) )
{ {
coin->backstop = coin->blocks.hwmchain.height+1; coin->backstop = coin->blocks.hwmchain.height+1;
@ -909,7 +909,7 @@ int32_t iguana_reqblocks(struct iguana_info *coin)
if ( bp != 0 && bits256_nonz(hash2) > 0 ) if ( bp != 0 && bits256_nonz(hash2) > 0 )
{ {
coin->backstopmillis = OS_milliseconds(); coin->backstopmillis = OS_milliseconds();
iguana_blockQ("mainchain",coin,bp,bundlei,hash2,0); iguana_blockQ("mainchain",coin,0,-1,hash2,lag > 100 * threshold);
flag++; flag++;
char str[65]; char str[65];
if ( 1 && (rand() % 1000) == 0 || bp->bundleheight > coin->longestchain-coin->chain->bundlesize ) if ( 1 && (rand() % 1000) == 0 || bp->bundleheight > coin->longestchain-coin->chain->bundlesize )

2
iguana/main.c

@ -44,7 +44,7 @@ static int32_t initflag;
int32_t HDRnet,netBLOCKS; int32_t HDRnet,netBLOCKS;
cJSON *API_json; cJSON *API_json;
#ifdef __linux__ #ifdef __linux__
int32_t IGUANA_NUMHELPERS = 8; int32_t IGUANA_NUMHELPERS = 16;
#else #else
int32_t IGUANA_NUMHELPERS = 4; int32_t IGUANA_NUMHELPERS = 4;
#endif #endif

Loading…
Cancel
Save