Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
4acefb6ff0
  1. 4
      iguana/iguana777.h
  2. 2
      iguana/iguana_bundles.c
  3. 24
      iguana/iguana_recv.c
  4. 2
      iguana/main.c

4
iguana/iguana777.h

@ -38,8 +38,8 @@ typedef int32_t (*blockhashfunc)(uint8_t *blockhashp,uint8_t *serialized,int32_t
#define IGUANA_TAILPERCENTAGE 1.0 #define IGUANA_TAILPERCENTAGE 1.0
#define IGUANA_MAXPENDHDRS 1 #define IGUANA_MAXPENDHDRS 1
#define _IGUANA_MAXPENDING 3 #define _IGUANA_MAXPENDING 3
#define IGUANA_MINPENDBUNDLES 8 #define IGUANA_MINPENDBUNDLES 4
#define IGUANA_MAXPENDBUNDLES 64 #define IGUANA_MAXPENDBUNDLES 128
#define IGUANA_BUNDLELOOP 77 #define IGUANA_BUNDLELOOP 77
#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)

2
iguana/iguana_bundles.c

@ -466,7 +466,7 @@ int32_t iguana_bundleissue(struct iguana_info *coin,struct iguana_bundle *bp,int
{ {
if ( peercounts[i] > 10 && (addr= coin->peers.ranked[i]) != 0 && now > bp->currenttime+lag ) if ( peercounts[i] > 10 && (addr= coin->peers.ranked[i]) != 0 && now > bp->currenttime+lag )
{ {
if ( numpeers > 64 || addr->laggard++ > 5 ) if ( numpeers > 64 || addr->laggard++ > 3 )
addr->dead = (uint32_t)time(NULL); addr->dead = (uint32_t)time(NULL);
for (j=0; j<bp->n; j++) for (j=0; j<bp->n; j++)
{ {

24
iguana/iguana_recv.c

@ -836,24 +836,30 @@ int32_t iguana_reqblocks(struct iguana_info *coin)
{ {
coin->backstop = coin->blocks.hwmchain.height+1; coin->backstop = coin->blocks.hwmchain.height+1;
hash2 = iguana_blockhash(coin,coin->backstop); hash2 = iguana_blockhash(coin,coin->backstop);
bp = coin->bundles[(coin->blocks.hwmchain.height+1)/coin->chain->bundlesize];
bundlei = (coin->blocks.hwmchain.height+1) % coin->chain->bundlesize;
if ( bits256_nonz(hash2) == 0 )
{
hash2 = bp->hashes[bundlei];
if ( bits256_nonz(hash2) == 0 && bp->speculative != 0 )
hash2 = bp->speculative[bundlei];
}
if ( bits256_nonz(hash2) > 0 ) if ( bits256_nonz(hash2) > 0 )
{ {
bp = coin->bundles[(coin->blocks.hwmchain.height+1)/coin->chain->bundlesize]; if ( bp != 0 && bits256_nonz(hash2) > 0 )
bundlei = (coin->blocks.hwmchain.height+1) % coin->chain->bundlesize;
if ( bp != 0 && bits256_nonz(bp->hashes[bundlei]) > 0 )
{ {
coin->backstopmillis = OS_milliseconds(); coin->backstopmillis = OS_milliseconds();
iguana_blockQ("mainchain",coin,bp,bundlei,bp->hashes[bundlei],0); iguana_blockQ("mainchain",coin,bp,bundlei,hash2,0);
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 )
printf("%s MAINCHAIN.%d threshold %.3f %.3f lag %.3f\n",bits256_str(str,hash2),coin->blocks.hwmchain.height+1,threshold,coin->backstopmillis,lag); printf("%s MAINCHAIN.%d threshold %.3f %.3f lag %.3f\n",bits256_str(str,hash2),coin->blocks.hwmchain.height+1,threshold,coin->backstopmillis,lag);
} }
else if ( bp != 0 && bundlei < bp->n-1 && bits256_nonz(bp->hashes[bundlei+1]) > 0 ) }
{ else if ( bp != 0 && bundlei < bp->n-1 && bits256_nonz(bp->hashes[bundlei+1]) > 0 )
printf("MAINCHAIN skip issue %d\n",bundlei+1); {
iguana_blockQ("mainskip",coin,bp,bundlei,bp->hashes[bundlei+1],0); printf("MAINCHAIN skip issue %d\n",bundlei+1);
} iguana_blockQ("mainskip",coin,bp,bundlei,bp->hashes[bundlei+1],0);
} }
} }
} }

2
iguana/main.c

@ -325,7 +325,7 @@ void sigcontinue_func() { printf("\nSIGCONT\n"); signal(SIGCONT,sigcontinue_func
void mainloop(struct supernet_info *myinfo) void mainloop(struct supernet_info *myinfo)
{ {
int32_t i,flag; struct iguana_info *coin; struct iguana_bundle *bp; struct iguana_helper *ptr; int32_t i,flag; struct iguana_info *coin; struct iguana_helper *ptr;
sleep(3); sleep(3);
printf("mainloop\n"); printf("mainloop\n");
while ( 1 ) while ( 1 )

Loading…
Cancel
Save