Browse Source

test

release/v0.1
jl777 8 years ago
parent
commit
300a7c188a
  1. 2
      iguana/coins/gentaz
  2. 3
      iguana/confs/TAZ_peers.txt
  3. 6
      iguana/iguana_blocks.c
  4. 28
      iguana/iguana_msg.c
  5. 17
      iguana/iguana_recv.c
  6. 2
      includes/iguana_structs.h

2
iguana/coins/gentaz

@ -0,0 +1,2 @@
curl --url "http://127.0.0.1:7778" --data "{\"unitval\":\"20\",\"zcash\":1,\"RELAY\":1,\"VALIDATE\":1,\"prefetchlag\":-1,\"poll\":10,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":8,\"endpend\":8,\"services\":129,\"maxpeers\":32,\"newcoin\":\"TAZ\",\"name\":\"Test Zcash\",\"hasheaders\":1,\"useaddmultisig\":0,\"netmagic\":\"a5f1e726\",\"p2p\":18233,\"rpc\":18232,\"pubval\":111,\"p2shval\":196,\"wifval\":239,\"txfee_satoshis\":\"10000\",\"isPoS\":0,\"minoutput\":10000,\"minconfirms\":2,\"genesishash\":\"0cdf00b25a93ded11d73ebe1728cf7867f18e1f62aca9554b95e0f3026174e33\",\"protover\":170002,\"genesisblock\":\"0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a0000000000000000000000000000000000000000000000000000000000000000dae5494d0f0f0f200900000000000000000000000000000000000000000000000000000000000000fd4005003423da3e41f916bf3ff0ee770eb844a240361abe08a8c9d46bd30226e2ad411a4047b6ddc230d173c60537e470e24f764120f5a2778b2a1285b0727bf79a0b085ad67e6266fb38fd72ef17f827315c42f921720248c983d4100e6ebd1c4b5e8762a973bac3bec7f7153b93752ebbb465f0fc9520bcfc30f9abfe303627338fed6ede9cf1b9173a736cf270cf4d9c6999ff4c3a301a78fd50dab6ccca67a0c5c2e41f216a1f3efd049a74bbe6252f9773bc309d3f9e554d996913ce8e1cec672a1fa4ea59726b61ea9e75d5ce9aa5dbfa96179a293810e02787f26de324fe7c88376ff57e29574a55faff7c2946f3e40e451861c32bf67da7377de3136858a18f34fab1bc8da37726ca2c25fc7b312a5427554ec944da81c7e27255d6c94ade9987ff7daedc2d1cc63d7d4cf93e691d13326fb1c7ee72ccdc0b134eb665fc6a9821e6fef6a6d45e4aac6dca6b505a0100ad56ea4f6fa4cdc2f0d1b65f730104a515172e34163bdb422f99d083e6eb860cf6b3f66642c4dbaf0d0fa1dca1b6166f1d1ffaa55a9d6d6df628afbdd14f1622c1c8303259299521a253bc28fcc93676723158067270fc710a09155a1e50c533e9b79ed5edba4ab70a08a9a2fc0eef0ddae050d75776a9804f8d6ad7e30ccb66c6a98d86710ca7a4dfb4feb159484796b9a015c5764aa3509051c87f729b9877ea41f8b470898c01388ed9098b1e006d3c30fc6e7c781072fa3f75d918505ee8ca75840fc62f67c57060666aa42578a2dd022eda62e3f1e447d7364074d34fd60ad9b138f60422afa6cfcb913fd6c213b496144dbfda7bfc7c24540cfe40ad0c0fd5a8c0902127f53d3178ba1b2a87bf1224d53d3a15e49ccdf121ae872a011c996d1b9793153cdcd4c0a7e99f8a35669788551cca2b62769eda24b6b55e2f4e0ac0d30aa50ecf33c6cdb24adfc922006a7bf434ced800fefe814c94c6fc8caa37b372d5088bb31d2f6b11a7a67ad3f70abbac0d5c256b637828de6cc525978cf151a2e50798e0c591787639a030291272c9ced3ab7d682e03f8c7db51f60163baa85315789666ea8c5cd6f789a7f4a5de4f8a9dfefce20f353cec606492fde8eab3e3b487b3a3a57434f8cf252a4b643fc125c8a5948b06744f5dc306aa587bdc85364c7488235c6edddd78763675e50a9637181519be06dd30c4ba0d845f9ba320d01706fd6dd64d1aa3cd4211a4a7d1d3f2c1ef2766d27d5d2cdf8e7f5e3ea309d4f149bb737305df1373a7f5313abe5986f4aa620bec4b0065d48aafac3631de3771f5c4d2f6eec67b09d9c70a3c1969fecdb014cb3c69832b63cc9d6efa378bff0ef95ffacdeb1675bb326e698f022c1a3a2e1c2b0f05e1492a6d2b7552388eca7ee8a2467ef5d4207f65d4e2ae7e33f13eb473954f249d7c20158ae703e1accddd4ea899f026618695ed2949715678a32a153df32c08922fafad68b1895e3b10e143e712940104b3b352369f4fe79bd1f1dbe03ea9909dbcf5862d1f15b3d1557a6191f54c891513cdb3c729bb9ab08c0d4c35a3ed67d517ffe1e2b7a798521aed15ff9822169c0ec860d7b897340bc2ef4c37f7eb73bd7dafef12c4fd4e6f5dd3690305257ae14ed03df5e3327b68467775a90993e613173fa6650ffa2a26e84b3ce79606bf234eda9f4053307f344099e3b10308d3785b8726fd02d8e94c2759bebd05748c3fe7d5fe087dc63608fb77f29708ab167a13f32da251e249a544124ed50c270cfc6986d9d1814273d2f0510d0d2ea335817207db6a4a23ae9b079967b63b25cb3ceea7001b65b879263f5009ac84ab89738a5b8b71fd032beb9f297326f1f5afa630a5198d684514e242f315a4d95fa6802e82799a525bb653b80b4518ec610a5996403b1391\",\"debug\":0}"

3
iguana/confs/TAZ_peers.txt

@ -0,0 +1,3 @@
176.9.26.39
5.9.102.210
78.47.196.146

6
iguana/iguana_blocks.c

@ -410,7 +410,7 @@ void iguana_blockmerge(struct iguana_block *dest,struct iguana_prevdep *destlp,s
double PoW_from_compact(uint32_t nBits,uint8_t unitval) // NOT consensus safe, but most of the time will be correct
{
uint32_t nbytes,nbits,i,n; double PoW; uint64_t mult;
uint32_t nbytes,nbits; int32_t i,n; double PoW; uint64_t mult;
nbytes = (nBits >> 24) & 0xFF;
nbits = (8 * (nbytes - 3));
PoW = (nBits & 0xFFFFFF);
@ -419,7 +419,7 @@ double PoW_from_compact(uint32_t nBits,uint8_t unitval) // NOT consensus safe, b
printf("illegal nBits.%x unitval.%02x\n",nBits,unitval);
return(0.);
}
if ( (n= ((8 * (unitval-3)) - nbits)) != 0 ) // 0x1d00ffff is genesis nBits so we map that to 1.
if ( (n= ((8 * (unitval-3)) - nbits)) > 0 ) // 0x1d00ffff is genesis nBits so we map that to 1.
{
//printf("nbits.%d -> n.%d\n",nbits,n);
if ( n < 64 )
@ -429,7 +429,7 @@ double PoW_from_compact(uint32_t nBits,uint8_t unitval) // NOT consensus safe, b
for (i=0; i<n; i++)
PoW /= 2.;
}
}
} else PoW = 1.;
mult = 1;
while ( nbytes++ < unitval )
mult <<= 8;

28
iguana/iguana_msg.c

@ -218,10 +218,9 @@ int32_t iguana_rwblock(struct supernet_info *myinfo,char *symbol,uint8_t zcash,u
if ( x < 65536 )
{
if ( zcash != 0 )
msg->txn_count = (uint16_t)x;
else zmsg->txn_count = (uint16_t)x;
}
else printf("txn_count overflow.%lld for %s\n",(long long)x,str);
zmsg->txn_count = (uint16_t)x;
else msg->txn_count = (uint16_t)x;
} else printf("txn_count overflow.%lld for %s\n",(long long)x,str);
}
// ? txns tx[] Block transactions, in format of "tx" command
return(len);
@ -678,7 +677,7 @@ int32_t iguana_rwtx(struct supernet_info *myinfo,uint8_t zcash,int32_t rwflag,st
uint32_t numjoinsplits; struct iguana_msgjoinsplit joinsplit; uint8_t joinsplitpubkey[33],joinsplitsig[64];
len += iguana_rwvarint32(rwflag,&serialized[len],&numjoinsplits);
char str[65];
printf("numjoinsplits.%d version.%d numvins.%d numvouts.%d locktime.%u %s\n",numjoinsplits,msg->version,msg->tx_in,msg->tx_out,msg->lock_time,bits256_str(str,*txidp));
printf("[%ld] numjoinsplits.%d version.%d numvins.%d numvouts.%d locktime.%u %s\n",sizeof(joinsplit),numjoinsplits,msg->version,msg->tx_in,msg->tx_out,msg->lock_time,bits256_str(str,*txidp));
if ( numjoinsplits > 0 )
{
for (i=0; i<numjoinsplits; i++)
@ -688,12 +687,13 @@ int32_t iguana_rwtx(struct supernet_info *myinfo,uint8_t zcash,int32_t rwflag,st
{
memset(joinsplitpubkey,0,sizeof(joinsplitpubkey)); // for now
memset(joinsplitsig,0,sizeof(joinsplitsig)); // set to actuals
memcpy(&serialized[len],joinsplitpubkey,33), len += 33;
memcpy(&serialized[len],joinsplitpubkey+1,32), len += 32;
memcpy(&serialized[len],joinsplitsig,64), len += 64;
}
else
{
memcpy(joinsplitpubkey,&serialized[len],33), len += 33;
joinsplitpubkey[0] = 0x02; // need to verify its not 0x03
memcpy(joinsplitpubkey+1,&serialized[len],32), len += 32;
memcpy(joinsplitsig,&serialized[len],64), len += 64;
}
}
@ -1004,9 +1004,7 @@ int32_t iguana_msgparser(struct supernet_info *myinfo,struct iguana_info *coin,s
len = iguana_rwvarint32(0,data,&n);
if ( n <= IGUANA_MAXINV )
{
bits256 auxhash2,prevhash2; struct iguana_msgtx *tx; struct iguana_msgmerkle *coinbase_branch,*blockchain_branch; struct iguana_msgblock parentblock;
coinbase_branch = calloc(1,sizeof(*coinbase_branch));
blockchain_branch = calloc(1,sizeof(*blockchain_branch));
bits256 auxhash2,prevhash2; struct iguana_msgtx *tx; struct iguana_msgmerkle *coinbase_branch=0,*blockchain_branch=0; struct iguana_msgblock parentblock;
if ( rawmem->totalsize == 0 )
iguana_meminit(rawmem,"bighdrs",0,IGUANA_MAXPACKETSIZE * 2,0);
memset(prevhash2.bytes,0,sizeof(prevhash2));
@ -1016,6 +1014,10 @@ int32_t iguana_msgparser(struct supernet_info *myinfo,struct iguana_info *coin,s
{
if ( coin->chain->auxpow != 0 )
{
if ( coinbase_branch == 0 )
coinbase_branch = calloc(1,sizeof(*coinbase_branch));
if ( blockchain_branch == 0 )
blockchain_branch = calloc(1,sizeof(*blockchain_branch));
tmp = iguana_rwblockhdr(0,coin->chain->zcash,&data[len],(void *)&zmsg);
hash2 = iguana_calcblockhash(coin->symbol,coin->chain->hashalgo,&data[len],tmp);
len += tmp;
@ -1038,8 +1040,10 @@ int32_t iguana_msgparser(struct supernet_info *myinfo,struct iguana_info *coin,s
iguana_blockconv(coin->chain->zcash,coin->chain->auxpow,(void *)&zblocks[i],&zmsg,hash2,-1);
prevhash2 = hash2;
}
free(coinbase_branch);
free(blockchain_branch);
if ( coinbase_branch != 0 )
free(coinbase_branch);
if ( blockchain_branch != 0 )
free(blockchain_branch);
if ( iguana_gotheadersM(coin,addr,zblocks,n) < 0 )
myfree(zblocks,(int32_t)(sizeof(struct iguana_zblock) * n));
//myfree(blocks,sizeof(*blocks) * n);

17
iguana/iguana_recv.c

@ -1924,9 +1924,9 @@ int32_t iguana_processrecvQ(struct supernet_info *myinfo,struct iguana_info *coi
int32_t iguana_needhdrs(struct iguana_info *coin)
{
if ( coin->longestchain == 0 || coin->blocks.hashblocks < coin->longestchain-coin->chain->bundlesize )
//if ( coin->longestchain == 0 || coin->blocks.hashblocks < coin->longestchain-coin->chain->bundlesize )
return(1);
else return(0);
//else return(0);
}
int32_t iguana_reqhdrs(struct iguana_info *coin)
@ -1953,15 +1953,18 @@ int32_t iguana_reqhdrs(struct iguana_info *coin)
coin->numpendings++;
init_hexbytes_noT(hashstr,bp->hashes[0].bytes,sizeof(bits256));
queue_enqueue("hdrsQ",&coin->hdrsQ,queueitem(hashstr),1);
if ( bp == coin->current && coin->blocks.hwmchain.height > 100 )
if ( bp == coin->current )
{
init_hexbytes_noT(hashstr,bp->hashes[0].bytes,sizeof(bits256));
queue_enqueue("hdrsQ",&coin->hdrsQ,queueitem(hashstr),1);
//printf("%s issue HWM HDRS [%d] %s\n",coin->symbol,bp->hdrsi,hashstr);
bits256 hash2 = iguana_blockhash(coin,coin->blocks.hwmchain.height-10);
init_hexbytes_noT(hashstr,hash2.bytes,sizeof(bits256));
//printf("%s issue HWM HDRS %d-10 %s\n",coin->symbol,coin->blocks.hwmchain.height,hashstr);
queue_enqueue("hdrsQ",&coin->hdrsQ,queueitem(hashstr),1);
if ( coin->blocks.hwmchain.height > 10 )
{
bits256 hash2 = iguana_blockhash(coin,coin->blocks.hwmchain.height-10);
init_hexbytes_noT(hashstr,hash2.bytes,sizeof(bits256));
//printf("%s issue HWM HDRS %d-10 %s\n",coin->symbol,coin->blocks.hwmchain.height,hashstr);
queue_enqueue("hdrsQ",&coin->hdrsQ,queueitem(hashstr),1);
}
}
//printf("hdrsi.%d reqHDR.(%s) numhashes.%d\n",bp->hdrsi,hashstr,bp->numhashes);
if ( 1 )

2
includes/iguana_structs.h

@ -174,9 +174,9 @@ struct iguana_msgjoinsplit
{
uint64_t vpub_old,vpub_new;
bits256 anchor,nullifiers[2],commitments[2],ephemeralkey;
uint8_t ciphertexts[2][217];
bits256 randomseed,vmacs[2];
uint8_t zkproof[ZKSNARK_PROOF_SIZE-1];
uint8_t ciphertexts[2][217];
}PACKEDSTRUCT;
struct iguana_packet { struct queueitem DL; struct iguana_peer *addr; struct tai embargo; int32_t datalen,getdatablock; uint8_t serialized[]; };

Loading…
Cancel
Save