Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
a7592d901e
  1. 3
      iguana/iguana777.c
  2. 2
      iguana/iguana777.h
  3. 2
      iguana/iguana_bundles.c
  4. 14
      iguana/iguana_recv.c
  5. 3
      iguana/iguana_unspents.c
  6. 2
      iguana/main.c

3
iguana/iguana777.c

@ -147,7 +147,8 @@ int32_t iguana_peermetrics(struct iguana_info *coin)
addr = &coin->peers.active[i];
if ( addr->usock < 0 || addr->dead != 0 || addr->ready == 0 )
continue;
//addr->pendblocks = 0;
if ( addr->pendblocks > 0)
addr->pendblocks--;
if ( addr->recvblocks > coin->peers.mostreceived )
coin->peers.mostreceived = addr->recvblocks;
//printf("[%.0f %.0f] ",addr->recvblocks,addr->recvtotal);

2
iguana/iguana777.h

@ -42,7 +42,7 @@ typedef int32_t (*blockhashfunc)(uint8_t *blockhashp,uint8_t *serialized,int32_t
#define IGUANA_TAILPERCENTAGE 1.0
#define IGUANA_MAXPENDHDRS 1
#define IGUANA_MAXPENDINGREQUESTS 64
#define IGUANA_PENDINGREQUESTS 2048
#define IGUANA_PENDINGREQUESTS 3
#define IGUANA_MINPENDBUNDLES 2
#define IGUANA_MAXPENDBUNDLES 256
#define IGUANA_RPCPORT 7778

2
iguana/iguana_bundles.c

@ -516,7 +516,7 @@ int32_t iguana_sendhashes(struct iguana_info *coin,struct iguana_peer *addr,int3
coin->numreqsent += n;
addr->pendblocks += n;
addr->pendtime = (uint32_t)time(NULL);
//printf("sendhashes[%d] -> %s\n",n,addr->ipaddr);
printf("sendhashes[%d] -> %s\n",n,addr->ipaddr);
} else n = 0;
free(serialized);
}

14
iguana/iguana_recv.c

@ -498,7 +498,7 @@ void iguana_gotblockhashesM(struct iguana_info *coin,struct iguana_peer *addr,bi
req = iguana_bundlereq(coin,addr,'S',0);
req->hashes = blockhashes, req->n = n;
char str[65];
if ( 1 && n > 2 && addr != 0 )
if ( 0 && n > 2 && addr != 0 )
printf("addr.%d %s [%d]\n",addr->rank,bits256_str(str,blockhashes[1]),n);
queue_enqueue("recvQ",&coin->recvQ,&req->DL,0);
if ( n > coin->chain->bundlesize )
@ -658,7 +658,7 @@ struct iguana_bundle *iguana_bundleset(struct iguana_info *coin,struct iguana_bl
if ( iguana_bundlehashadd(coin,bp,bundlei,block) < 0 )
{
if ( bp->emitfinish == 0 && block->issued == 0 )
iguana_blockQ("bundleset",coin,bp,bundlei,block->RO.hash2,coin->current == 0 || bp->hdrsi <= coin->current->hdrsi+coin->MAXBUNDLES);
iguana_blockQ("bundleset",coin,bp,bundlei,block->RO.hash2,1);//coin->current == 0 || bp->hdrsi <= coin->current->hdrsi+coin->MAXBUNDLES);
}
//fprintf(stderr,"bundle found %d:%d\n",bp->hdrsi,bundlei);
//printf("bundlehashadd set.%d\n",bundlei);
@ -805,7 +805,7 @@ struct iguana_bundlereq *iguana_recvblockhashes(struct iguana_info *coin,struct
memset(zero.bytes,0,sizeof(zero));
bp = 0, bundlei = -2;
iguana_bundlefind(coin,&bp,&bundlei,blockhashes[1]);
if ( 1 && num >= coin->chain->bundlesize )
if ( 0 && num >= coin->chain->bundlesize )
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 ( num < 2 )
return(req);
@ -814,7 +814,7 @@ struct iguana_bundlereq *iguana_recvblockhashes(struct iguana_info *coin,struct
bp->dirty++;
bp->hdrtime = (uint32_t)time(NULL);
blockhashes[0] = bp->hashes[0];
iguana_blockQ("recvhash0",coin,bp,0,blockhashes[0],0);
iguana_blockQ("recvhash0",coin,bp,0,blockhashes[0],1);
if ( num >= coin->chain->bundlesize )
{
if ( bits256_nonz(bp->nextbundlehash2) == 0 && num > coin->chain->bundlesize )
@ -839,8 +839,8 @@ struct iguana_bundlereq *iguana_recvblockhashes(struct iguana_info *coin,struct
for (i=1; i<num&&i<=bp->n; i++)
{
bp->speculative[i] = blockhashes[i];
if ( bp->blocks[i] == 0 || bp->blocks[i]->issued == 0 )
iguana_blockQ("speculate",coin,bp,-i,blockhashes[i],0);
//if ( bp->blocks[i] == 0 || bp->blocks[i]->issued == 0 )
// iguana_blockQ("speculate",coin,bp,-i,blockhashes[i],0);
if ( bp->blocks[i] == 0 )
bp->blocks[i] = iguana_blockhashset("recvhashes3",coin,bp->bundleheight+i,blockhashes[i],1);
//printf("speculate new issue [%d:%d]\n",bp->hdrsi,i);
@ -1121,7 +1121,7 @@ int32_t iguana_reqblocks(struct iguana_info *coin)
if ( strcmp("BTC",coin->symbol) == 0 && bits256_nonz(hash2) > 0 )
{
coin->backstopmillis = OS_milliseconds();
iguana_blockQ("mainchain",coin,0,-1,hash2,0);//lag > threshold);
iguana_blockQ("mainchain",coin,0,-1,hash2,1);//lag > threshold);
flag++;
char str[65];
if ( 1 && (rand() % 10000) == 0 )//|| bp->bundleheight > coin->longestchain-coin->chain->bundlesize )

3
iguana/iguana_unspents.c

@ -820,7 +820,8 @@ int32_t iguana_spendvectors(struct iguana_info *coin,struct iguana_bundle *bp,st
if ( coin->PREFETCHLAG != 0 )
{
iguana_ramchain_prefetch(coin,ramchain,0);
//iguana_prefetch(coin,bp,5,2);
if ( bp->hdrsi > 0 )
iguana_prefetch(coin,bp,bp->hdrsi-1,1);
}
starttime = (uint32_t)time(NULL);
txidind = B[starti].firsttxidind;

2
iguana/main.c

@ -1220,7 +1220,7 @@ void iguana_main(void *arg)
if ( 1 )
{
sleep(1);
if ( 1 && (str= SuperNET_JSON(myinfo,cJSON_Parse("{\"VALIDATE\":1,\"prefetchlag\":13,\"startpend\":512,\"endpend\":512,\"userhome\":\"/Users/jimbolaptop/Library/Application Support\",\"agent\":\"iguana\",\"method\":\"addcoin\",\"services\":129,\"maxpeers\":256,\"newcoin\":\"BTCD\",\"active\":1,\"numhelpers\":8,\"poll\":1}"),0,myinfo->rpcport)) != 0 )
if ( 1 && (str= SuperNET_JSON(myinfo,cJSON_Parse("{\"VALIDATE\":1,\"prefetchlag\":13,\"startpend\":128,\"endpend\":128,\"userhome\":\"/Users/jimbolaptop/Library/Application Support\",\"agent\":\"iguana\",\"method\":\"addcoin\",\"services\":129,\"maxpeers\":256,\"newcoin\":\"BTCD\",\"active\":1,\"numhelpers\":8,\"poll\":1}"),0,myinfo->rpcport)) != 0 )
{
free(str);
if ( 0 && (str= SuperNET_JSON(myinfo,cJSON_Parse("{\"userhome\":\"/Users/jimbolaptop/Library/Application Support\",\"agent\":\"iguana\",\"method\":\"addcoin\",\"services\":1024,\"maxpeers\":256,\"newcoin\":\"BTCD\",\"active\":1}"),0,myinfo->rpcport)) != 0 )

Loading…
Cancel
Save