Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
25016fb50e
  1. 6
      iguana/iguana777.h
  2. 39
      iguana/iguana_bundles.c

6
iguana/iguana777.h

@ -37,10 +37,10 @@ typedef int32_t (*blockhashfunc)(uint8_t *blockhashp,uint8_t *serialized,int32_t
#define IGUANA_HEADPERCENTAGE 0.
#define IGUANA_TAILPERCENTAGE 1.0
#define IGUANA_MAXPENDHDRS 1
#define _IGUANA_MAXPENDING 7
#define _IGUANA_MAXPENDING 3
#define IGUANA_MINPENDBUNDLES 64
#define IGUANA_MAXPENDBUNDLES 64
#define IGUANA_BUNDLELOOP 777
#define IGUANA_BUNDLELOOP 3
#define IGUANA_RPCPORT 7778
#define IGUANA_MAXRAMCHAINSIZE ((uint64_t)1024L * 1024L * 1024L * 16)
@ -279,7 +279,7 @@ struct iguana_block
struct iguana_blockRO RO;
double PoW; // NOT consensus safe, for estimation purposes only
int32_t height; uint32_t fpipbits,numrequests,issued; long fpos;
uint16_t hdrsi,bundlei:12,mainchain:1,valid:1,queued:1,txvalid:1,extra:8;
uint16_t hdrsi,bundlei:12,mainchain:1,valid:1,queued:1,txvalid:1,peerid:8;
UT_hash_handle hh; bits256 *blockhashes;
};// __attribute__((packed));

39
iguana/iguana_bundles.c

@ -366,14 +366,15 @@ void iguana_bundlepurge(struct iguana_info *coin,struct iguana_bundle *bp)
int32_t iguana_bundleissue(struct iguana_info *coin,struct iguana_bundle *bp,int32_t max,int32_t timelimit)
{
int32_t i,j,k,len,numpeers,counter = 0; struct iguana_peer *addr; uint32_t now;
int32_t i,j,k,len,numpeers,peercounts[IGUANA_MAXPEERS],counter = 0; struct iguana_peer *addr; uint32_t now;
struct iguana_block *block; bits256 hashes[32]; uint8_t serialized[sizeof(hashes) + 256];
if ( bp == 0 )
return(0);
now = (uint32_t)time(NULL);
memset(peercounts,0,sizeof(peercounts));
if ( bp == coin->current )
{
if ( bp->numhashes >= bp->n && bp->currentflag < bp->n && (numpeers= coin->peers.numranked) > 8 )
if ( bp->numhashes >= bp->n && (numpeers= coin->peers.numranked) > 8 )
{
for (j=0; j<numpeers; j++)
{
@ -384,12 +385,28 @@ int32_t iguana_bundleissue(struct iguana_info *coin,struct iguana_bundle *bp,int
{
if ( bits256_nonz(bp->hashes[i]) != 0 )
{
if ( (block= bp->blocks[i]) != 0 && block->fpipbits == 0 && (block->numrequests == 0 || now > block->issued+60) )
if ( (block= bp->blocks[i]) != 0 )
{
printf("<%d> ",i);
hashes[k++] = bp->hashes[i];
block->issued = now;
block->numrequests++;
if ( block->peerid == 0 )
{
printf("<%d> ",i);
hashes[k++] = bp->hashes[i];
block->issued = now;
block->peerid = j + 1;
block->numrequests++;
}
else
{
if ( block->fpipbits == 0 )
{
}
else if ( block->fpipbits != 0 && block->fpos >= 0 )
{
//bp->currentflag++;
peercounts[block->peerid]++;
}
}
}
}
bp->issued[i] = now;
@ -404,14 +421,14 @@ int32_t iguana_bundleissue(struct iguana_info *coin,struct iguana_bundle *bp,int
addr->pendtime = (uint32_t)time(NULL);
bp->currentflag += k;
}
printf("a%d/%d ",j,k);
//printf("a%d/%d ",j,k);
}
}
}
printf("currentflag.%d\n",bp->currentflag);
//printf("currentflag.%d\n",bp->currentflag);
return(counter);
}
if ( 0 && time(NULL) > bp->lastspeculative+60 )
/*if ( 0 && time(NULL) > bp->lastspeculative+60 )
{
for (i=1,counter=0; i<bp->n; i++)
{
@ -426,7 +443,7 @@ int32_t iguana_bundleissue(struct iguana_info *coin,struct iguana_bundle *bp,int
if ( counter != 0 )
printf("SPECULATIVE issue.%d bp.[%d]\n",counter,bp->hdrsi);
bp->lastspeculative = (uint32_t)time(NULL);
}
}*/
}
// if ( bp != coin->current )
return(counter);

Loading…
Cancel
Save