Browse Source

Merge branch 'master' into release/v0.1

release/v0.1
jl777 8 years ago
parent
commit
54a72c9d43
  1. 2
      iguana/coins/genltc
  2. 25
      iguana/iguana_blocks.c
  3. 2
      iguana/iguana_chains.c
  4. 10
      iguana/iguana_init.c
  5. 4
      includes/iguana_structs.h

2
iguana/coins/genltc

@ -1,2 +1,2 @@
curl --url "http://127.0.0.1:7778" --data "{\"RELAY\":1,\"VALIDATE\":1,\"prefetchlag\":-1,\"poll\":10,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":8,\"endpend\":8,\"services\":129,\"maxpeers\":256,\"newcoin\":\"LTC\",\"name\":\"Litecoin\",\"hasheaders\":1,\"useaddmultisig\":0,\"netmagic\":\"fbc0b6db\",\"p2p\":9333,\"rpc\":9332,\"pubval\":48,\"p2shval\":5,\"wifval\":176,\"txfee_satoshis\":\"100000\",\"isPoS\":0,\"minoutput\":10000,\"minconfirms\":2,\"genesishash\":\"12a765e31ffd4059bada1e25190f6e98c99d9714d334efa41a195a7e7e04bfe2\",\"genesis\":{\"version\":1,\"timestamp\":1317972665,\"nBits\":\"1e0ffff0\",\"nonce\":2084524493,\"merkle_root\":\"97ddfbbae6be97fd6cdf3e7ca13232a3afff2353e29badfab7f73011edd4ced9\"},\"alertpubkey\":\"040184710fa689ad5023690c80f3a49c8f13f8d45b8c857fbcbc8bc4a8e4d3eb4b10f4d4604fa08dce601aaf0f470216fe1b51850b4acf21b179c45070ac7b03a9\",\"protover\":70002}" curl --url "http://127.0.0.1:7778" --data "{\"RELAY\":1,\"VALIDATE\":1,\"prefetchlag\":-1,\"poll\":10,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":68,\"endpend\":68,\"services\":129,\"maxpeers\":256,\"newcoin\":\"LTC\",\"name\":\"Litecoin\",\"hasheaders\":1,\"useaddmultisig\":0,\"netmagic\":\"fbc0b6db\",\"p2p\":9333,\"rpc\":9332,\"pubval\":48,\"p2shval\":5,\"wifval\":176,\"txfee_satoshis\":\"100000\",\"isPoS\":0,\"minoutput\":10000,\"minconfirms\":2,\"genesishash\":\"12a765e31ffd4059bada1e25190f6e98c99d9714d334efa41a195a7e7e04bfe2\",\"genesis\":{\"version\":1,\"timestamp\":1317972665,\"nBits\":\"1e0ffff0\",\"nonce\":2084524493,\"merkle_root\":\"97ddfbbae6be97fd6cdf3e7ca13232a3afff2353e29badfab7f73011edd4ced9\"},\"alertpubkey\":\"040184710fa689ad5023690c80f3a49c8f13f8d45b8c857fbcbc8bc4a8e4d3eb4b10f4d4604fa08dce601aaf0f470216fe1b51850b4acf21b179c45070ac7b03a9\",\"protover\":70002}"

25
iguana/iguana_blocks.c

@ -203,39 +203,35 @@ void _iguana_blocklink(struct iguana_info *coin,struct iguana_block *prev,struct
struct iguana_block *iguana_blockhashset(char *debugstr,struct iguana_info *coin,int32_t height,bits256 hash2,int32_t createflag) struct iguana_block *iguana_blockhashset(char *debugstr,struct iguana_info *coin,int32_t height,bits256 hash2,int32_t createflag)
{ {
struct iguana_block *block,*prev; int32_t size; struct iguana_block *block,*prev; int32_t size;
/*if ( height > 0 && height > coin->blocks.maxbits ) /*while ( coin->blockdepth > 0 )
{
printf("%s: illegal height.%d when max.%d, or nonz depth.%d\n",debugstr,height,coin->blocks.maxbits,coin->blockdepth);
//getchar();
return(0);
}*/
while ( coin->blockdepth > 0 )
{ {
usleep(100000); usleep(100000);
if ( coin->blockdepth > 0 ) if ( coin->blockdepth > 0 )
printf("A %s >>>>>>>>>> OK only if rare %s blockhashset.%d depth.%d\n",coin->symbol,debugstr,height,coin->blockdepth); printf("A %s >>>>>>>>>> OK only if rare %s blockhashset.%d depth.%d\n",coin->symbol,debugstr,height,coin->blockdepth);
//fprintf(stderr,">>>>>>>>>> OK only if rare %s blockhashset.%d depth.%d\n",debugstr,height,depth); //fprintf(stderr,">>>>>>>>>> OK only if rare %s blockhashset.%d depth.%d\n",debugstr,height,depth);
//printf("%d\n",1/(1 - depth/depth)); //printf("%d\n",1/(1 - depth/depth));
} }*/
portable_mutex_lock(&coin->blocks_mutex);
coin->blockdepth++; coin->blockdepth++;
HASH_FIND(hh,coin->blocks.hash,&hash2,sizeof(hash2),block); HASH_FIND(hh,coin->blocks.hash,&hash2,sizeof(hash2),block);
if ( block != 0 ) if ( block != 0 )
{ {
if ( coin->blockdepth > 0 ) if ( coin->blockdepth > 0 )
coin->blockdepth--; coin->blockdepth--;
while ( coin->blockdepth > 0 ) /*while ( coin->blockdepth > 0 )
{ {
usleep(100000); usleep(100000);
if ( coin->blockdepth > 0 ) if ( coin->blockdepth > 0 )
printf("B %s >>>>>>>>>> OK only if rare %s match blockhashset.%d depth.%d\n",coin->symbol,debugstr,height,coin->blockdepth); printf("B %s >>>>>>>>>> OK only if rare %s match blockhashset.%d depth.%d\n",coin->symbol,debugstr,height,coin->blockdepth);
//fprintf(stderr,">>>>>>>>>> OK only if rare%s match blockhashset.%d depth.%d\n",debugstr,height,depth); //fprintf(stderr,">>>>>>>>>> OK only if rare%s match blockhashset.%d depth.%d\n",debugstr,height,depth);
//printf("%d\n",1/(1 - depth/depth)); //printf("%d\n",1/(1 - depth/depth));
} }*/
portable_mutex_unlock(&coin->blocks_mutex);
return(block); return(block);
} }
if ( createflag > 0 ) if ( createflag > 0 )
{ {
portable_mutex_lock(&coin->blocks_mutex); //portable_mutex_lock(&coin->blocks_mutex);
size = (int32_t)((coin->chain->zcash != 0) ? sizeof(struct iguana_zblock) : sizeof(struct iguana_block)); size = (int32_t)((coin->chain->zcash != 0) ? sizeof(struct iguana_zblock) : sizeof(struct iguana_block));
block = calloc(1,size); block = calloc(1,size);
block->RO.hash2 = hash2; block->RO.hash2 = hash2;
@ -261,18 +257,19 @@ struct iguana_block *iguana_blockhashset(char *debugstr,struct iguana_info *coin
if ( tmp != block ) if ( tmp != block )
printf("%s height.%d search error %p != %p\n",str,height,block,tmp); printf("%s height.%d search error %p != %p\n",str,height,block,tmp);
} }
portable_mutex_unlock(&coin->blocks_mutex); //portable_mutex_unlock(&coin->blocks_mutex);
} }
if ( coin->blockdepth > 0 ) if ( coin->blockdepth > 0 )
coin->blockdepth--; coin->blockdepth--;
while ( coin->blockdepth > 0 ) portable_mutex_unlock(&coin->blocks_mutex);
/* while ( coin->blockdepth > 0 )
{ {
usleep(100000); usleep(100000);
if ( coin->blockdepth > 0 ) if ( coin->blockdepth > 0 )
printf("C %s >>>>>>>>>> OK only if rare %s create blockhashset.%d depth.%d\n",coin->symbol,debugstr,height,coin->blockdepth); printf("C %s >>>>>>>>>> OK only if rare %s create blockhashset.%d depth.%d\n",coin->symbol,debugstr,height,coin->blockdepth);
//fprintf(stderr,">>>>>>>>>> OK only if rare%s create blockhashset.%d depth.%d\n",debugstr,height,depth); //fprintf(stderr,">>>>>>>>>> OK only if rare%s create blockhashset.%d depth.%d\n",debugstr,height,depth);
//printf("%d\n",1/(1 - depth/depth)); //printf("%d\n",1/(1 - depth/depth));
} }*/
return(block); return(block);
} }

2
iguana/iguana_chains.c

@ -125,7 +125,7 @@ int32_t blockhash_scrypt(uint8_t *blockhashp,uint8_t *serialized,int32_t len)
blockhashfunc iguana_hashalgo(char *hashalgostr) blockhashfunc iguana_hashalgo(char *hashalgostr)
{ {
//return(blockhash_sha256); return(blockhash_sha256); // all coins seem to use this for genesis
if ( hashalgostr == 0 || hashalgostr[0] == 0 || strcmp(hashalgostr,"sha256") == 0 ) if ( hashalgostr == 0 || hashalgostr[0] == 0 || strcmp(hashalgostr,"sha256") == 0 )
return(blockhash_sha256); return(blockhash_sha256);
else if ( strcmp(hashalgostr,"scrypt") == 0 ) else if ( strcmp(hashalgostr,"scrypt") == 0 )

10
iguana/iguana_init.c

@ -378,7 +378,7 @@ void iguana_parseline(struct supernet_info *myinfo,struct iguana_info *coin,int3
{ {
if ( iguana_bundleinitmap(myinfo,coin,bp,height,hash2,hash1) == 0 ) if ( iguana_bundleinitmap(myinfo,coin,bp,height,hash2,hash1) == 0 )
lastbundle = hash2, lastheight = height; lastbundle = hash2, lastheight = height;
else if ( missing++ > coin->MAXBUNDLES && strcmp("BTC",coin->symbol) == 0 ) else if ( missing++ > coin->MAXBUNDLES && strcmp("BTCD",coin->symbol) != 0 )
{ {
printf("missing.%d\n",missing); printf("missing.%d\n",missing);
break; break;
@ -460,13 +460,7 @@ void iguana_blockspurge(struct iguana_info *coin)
} }
coin->blocks.hash = 0; coin->blocks.hash = 0;
} }
/*if ( coin->blocks.RO != 0 ) coin->blocks.maxblocks = coin->blocks.initblocks = coin->blocks.hashblocks = coin->blocks.issuedblocks = coin->blocks.recvblocks = coin->blocks.emitblocks = coin->blocks.parsedblocks = coin->blocks.dirty = 0;
{
printf("deprecated coin->blocks.RO used??\n");
myfree(coin->blocks.RO,coin->blocks.maxbits * sizeof(*coin->blocks.RO));
coin->blocks.RO = 0;
}
coin->blocks.maxbits = */coin->blocks.maxblocks = coin->blocks.initblocks = coin->blocks.hashblocks = coin->blocks.issuedblocks = coin->blocks.recvblocks = coin->blocks.emitblocks = coin->blocks.parsedblocks = coin->blocks.dirty = 0;
printf("clear hwmchain\n"); printf("clear hwmchain\n");
memset(&coin->blocks.hwmchain,0,sizeof(coin->blocks.hwmchain)); memset(&coin->blocks.hwmchain,0,sizeof(coin->blocks.hwmchain));
} }

4
includes/iguana_structs.h

@ -222,7 +222,7 @@ struct iguana_blockRO RO
struct iguana_block struct iguana_block
{ {
iguana_blockfields; iguana_blockfields;
//struct iguana_zcashRO zRO[]; struct iguana_zcashRO zRO[];
} PACKEDSTRUCT; } PACKEDSTRUCT;
struct iguana_zblock // mu struct iguana_zblock // mu
@ -254,7 +254,7 @@ struct iguana_blocks
{ {
char coin[8]; char coin[8];
struct iguanakv *db; struct iguanakv *db;
struct iguana_block *hash; //struct iguana_blockRO *RO; int32_t maxbits; struct iguana_block *hash;
int32_t maxblocks,initblocks,hashblocks,pending,issuedblocks,recvblocks,emitblocks,parsedblocks,dirty; int32_t maxblocks,initblocks,hashblocks,pending,issuedblocks,recvblocks,emitblocks,parsedblocks,dirty;
struct iguana_zblock hwmchain,prev,prev2; struct iguana_zblock hwmchain,prev,prev2;
}; };

Loading…
Cancel
Save