Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
6e7a63e976
  1. 2
      iguana/iguana777.h
  2. 12
      iguana/iguana_blocks.c
  3. 6
      iguana/iguana_init.c
  4. 6
      iguana/iguana_peers.c
  5. 3
      iguana/iguana_recv.c
  6. 2
      iguana/main.c

2
iguana/iguana777.h

@ -577,7 +577,7 @@ struct iguana_info
struct iguana_bundle *bundles[IGUANA_MAXBUNDLES],*current,*lastpending;
struct iguana_ramchain RTramchain; struct OS_memspace RTmem,RThashmem; bits256 RThash1;
int32_t numremain,numpendings,zcount,recvcount,bcount,pcount,lastbundle,numsaved,pendbalances,numverified,blockdepth;
uint32_t recvtime,hdrstime,backstoptime,lastbundletime,numreqsent,numbundlesQ,lastbundleitime,lastdisp,RTgenesis,firstRTgenesis,RTstarti,idletime,stucktime,stuckmonitor,maxstuck,lastreqtime,RThdrstime;
uint32_t recvtime,hdrstime,backstoptime,lastbundletime,numreqsent,numbundlesQ,lastbundleitime,lastdisp,RTgenesis,firstRTgenesis,RTstarti,idletime,stucktime,stuckmonitor,maxstuck,lastreqtime,RThdrstime,nextchecked;
double bandwidth,maxbandwidth,backstopmillis; bits256 backstophash2; int64_t spaceused;
int32_t initialheight,mapflags,minconfirms,numrecv,bindsock,isRT,backstop,blocksrecv,merging,polltimeout,numreqtxids,allhashes,balanceflush; bits256 reqtxids[64];
void *launched,*started,*rpcloop;

12
iguana/iguana_blocks.c

@ -208,7 +208,7 @@ struct iguana_block *iguana_blockhashset(char *debugstr,struct iguana_info *coin
portable_mutex_lock(&coin->blocks_mutex);
block = calloc(1,sizeof(*block) + coin->chain->zcash*sizeof(*block->zRO));
block->RO.hash2 = hash2;
block->RO.allocsize = (int32_t)(sizeof(*block) + coin->chain->zcash*sizeof(*block->zRO));
block->RO.allocsize = coin->chain->zcash != 0 ? sizeof(*block) : sizeof(struct iguana_zblock);
block->hh.itemind = height, block->height = -1;
HASH_ADD(hh,coin->blocks.hash,RO.hash2,sizeof(hash2),block);
block->hh.next = block->hh.prev = 0;
@ -283,6 +283,8 @@ int32_t iguana_blockvalidate(struct iguana_info *coin,int32_t *validp,struct igu
iguana_serialize_block(coin->chain,&hash2,serialized,block);
*validp = (memcmp(hash2.bytes,block->RO.hash2.bytes,sizeof(hash2)) == 0);
block->valid = *validp;
if ( block->RO.allocsize == 0 )
block->RO.allocsize = coin->chain->zcash != 0 ? sizeof(*block) : sizeof(struct iguana_zblock);
char str[65]; char str2[65];
if ( *validp == 0 )
{
@ -484,11 +486,15 @@ struct iguana_block *_iguana_chainlink(struct iguana_info *coin,struct iguana_bl
bits256 *hash2p=0; double prevPoW = 0.; struct iguana_bundle *bp;
if ( newblock == 0 )
return(0);
if ( newblock->RO.allocsize == 0 )
newblock->RO.allocsize = coin->chain->zcash != 0 ? sizeof(*newblock) : sizeof(struct iguana_zblock);
hwmchain = (struct iguana_block *)&coin->blocks.hwmchain;
if ( 0 && hwmchain->height > 0 && ((bp= coin->current) == 0 || hwmchain->height/coin->chain->bundlesize > bp->hdrsi+0*bp->isRT) )
return(0);
if ( (block= iguana_blockfind("chainlink",coin,newblock->RO.hash2)) != 0 )
{
if ( block->RO.allocsize == 0 )
block->RO.allocsize = coin->chain->zcash != 0 ? sizeof(*newblock) : sizeof(struct iguana_zblock);
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;
else if ( (prev= iguana_blockfind("chainprev",coin,block->RO.prev_block)) != 0 )
@ -551,9 +557,9 @@ struct iguana_block *_iguana_chainlink(struct iguana_info *coin,struct iguana_bl
else str2[0] = 0;
if ( coin->blocks.maxblocks > coin->longestchain )
coin->longestchain = coin->blocks.maxblocks;
if ( 1 && (block->height % 1000) == 0 )
if ( 1 && (block->height % coin->chain->bundlesize) == 0 )
{
//printf("EXTENDMAIN %s %d <- (%s) n.%u max.%u PoW %f numtx.%d valid.%d\n",str,block->height,str2,hwmchain->height+1,coin->blocks.maxblocks,block->PoW,block->RO.txn_count,block->valid);
printf("EXTENDMAIN %s %d <- (%s) n.%u max.%u PoW %f numtx.%d valid.%d\n",str,block->height,str2,hwmchain->height+1,coin->blocks.maxblocks,block->PoW,block->RO.txn_count,block->valid);
//iguana_walkchain(coin);
}
struct iguana_bundle *bp; int32_t hdrsi;

6
iguana/iguana_init.c

@ -523,7 +523,7 @@ struct iguana_info *iguana_coinstart(struct iguana_info *coin,int32_t initialhei
if ( iter == 0 )
{
char **ipaddrs = 0; int32_t j,num;
char *BTC_ipaddrs[] = { "5.9.102.210", "130.211.146.81", "1176.9.29.76", "108.58.252.82", "148.251.151.48", "74.207.233.193" };
char *BTC_ipaddrs[] = { "5.9.102.210", "130.211.146.81", "176.9.29.76", "108.58.252.82", "148.251.151.48", "74.207.233.193" };
char *BTCD_ipaddrs[] = { "5.9.102.210", "89.248.160.236", "89.248.160.237", "89.248.160.238", "89.248.160.239", "89.248.160.240", "89.248.160.241", "89.248.160.242", "89.248.160.243", "89.248.160.244", "89.248.160.245", "78.47.58.62", "67.212.70.88", "94.102.50.69", "50.179.58.158", "194.135.94.30", "109.236.85.42", "104.236.127.154", "68.45.147.145", "37.59.14.7", "78.47.115.250", "188.40.138.8", "62.75.143.120", "82.241.71.230", "217.23.6.2", "73.28.172.128", "45.55.149.34", "192.0.242.54", "81.181.155.53", "91.66.185.97", "85.25.217.233", "144.76.239.66", "95.80.9.112", "80.162.193.118", "173.65.129.85", "2.26.173.58", "78.14.250.69", "188.226.253.77", "58.107.67.39", "124.191.37.212", "176.226.137.238", "69.145.25.85", "24.168.14.28", "73.201.180.47", "76.188.171.53", "63.247.147.166", "121.108.241.247", "36.74.36.125", "106.186.119.171", "188.166.91.37", "223.134.228.208", "89.248.160.244", "178.33.209.212", "71.53.156.38", "88.198.10.165", "24.117.221.0", "74.14.104.57", "158.69.27.82", "110.174.129.213", "75.130.163.51" };
if ( strcmp(coin->symbol,"BTCD") == 0 )
ipaddrs = BTCD_ipaddrs, num = (int32_t)(sizeof(BTCD_ipaddrs)/sizeof(*BTCD_ipaddrs));
@ -542,7 +542,7 @@ struct iguana_info *iguana_coinstart(struct iguana_info *coin,int32_t initialhei
}
else
{
#include "confs/BTCD_hdrs.h"
/*#include "confs/BTCD_hdrs.h"
if ( strcmp(coin->symbol,"BTCD") == 0 )
{
bits256 hash2,allhash,hash1; int32_t bundlei,i,nonz,height; struct iguana_bundle *bp;
@ -566,7 +566,7 @@ struct iguana_info *iguana_coinstart(struct iguana_info *coin,int32_t initialhei
//if ( bits256_nonz(lastbundle) != 0 )
// iguana_initfinal(coin,lastbundle);
//break;
}
}*/
}
#endif
sprintf(fname,"%s/%s_%s.txt",GLOBAL_CONFSDIR,coin->symbol,(iter == 0) ? "peers" : "hdrs"), OS_compatible_path(fname);

6
iguana/iguana_peers.c

@ -22,9 +22,9 @@ int32_t iguana_validatehdr(char *symbol,struct iguana_msghdr *H)
{
int32_t i = 0,valid=0,len = -1; char cmdstr[16];
memcpy(cmdstr,H->command,sizeof(H->command));
cmdstr[0] = toupper(cmdstr[0]);
cmdstr[6] = toupper(cmdstr[6]);
cmdstr[7] = toupper(cmdstr[7]);
cmdstr[0] = toupper((int32_t)cmdstr[0]);
cmdstr[6] = toupper((int32_t)cmdstr[6]);
cmdstr[7] = toupper((int32_t)cmdstr[7]);
if ( strcmp(symbol,"VPN") == 0 || strncmp("SuperNET",cmdstr,strlen("SuperNET")) == 0 )
valid = 1;
else

3
iguana/iguana_recv.c

@ -1205,11 +1205,12 @@ int32_t iguana_reqblocks(struct iguana_info *coin)
next = 0;
}
}
if ( next != 0 )
if ( next != 0 )//&& time(NULL) > coin->nextchecked+10 )
{
//printf("have next %d\n",coin->blocks.hwmchain.height);
if ( memcmp(next->RO.prev_block.bytes,coin->blocks.hwmchain.RO.hash2.bytes,sizeof(bits256)) == 0 )
{
coin->nextchecked = (uint32_t)time(NULL);
if ( _iguana_chainlink(coin,next) != 0 )
lflag++, flag++;
//else printf("chainlink error for %d\n",coin->blocks.hwmchain.height+1);

2
iguana/main.c

@ -1177,7 +1177,7 @@ void iguana_appletests(struct supernet_info *myinfo)
bitcoin_sharedsecret(myinfo->ctx,hash2,pubkey,33);
printf("secp256k1 elapsed %.3f for %d iterations\n",OS_milliseconds() - startmillis,i);
getchar();**/
if ( 1 && (str= SuperNET_JSON(myinfo,cJSON_Parse("{\"protover\":70002,\"RELAY\":1,\"VALIDATE\":1,\"portp2p\":14631,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":4,\"endpend\":4,\"services\":128,\"maxpeers\":128,\"newcoin\":\"BTCD\",\"active\":1,\"numhelpers\":4,\"poll\":100}"),0,myinfo->rpcport)) != 0 )
if ( 1 && (str= SuperNET_JSON(myinfo,cJSON_Parse("{\"protover\":70002,\"RELAY\":1,\"VALIDATE\":1,\"portp2p\":14631,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":64,\"endpend\":64,\"services\":129,\"maxpeers\":128,\"newcoin\":\"BTCD\",\"active\":1,\"numhelpers\":4,\"poll\":1}"),0,myinfo->rpcport)) != 0 )
{
free(str);
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\":64,\"newcoin\":\"BTC\",\"active\":0,\"numhelpers\":4,\"poll\":100}"),0,myinfo->rpcport)) != 0 )

Loading…
Cancel
Save