Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
a8ddb55849
  1. 2
      iguana/iguana777.h
  2. 11
      iguana/iguana_blocks.c
  3. 8
      iguana/iguana_bundles.c
  4. 18
      iguana/iguana_recv.c

2
iguana/iguana777.h

@ -39,7 +39,7 @@ typedef int32_t (*blockhashfunc)(uint8_t *blockhashp,uint8_t *serialized,int32_t
#define IGUANA_MAXPENDHDRS 1 #define IGUANA_MAXPENDHDRS 1
#define _IGUANA_MAXPENDING 3 #define _IGUANA_MAXPENDING 3
#define IGUANA_MINPENDBUNDLES 4 #define IGUANA_MINPENDBUNDLES 4
#define IGUANA_MAXPENDBUNDLES 64 #define IGUANA_MAXPENDBUNDLES 100
#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)

11
iguana/iguana_blocks.c

@ -337,7 +337,14 @@ struct iguana_block *_iguana_chainlink(struct iguana_info *coin,struct iguana_bl
printf("EXTENDMAIN %s %d <- (%s) n.%u max.%u PoW %f numtx.%d valid.%d\n",str,block->height,str2,hwmchain->height+1,coin->blocks.maxblocks,block->PoW,block->RO.txn_count,block->valid); printf("EXTENDMAIN %s %d <- (%s) n.%u max.%u PoW %f numtx.%d valid.%d\n",str,block->height,str2,hwmchain->height+1,coin->blocks.maxblocks,block->PoW,block->RO.txn_count,block->valid);
struct iguana_bundle *bp; struct iguana_bundle *bp;
if ( (block->height % coin->chain->bundlesize) == 0 ) if ( (block->height % coin->chain->bundlesize) == 0 )
{
bp = iguana_bundlecreate(coin,&bundlei,block->height,block->RO.hash2,zero,0); bp = iguana_bundlecreate(coin,&bundlei,block->height,block->RO.hash2,zero,0);
if ( bp != 0 && bp->hdrsi == coin->bundlescount-1 )
{
printf("created last bundle ht.%d\n",bp->bundleheight);
iguana_blockreq(coin,block->height,1);
}
}
else else
{ {
if ( (bp= coin->bundles[block->height / coin->chain->bundlesize]) != 0 ) if ( (bp= coin->bundles[block->height / coin->chain->bundlesize]) != 0 )
@ -363,7 +370,9 @@ struct iguana_block *_iguana_chainlink(struct iguana_info *coin,struct iguana_bl
//if ( block->fpipbits == 0 ) //if ( block->fpipbits == 0 )
// iguana_blockQ(coin,bp,block->height % coin->chain->bundlesize,block->RO.hash2,1); // iguana_blockQ(coin,bp,block->height % coin->chain->bundlesize,block->RO.hash2,1);
block->mainchain = 1; block->mainchain = 1;
iguana_blockreq(coin,block->height+1,0); iguana_blockreq(coin,block->height+1,1);
iguana_blockreq(coin,block->height+2,0);
iguana_blockreq(coin,block->height+3,0);
return(block); return(block);
} }
} }

8
iguana/iguana_bundles.c

@ -379,10 +379,10 @@ int32_t iguana_bundleissue(struct iguana_info *coin,struct iguana_bundle *bp,int
else starti = 0; else starti = 0;
lag = (bp->hdrsi - starti); lag = (bp->hdrsi - starti);
lag *= lag; lag *= lag;
if ( lag < 10 ) if ( lag < 30 )
lag = 10; lag = 30;
else if ( lag > 300 ) else if ( lag > 600 )
lag = 300; lag = 600;
if ( (numpeers= coin->peers.numranked) > 8 )//&& bp->currentflag < bp->n ) if ( (numpeers= coin->peers.numranked) > 8 )//&& bp->currentflag < bp->n )
{ {
if ( bp->currentflag == 0 ) if ( bp->currentflag == 0 )

18
iguana/iguana_recv.c

@ -37,8 +37,8 @@ int32_t iguana_sendblockreqPT(struct iguana_info *coin,struct iguana_peer *addr,
char hexstr[65]; init_hexbytes_noT(hexstr,hash2.bytes,sizeof(hash2)); char hexstr[65]; init_hexbytes_noT(hexstr,hash2.bytes,sizeof(hash2));
if ( addr == 0 || memcmp(lastreq.bytes,hash2.bytes,sizeof(hash2)) == 0 || memcmp(lastreq2.bytes,hash2.bytes,sizeof(hash2)) == 0 ) if ( addr == 0 || memcmp(lastreq.bytes,hash2.bytes,sizeof(hash2)) == 0 || memcmp(lastreq2.bytes,hash2.bytes,sizeof(hash2)) == 0 )
{ {
printf("duplicate req %s or null addr.%p\n",bits256_str(hexstr,hash2),addr); //printf("duplicate req %s or null addr.%p\n",bits256_str(hexstr,hash2),addr);
//return(0); return(0);
} }
if ( addr->msgcounts.verack == 0 ) if ( addr->msgcounts.verack == 0 )
{ {
@ -568,9 +568,9 @@ struct iguana_bundlereq *iguana_recvblockhashes(struct iguana_info *coin,struct
iguana_bundlefind(coin,&bp,&bundlei,blockhashes[1]); iguana_bundlefind(coin,&bp,&bundlei,blockhashes[1]);
//iguana_blockQ(coin,0,-1,blockhashes[1],0); //iguana_blockQ(coin,0,-1,blockhashes[1],0);
//iguana_blockQ(coin,0,-4,blockhashes[1],1); //iguana_blockQ(coin,0,-4,blockhashes[1],1);
//char str[65]; char str[65];
//if ( bp != 0 && bp->hdrsi == 0 ) if ( bp != 0 && bp->hdrsi == coin->bundlescount-1 )
// printf("blockhashes[%d] %d of %d %s bp.%d[%d]\n",num,bp==0?-1:bp->hdrsi,coin->bundlescount,bits256_str(str,blockhashes[1]),bp==0?-1:bp->bundleheight,bundlei); printf("blockhashes[%d] %d of %d %s bp.%d[%d]\n",num,bp==0?-1:bp->hdrsi,coin->bundlescount,bits256_str(str,blockhashes[1]),bp==0?-1:bp->bundleheight,bundlei);
if ( bp != 0 ) if ( bp != 0 )
{ {
bp->hdrtime = (uint32_t)time(NULL); bp->hdrtime = (uint32_t)time(NULL);
@ -644,7 +644,7 @@ struct iguana_bundlereq *iguana_recvblock(struct iguana_info *coin,struct iguana
struct iguana_bundle *bp=0; int32_t numsaved,bundlei = -2; struct iguana_block *block,*tmpblock; struct iguana_bundle *bp=0; int32_t numsaved,bundlei = -2; struct iguana_block *block,*tmpblock;
bp = iguana_bundleset(coin,&block,&bundlei,origblock); bp = iguana_bundleset(coin,&block,&bundlei,origblock);
char str[65]; char str[65];
if ( 0 && bp == coin->current && bp != 0 ) if ( 1 && bp != 0 && bp->hdrsi == coin->bundlescount-1 )
{ {
int32_t i; static int32_t numrecv; int32_t i; static int32_t numrecv;
numrecv++; numrecv++;
@ -927,7 +927,7 @@ int32_t iguana_reqhdrs(struct iguana_info *coin)
int32_t i,lag,n = 0; struct iguana_bundle *bp; char hashstr[65]; int32_t i,lag,n = 0; struct iguana_bundle *bp; char hashstr[65];
if ( queue_size(&coin->hdrsQ) == 0 ) if ( queue_size(&coin->hdrsQ) == 0 )
{ {
if ( iguana_needhdrs(coin) > 0 ) //if ( iguana_needhdrs(coin) > 0 )
{ {
for (i=0; i<coin->bundlescount; i++) for (i=0; i<coin->bundlescount; i++)
{ {
@ -957,10 +957,6 @@ int32_t iguana_reqhdrs(struct iguana_info *coin)
printf("REQ HDRS pending.%d\n",n); printf("REQ HDRS pending.%d\n",n);
coin->zcount = 0; coin->zcount = 0;
} }
else
{
}
} else coin->zcount = 0; } else coin->zcount = 0;
return(n); return(n);
} }

Loading…
Cancel
Save