diff --git a/iguana/coins/basilisk b/iguana/coins/basilisk index a70bd6b42..6306b6456 100755 --- a/iguana/coins/basilisk +++ b/iguana/coins/basilisk @@ -1,4 +1,4 @@ -curl --url "http://127.0.0.1:7778" --data "{\"poll\":100,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"newcoin\":\"BTCD\",\"startpend\":1,\"endpend\":1,\"services\":128,\"maxpeers\":16,\"RELAY\":0,\"VALIDATE\":0,\"portp2p\":14631}" +curl --url "http://127.0.0.1:7778" --data "{\"poll\":100,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"newcoin\":\"BTCD\",\"startpend\":1,\"endpend\":1,\"services\":128,\"maxpeers\":16,\"RELAY\":0,\"VALIDATE\":0,\"portp2p\":14631,\"rpc\":14632}" #curl --url "http://127.0.0.1:7778" --data "{\"prefetchlag\":5,\"poll\":100,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"newcoin\":\"BTC\",\"startpend\":1,\"endpend\":1,\"services\":128,\"maxpeers\":16,\"RELAY\":0,\"VALIDATE\":0,\"portp2p\":8333}" #curl --url "http://127.0.0.1:7778" --data "{\"RELAY\":0,\"VALIDATE\":0,\"prefetchlag\":11,\"poll\":100,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":1,\"endpend\":1,\"services\":128,\"maxpeers\":16,\"newcoin\":\"LTC\",\"name\":\"Litecoin\",\"hasheaders\":1,\"useaddmultisig\":0,\"netmagic\":\"fbc0b6db\",\"p2p\":9333,\"rpc\":9334,\"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}" diff --git a/iguana/iguana_init.c b/iguana/iguana_init.c index 5e98a8f34..b0b341207 100755 --- a/iguana/iguana_init.c +++ b/iguana/iguana_init.c @@ -106,41 +106,42 @@ bits256 iguana_genesis(struct supernet_info *myinfo,struct iguana_info *coin,str return(hash2); } decode_hex(buf,(int32_t)strlen(chain->genesis_hex)/2,(char *)chain->genesis_hex); - hash2 = iguana_calcblockhash(coin->symbol,coin->chain->hashalgo,buf,sizeof(struct iguana_msgblockhdr)); - auxback = coin->chain->auxpow, coin->chain->auxpow = 0; - iguana_rwblock(myinfo,coin->symbol,coin->chain->zcash,coin->chain->auxpow,coin->chain->hashalgo,0,&hash2,buf,(void *)&zmsg,sizeof(buf)); - coin->chain->auxpow = auxback; + hash2 = iguana_calcblockhash(coin->symbol,coin->chain->hashalgo,buf,chain->zcash == 0 ? sizeof(struct iguana_msgblockhdr) : sizeof(struct iguana_msgzblockhdr)); + auxback = chain->auxpow, chain->auxpow = 0; + iguana_rwblock(myinfo,coin->symbol,coin->chain->zcash,chain->auxpow,chain->hashalgo,0,&hash2,buf,(void *)&zmsg,sizeof(buf)); + chain->auxpow = auxback; if ( coin->virtualchain == 0 && coin->MAXPEERS > 1 ) { - if ( coin->chain->debug == 0 && memcmp(hash2.bytes,chain->genesis_hashdata,sizeof(hash2)) != 0 ) + if ( chain->debug == 0 && memcmp(hash2.bytes,chain->genesis_hashdata,sizeof(hash2)) != 0 ) { bits256_str(str,hash2); - printf("genesis mismatch? zcash.%d calculated %s vs %s\n",coin->chain->zcash,str,bits256_str(str2,*(bits256 *)chain->genesis_hashdata)); + printf("genesis mismatch? zcash.%d calculated %s vs %s\n",chain->zcash,str,bits256_str(str2,*(bits256 *)chain->genesis_hashdata)); memcpy(hash2.bytes,chain->genesis_hashdata,sizeof(hash2)); } if ( coin->chain->debug != 0 ) memcpy(hash2.bytes,chain->genesis_hashdata,sizeof(hash2)); } else memcpy(hash2.bytes,chain->genesis_hashdata,sizeof(hash2)); bits256_str(str,hash2); - printf("genesis.(%s) zcash.%d len.%d hash.%s\n",chain->genesis_hex,coin->chain->zcash,(int32_t)sizeof(zmsg.zH),str); - iguana_blockconv(coin->chain->zcash,coin->chain->auxpow,(void *)block,&zmsg,hash2,0); + if ( chain->debug != 0 ) + printf("genesis.(%s) zcash.%d len.%d hash.%s\n",chain->genesis_hex,chain->zcash,(int32_t)sizeof(zmsg.zH),str); + iguana_blockconv(chain->zcash,chain->auxpow,(void *)block,&zmsg,hash2,0); block->RO.txn_count = 1; block->RO.numvouts = 1; - if ( coin->chain->zcash != 0 ) + if ( chain->zcash != 0 ) block->RO.allocsize = sizeof(struct iguana_zblock); else block->RO.allocsize = (int32_t)sizeof(*block); iguana_gotdata(coin,0,0); if ( (ptr= iguana_blockhashset("genesis0",coin,0,hash2,1)) != 0 ) { - iguana_blockcopy(coin->chain->zcash,coin->chain->auxpow,coin,ptr,block); - iguana_blocksizecheck("genesis ptr",coin->chain->zcash,ptr); + iguana_blockcopy(chain->zcash,chain->auxpow,coin,ptr,block); + iguana_blocksizecheck("genesis ptr",chain->zcash,ptr); ptr->mainchain = 1; ptr->height = 0; //coin->blocks.RO[0] = block.RO; if ( coin->virtualchain != 0 || (height= iguana_chainextend(myinfo,coin,ptr)) == 0 ) { - iguana_blockzcopy(coin->chain->zcash,block,ptr); - iguana_blockzcopy(coin->chain->zcash,(void *)&coin->blocks.hwmchain,ptr); + iguana_blockzcopy(chain->zcash,block,ptr); + iguana_blockzcopy(chain->zcash,(void *)&coin->blocks.hwmchain,ptr); printf("size.%d genesis block PoW %f ptr %f\n",block->RO.allocsize,block->PoW,ptr->PoW); coin->blocks.recvblocks = coin->blocks.issuedblocks = 1; } else printf("genesis block doesnt validate for %s ht.%d\n",coin->symbol,height); @@ -313,7 +314,7 @@ void iguana_parseline(struct supernet_info *myinfo,struct iguana_info *coin,int3 #ifndef IGUANA_DISABLEPEERS addr = &coin->peers->active[m++]; iguana_initpeer(coin,addr,(uint32_t)calc_ipbits(line)); - printf("call initpeer.(%s)\n",addr->ipaddr); + //printf("call initpeer.(%s)\n",addr->ipaddr); iguana_launch(coin,"connection",iguana_startconnection,addr,IGUANA_CONNTHREAD); #endif } diff --git a/iguana/iguana_msg.c b/iguana/iguana_msg.c index 7d00b953b..c4db2fc6d 100755 --- a/iguana/iguana_msg.c +++ b/iguana/iguana_msg.c @@ -91,7 +91,7 @@ int32_t iguana_rwmerklebranch(int32_t rwflag,uint8_t *serialized,struct iguana_m return(len); } -int32_t iguana_rwzsolution(int32_t rwflag,uint8_t *serialized,uint16_t *solution,int32_t n) +int32_t iguana_rwzsolution(int32_t rwflag,uint8_t *serialized,uint8_t *solution,int32_t n) { int32_t i,len = 0; for (i=0; ichain->debug != 0 ) { - int32_t i; - for (i=0; ichain->zcash == 0 ? 80 : sizeof(struct iguana_msgzblockhdr); + for (i=0; imsgcounts.block++; if ( (n= iguana_gentxarray(myinfo,coin,rawmem,&txdata,&len,data,recvlen)) == recvlen || n == recvlen-1 ) diff --git a/iguana/iguana_peers.c b/iguana/iguana_peers.c index 29ef6fa95..ade8d87c3 100755 --- a/iguana/iguana_peers.c +++ b/iguana/iguana_peers.c @@ -737,7 +737,7 @@ void iguana_startconnection(void *arg) printf("avoid self-loopback\n"); return; } - printf(">>>>>>>> startconnection.(%s) pending.%u usock.%d addrind.%d\n",addr->ipaddr,addr->pending,addr->usock,addr->addrind); + //printf(">>>>>>>> startconnection.(%s) pending.%u usock.%d addrind.%d\n",addr->ipaddr,addr->pending,addr->usock,addr->addrind); addr->pending = (uint32_t)time(NULL); if ( (port= (uint16_t)(addr->ipbits >> 32)) == 0 ) port = coin->chain->portp2p; diff --git a/includes/iguana_structs.h b/includes/iguana_structs.h index 1a78ebf8f..4af60d4d1 100755 --- a/includes/iguana_structs.h +++ b/includes/iguana_structs.h @@ -116,7 +116,7 @@ struct iguana_msgzblockhdr uint32_t timestamp,bits; bits256 bignonce; uint8_t var_numelements[3]; - uint16_t solution[ZCASH_SOLUTION_ELEMENTS]; + uint8_t solution[ZCASH_SOLUTION_ELEMENTS]; } PACKEDSTRUCT; /*int32_t nVersion; @@ -205,7 +205,7 @@ struct iguana_blockRO uint16_t txn_count,numvouts,numvins,allocsize; }PACKEDSTRUCT; -struct iguana_zcashRO { bits256 bignonce; uint32_t numelements; uint16_t solution[ZCASH_SOLUTION_ELEMENTS]; }PACKEDSTRUCT; +struct iguana_zcashRO { bits256 bignonce; uint32_t numelements; uint8_t solution[ZCASH_SOLUTION_ELEMENTS]; } PACKEDSTRUCT; struct iguana_zblockRO {