Browse Source

test

release/v0.1
jl777 8 years ago
parent
commit
0949e005c1
  1. 10
      iguana/iguana_blocks.c
  2. 2
      iguana/iguana_recv.c
  3. 4
      iguana/main.c
  4. 2
      includes/iguana_defines.h

10
iguana/iguana_blocks.c

@ -531,7 +531,7 @@ void iguana_setchain(void *chainparms)
struct iguana_block *_iguana_chainlink(struct iguana_info *coin,struct iguana_block *newblock) struct iguana_block *_iguana_chainlink(struct iguana_info *coin,struct iguana_block *newblock)
{ {
int32_t valid,bundlei,height=-1; struct iguana_block *hwmchain,*block = 0,*prev=0,*next; int32_t valid,bundlei,height=-1; struct iguana_block *hwmchain,*block = 0,*prev=0;
bits256 *hash2p=0; double prevPoW = 0.; struct iguana_bundle *bp; bits256 *hash2p=0; double prevPoW = 0.; struct iguana_bundle *bp;
if ( newblock == 0 ) if ( newblock == 0 )
return(0); return(0);
@ -542,7 +542,7 @@ struct iguana_block *_iguana_chainlink(struct iguana_info *coin,struct iguana_bl
if ( (block= iguana_blockfind("chainlink",coin,newblock->RO.hash2)) != 0 ) if ( (block= iguana_blockfind("chainlink",coin,newblock->RO.hash2)) != 0 )
{ {
if ( block->RO.timestamp == 0 ) if ( block->RO.timestamp == 0 )
block->mainchain = block->valid = 0; block->mainchain = block->valid = block->txvalid = 0;
iguana_blocksizecheck("chainlink",coin->chain->zcash,block); iguana_blocksizecheck("chainlink",coin->chain->zcash,block);
if ( memcmp(coin->chain->genesis_hashdata,block->RO.hash2.bytes,sizeof(bits256)) == 0 ) if ( memcmp(coin->chain->genesis_hashdata,block->RO.hash2.bytes,sizeof(bits256)) == 0 )
block->PoW = PoW_from_compact(block->RO.bits,coin->chain->unitval), height = 0; block->PoW = PoW_from_compact(block->RO.bits,coin->chain->unitval), height = 0;
@ -554,13 +554,13 @@ struct iguana_block *_iguana_chainlink(struct iguana_info *coin,struct iguana_bl
{ {
prevPoW = prev->PoW; prevPoW = prev->PoW;
block->PoW = PoW_from_compact(block->RO.bits,coin->chain->unitval) + prevPoW; block->PoW = PoW_from_compact(block->RO.bits,coin->chain->unitval) + prevPoW;
if ( (next= prev->hh.next) != 0 ) /*if ( (next= prev->hh.next) != 0 )
{ {
if ( next->mainchain != 0 && block->PoW < next->PoW ) if ( next->mainchain != 0 && block->PoW < next->PoW )
return(0); return(0);
//printf("block->PoW %f next %f\n",block->PoW,next->PoW); //printf("block->PoW %f next %f\n",block->PoW,next->PoW);
hwmchain = next; hwmchain = next;
} }*/
height = prev->height + 1; height = prev->height + 1;
} }
else else
@ -593,7 +593,7 @@ struct iguana_block *_iguana_chainlink(struct iguana_info *coin,struct iguana_bl
// iguana_blockunmain(coin,prev->hh.next); // iguana_blockunmain(coin,prev->hh.next);
prev->hh.next = block; prev->hh.next = block;
} }
if ( coin->isRT != 0 || block->height == hwmchain->height ) if ( coin->isRT != 0 || block->height >= hwmchain->height )
{ {
coin->blocks.maxblocks = (block->height + 1); coin->blocks.maxblocks = (block->height + 1);
//printf("[%s] <- ht.%d %f\n",bits256_str(str,block->RO.hash2),coin->blocks.hwmchain.height,coin->blocks.hwmchain.PoW); //printf("[%s] <- ht.%d %f\n",bits256_str(str,block->RO.hash2),coin->blocks.hwmchain.height,coin->blocks.hwmchain.PoW);

2
iguana/iguana_recv.c

@ -1676,12 +1676,12 @@ int32_t iguana_processrecv(struct supernet_info *myinfo,struct iguana_info *coin
//iguana_utxoaddr_gen(myinfo,coin,(coin->balanceswritten - 1) * coin->chain->bundlesize); //iguana_utxoaddr_gen(myinfo,coin,(coin->balanceswritten - 1) * coin->chain->bundlesize);
} }
flag += iguana_processrecvQ(coin,&newhwm); flag += iguana_processrecvQ(coin,&newhwm);
flag += iguana_reqblocks(coin);
//if ( coin->spendvectorsaved > 1 ) //if ( coin->spendvectorsaved > 1 )
{ {
if ( time(NULL) > coin->laststats+5 ) if ( time(NULL) > coin->laststats+5 )
{ {
flag += iguana_reqhdrs(coin); flag += iguana_reqhdrs(coin);
flag += iguana_reqblocks(coin);
iguana_bundlestats(coin,str,IGUANA_DEFAULTLAG); iguana_bundlestats(coin,str,IGUANA_DEFAULTLAG);
coin->laststats = (uint32_t)time(NULL); coin->laststats = (uint32_t)time(NULL);
} }

4
iguana/main.c

@ -551,10 +551,10 @@ void iguana_appletests(struct supernet_info *myinfo)
bitcoin_sharedsecret(myinfo->ctx,hash2,pubkey,33); bitcoin_sharedsecret(myinfo->ctx,hash2,pubkey,33);
printf("secp256k1 elapsed %.3f for %d iterations\n",OS_milliseconds() - startmillis,i); printf("secp256k1 elapsed %.3f for %d iterations\n",OS_milliseconds() - startmillis,i);
getchar();**/ getchar();**/
if ( 1 && (str= SuperNET_JSON(myinfo,cJSON_Parse("{\"protover\":70002,\"RELAY\":1,\"VALIDATE\":0,\"portp2p\":14631,\"rpc\":14632,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":64,\"endpend\":64,\"services\":129,\"maxpeers\":64,\"newcoin\":\"BTCD\",\"active\":1,\"numhelpers\":1,\"poll\":1}"),0,myinfo->rpcport)) != 0 ) if ( 1 && (str= SuperNET_JSON(myinfo,cJSON_Parse("{\"protover\":70002,\"RELAY\":1,\"VALIDATE\":0,\"portp2p\":14631,\"rpc\":14632,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":64,\"endpend\":64,\"services\":129,\"maxpeers\":64,\"newcoin\":\"BTCD\",\"active\":1,\"numhelpers\":1,\"poll\":100}"),0,myinfo->rpcport)) != 0 )
{ {
free(str); free(str);
if ( 1 && (str= SuperNET_JSON(myinfo,cJSON_Parse("{\"portp2p\":8333,\"RELAY\":0,\"VALIDATE\":0,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":1,\"endpend\":1,\"services\":128,\"maxpeers\":8,\"newcoin\":\"BTC\",\"active\":0,\"numhelpers\":1,\"poll\":100}"),0,myinfo->rpcport)) != 0 ) if ( 0 && (str= SuperNET_JSON(myinfo,cJSON_Parse("{\"portp2p\":8333,\"RELAY\":0,\"VALIDATE\":0,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":1,\"endpend\":1,\"services\":128,\"maxpeers\":8,\"newcoin\":\"BTC\",\"active\":0,\"numhelpers\":1,\"poll\":100}"),0,myinfo->rpcport)) != 0 )
{ {
free(str); free(str);
if ( 0 && (str= SuperNET_JSON(myinfo,cJSON_Parse("{\"agent\":\"SuperNET\",\"method\":\"login\",\"handle\":\"alice\",\"password\":\"alice\",\"passphrase\":\"alice\"}"),0,myinfo->rpcport)) != 0 ) if ( 0 && (str= SuperNET_JSON(myinfo,cJSON_Parse("{\"agent\":\"SuperNET\",\"method\":\"login\",\"handle\":\"alice\",\"password\":\"alice\",\"passphrase\":\"alice\"}"),0,myinfo->rpcport)) != 0 )

2
includes/iguana_defines.h

@ -78,7 +78,7 @@ struct iguana_txdatabits { uint64_t addrind:IGUANA_LOG2MAXPEERS,filecount:10,fpo
#define IGUANA_DEDICATED_THREADS #define IGUANA_DEDICATED_THREADS
#ifdef IGUANA_DEDICATED_THREADS #ifdef IGUANA_DEDICATED_THREADS
#define IGUANA_MAXCONNTHREADS 16 #define IGUANA_MAXCONNTHREADS 32
#define IGUANA_MAXSENDTHREADS (IGUANA_MAXPEERS>>2) #define IGUANA_MAXSENDTHREADS (IGUANA_MAXPEERS>>2)
#define IGUANA_MAXRECVTHREADS (IGUANA_MAXPEERS>>2) #define IGUANA_MAXRECVTHREADS (IGUANA_MAXPEERS>>2)
#else #else

Loading…
Cancel
Save