From cf081f9b534e6695ac7268c8887b91ad7d131747 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 20 Aug 2016 22:30:44 -0300 Subject: [PATCH] test --- iguana/coins/dgb | 2 +- iguana/coins/gendgb | 2 +- iguana/coins/gendoge | 2 +- iguana/iguana777.c | 2 +- iguana/iguana_init.c | 4 +++- iguana/iguana_peers.c | 14 +++++++------- iguana/iguana_unspents.c | 2 +- includes/iguana_defines.h | 2 +- 8 files changed, 16 insertions(+), 14 deletions(-) diff --git a/iguana/coins/dgb b/iguana/coins/dgb index 0a80d0322..089ef6112 100755 --- a/iguana/coins/dgb +++ b/iguana/coins/dgb @@ -1,3 +1,3 @@ -curl --url "http://127.0.0.1:7778" --data "{\"RELAY\":0,\"VALIDATE\":0,\"prefetchlag\":-1,\"poll\":10,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"maxpeers\":256,\"newcoin\":\"DGB\",\"name\":\"Digibyte\",\"netmagic\":\"FAC3B6DA\",\"p2p\":12024,\"rpc\":14022,\"pubval\":0,\"p2shval\":5,\"wifval\":128,\"txfee_satoshis\":\"10000\",\"minconfirms\":2,\"genesishash\":\"7497ea1b465eb39f1c8f507bc877078fe016d6fcb6dfad3a64c98dcc6e1e8496\",\"genesis\":{\"version\":1,\"timestamp\":1389388394,\"nBits\":\"1e0ffff0\",\"nonce\":2447652,\"merkle_root\":\"72ddd9496b004221ed0557358846d9248ecd4c440ebd28ed901efc18757d0fad\"},\"alertpubkey\":\"04F04441C4757F356290A37C313C3772C5BC5003E898EB2E0CF365795543A7BF690C8BBBFA32EE3A3325477CE2000B7D0453EFBB203329D0F9DF34D5927D022BC9\"}" +curl --url "http://127.0.0.1:7778" --data "{\"RELAY\":0,\"VALIDATE\":0,\"prefetchlag\":-1,\"poll\":10,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"maxpeers\":256,\"newcoin\":\"DGB\",\"name\":\"Digibyte\",\"netmagic\":\"FAC3B6DA\",\"p2p\":12024,\"rpc\":14022,\"pubval\":30,\"p2shval\":5,\"wifval\":128,\"txfee_satoshis\":\"10000\",\"minconfirms\":2,\"genesishash\":\"7497ea1b465eb39f1c8f507bc877078fe016d6fcb6dfad3a64c98dcc6e1e8496\",\"genesis\":{\"version\":1,\"timestamp\":1389388394,\"nBits\":\"1e0ffff0\",\"nonce\":2447652,\"merkle_root\":\"72ddd9496b004221ed0557358846d9248ecd4c440ebd28ed901efc18757d0fad\"},\"alertpubkey\":\"04F04441C4757F356290A37C313C3772C5BC5003E898EB2E0CF365795543A7BF690C8BBBFA32EE3A3325477CE2000B7D0453EFBB203329D0F9DF34D5927D022BC9\"}" diff --git a/iguana/coins/gendgb b/iguana/coins/gendgb index 7eac84c77..4585ec54a 100755 --- a/iguana/coins/gendgb +++ b/iguana/coins/gendgb @@ -1,3 +1,3 @@ -curl --url "http://127.0.0.1:7778" --data "{\"RELAY\":1,\"VALIDATE\":1,\"prefetchlag\":-1,\"poll\":10,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"maxpeers\":256,\"newcoin\":\"DGB\",\"name\":\"Digibyte\",\"netmagic\":\"FAC3B6DA\",\"p2p\":12024,\"rpc\":14022,\"pubval\":30,\"p2shval\":5,\"wifval\":128,\"txfee_satoshis\":\"10000\",\"minconfirms\":2,\"genesishash\":\"7497ea1b465eb39f1c8f507bc877078fe016d6fcb6dfad3a64c98dcc6e1e8496\",\"genesis\":{\"version\":1,\"timestamp\":1389388394,\"nBits\":\"1e0ffff0\",\"nonce\":2447652,\"merkle_root\":\"72ddd9496b004221ed0557358846d9248ecd4c440ebd28ed901efc18757d0fad\"},\"alertpubkey\":\"04F04441C4757F356290A37C313C3772C5BC5003E898EB2E0CF365795543A7BF690C8BBBFA32EE3A3325477CE2000B7D0453EFBB203329D0F9DF34D5927D022BC9\"}" +curl --url "http://127.0.0.1:7778" --data "{\"services\":129,\"RELAY\":1,\"VALIDATE\":1,\"prefetchlag\":-1,\"poll\":10,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"maxpeers\":256,\"newcoin\":\"DGB\",\"name\":\"Digibyte\",\"netmagic\":\"FAC3B6DA\",\"p2p\":12024,\"rpc\":14022,\"pubval\":30,\"p2shval\":5,\"wifval\":128,\"txfee_satoshis\":\"10000\",\"minconfirms\":2,\"genesishash\":\"7497ea1b465eb39f1c8f507bc877078fe016d6fcb6dfad3a64c98dcc6e1e8496\",\"genesis\":{\"version\":1,\"timestamp\":1389388394,\"nBits\":\"1e0ffff0\",\"nonce\":2447652,\"merkle_root\":\"72ddd9496b004221ed0557358846d9248ecd4c440ebd28ed901efc18757d0fad\"},\"alertpubkey\":\"04F04441C4757F356290A37C313C3772C5BC5003E898EB2E0CF365795543A7BF690C8BBBFA32EE3A3325477CE2000B7D0453EFBB203329D0F9DF34D5927D022BC9\"}" diff --git a/iguana/coins/gendoge b/iguana/coins/gendoge index 0efe4d73e..6e08e18f8 100755 --- a/iguana/coins/gendoge +++ b/iguana/coins/gendoge @@ -1,2 +1,2 @@ -curl --url "http://127.0.0.1:7778" --data "{\"auxpow\":1,\"RELAY\":1,\"VALIDATE\":1,\"prefetchlag\":-1,\"poll\":10,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"maxpeers\":256,\"newcoin\":\"DOGE\",\"name\":\"Dogecoin\",\"netmagic\":\"C0C0C0C0\",\"p2p\":22556,\"rpc\":22555,\"pubval\":30,\"p2shval\":5,\"wifval\":128,\"txfee_satoshis\":\"100000000\",\"minconfirms\":2,\"genesishash\":\"1a91e3dace36e2be3bf030a65679fe821aa1d6ef92e7c9902eb318182c355691\",\"genesis\":{\"hashalgo\": \"scrypt\",\"version\":1,\"timestamp\":1386325540,\"nBits\":\"1e0ffff0\",\"nonce\":99943,\"merkle_root\":\"5b2a3f53f605d62c53e62932dac6925e3d74afa5a4b459745c36d42d0ed26a69\"},\"alertpubkey\":\"04d4da7a5dae4db797d9b0644d57a5cd50e05a70f36091cd62e2fc41c98ded06340be5a43a35e185690cd9cde5d72da8f6d065b499b06f51dcfba14aad859f443a\"}" +curl --url "http://127.0.0.1:7778" --data "{\"services\":129,\"auxpow\":1,\"RELAY\":1,\"VALIDATE\":1,\"prefetchlag\":-1,\"poll\":10,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"maxpeers\":256,\"newcoin\":\"DOGE\",\"name\":\"Dogecoin\",\"netmagic\":\"C0C0C0C0\",\"p2p\":22556,\"rpc\":22555,\"pubval\":30,\"p2shval\":5,\"wifval\":128,\"txfee_satoshis\":\"100000000\",\"minconfirms\":2,\"genesishash\":\"1a91e3dace36e2be3bf030a65679fe821aa1d6ef92e7c9902eb318182c355691\",\"genesis\":{\"hashalgo\": \"scrypt\",\"version\":1,\"timestamp\":1386325540,\"nBits\":\"1e0ffff0\",\"nonce\":99943,\"merkle_root\":\"5b2a3f53f605d62c53e62932dac6925e3d74afa5a4b459745c36d42d0ed26a69\"},\"alertpubkey\":\"04d4da7a5dae4db797d9b0644d57a5cd50e05a70f36091cd62e2fc41c98ded06340be5a43a35e185690cd9cde5d72da8f6d065b499b06f51dcfba14aad859f443a\"}" diff --git a/iguana/iguana777.c b/iguana/iguana777.c index 7029e4815..8bc2a37e3 100755 --- a/iguana/iguana777.c +++ b/iguana/iguana777.c @@ -752,7 +752,7 @@ void iguana_coinloop(void *arg) }*/ if ( coin->bindsock >= 0 ) { - if ( coin->MAXPEERS > 1 && coin->peers->numranked < IGUANA_MAXPEERS/2 && now > coin->lastpossible+10 ) + if ( coin->MAXPEERS > 1 && coin->peers->numranked < IGUANA_MAXPEERS/2 && now > coin->lastpossible+2 ) { //fprintf(stderr,"check possible\n"); if ( coin->peers->numranked > 0 && (now % 60) == 0 ) diff --git a/iguana/iguana_init.c b/iguana/iguana_init.c index 8220fcac3..0f56733a1 100755 --- a/iguana/iguana_init.c +++ b/iguana/iguana_init.c @@ -274,6 +274,8 @@ void iguana_parseline(struct supernet_info *myinfo,struct iguana_info *coin,int3 } } #endif + OS_randombytes((void *)&m,sizeof(m)); + srand(m); m = flag = 0; allhash = zero; memset(line,0,sizeof(line)); @@ -284,7 +286,7 @@ void iguana_parseline(struct supernet_info *myinfo,struct iguana_info *coin,int3 //printf("parse line.(%s) maxpeers.%d\n",line,coin->MAXPEERS); if ( iter == 0 ) { - if ( m < coin->MAXPEERS/2 )//&& m < 77.7 ) + if ( m < 3*coin->MAXPEERS/4 && (rand() % 2) == 0 )//&& m < 77.7 ) { if ( 0 && m == 0 ) { diff --git a/iguana/iguana_peers.c b/iguana/iguana_peers.c index 38921baa5..4798b8b9b 100755 --- a/iguana/iguana_peers.c +++ b/iguana/iguana_peers.c @@ -709,7 +709,7 @@ void iguana_startconnection(void *arg) iguana_iAkill(coin,addr,1); return; } - //printf("iguana_startconnection.%s:%04x (%s)\n",addr->ipaddr,coin->chain->portp2p,addr->coinstr); + printf("%s iguana_startconnection.%s:%04x\n",coin->symbol,addr->ipaddr,coin->chain->portp2p); if ( strcmp("127.0.0.1",addr->ipaddr) == 0 )//&& (coin->myservices & NODE_NETWORK) != 0 ) { iguana_iAkill(coin,addr,0); @@ -725,7 +725,7 @@ void iguana_startconnection(void *arg) if ( addr->usock < 0 || (coin->peers != 0 && coin->peers->shuttingdown != 0) ) { strcpy(ipaddr,addr->ipaddr); - //printf("%s refused PEER KILLED. slot.%d for %s:%d usock.%d\n",coin->symbol,addr->addrind,ipaddr,coin->chain->portp2p,addr->usock); + printf("%s refused PEER KILLED. slot.%d for %s:%d usock.%d\n",coin->symbol,addr->addrind,ipaddr,coin->chain->portp2p,addr->usock); iguana_iAkill(coin,addr,1); } else @@ -792,7 +792,7 @@ struct iguana_peer *iguana_peerslot(struct iguana_info *coin,uint64_t ipbits,int addr->addrind = i; if ( addr->usock >= 0 || addr->pending != 0 || addr->ipbits == ipbits || strcmp(ipaddr,addr->ipaddr) == 0 ) { - //printf("i.%d skip.(%s) usock.%d pending.%d ipbits.%llx lag.%ld\n",i,addr->ipaddr,addr->usock,addr->pending,(long long)addr->ipbits,time(NULL)-addr->pending); + printf("%s i.%d skip.(%s) usock.%d pending.%d ipbits.%llx lag.%ld\n",coin->symbol,i,addr->ipaddr,addr->usock,addr->pending,(long long)addr->ipbits,time(NULL)-addr->pending); continue; } portable_mutex_lock(&coin->peers_mutex); @@ -890,7 +890,7 @@ uint32_t iguana_possible_peer(struct iguana_info *coin,char *ipaddr) } #endif ipbits = (uint32_t)calc_ipbits(ipaddr); - //printf("check possible peer.(%s)\n",ipaddr); + printf("%s check possible peer.(%s)\n",coin->symbol,ipaddr); if ( iguana_peerslot(coin,(uint32_t)ipbits,0) != 0 ) return((uint32_t)time(NULL)); for (i=n=0; iMAXPEERS); + printf("%s valid ipaddr.(%s) MAXPEERS.%d\n",coin->symbol,ipaddr,coin->MAXPEERS); if ( (iA= iguana_iAddrhashfind(coin,ipbits,1)) != 0 ) { if ( iA->status != IGUANA_PEER_CONNECTING && iA->status != IGUANA_PEER_READY && iA->status != IGUANA_PEER_ELIGIBLE ) @@ -931,9 +931,9 @@ uint32_t iguana_possible_peer(struct iguana_info *coin,char *ipaddr) printf("error updating status for (%s) ind.%d\n",ipaddr,iA->hh.itemind); iguana_iAddriterator(coin,iA); } else printf("ignore.(%s) lastconnect.%u lastkilled.%u numconnects.%d\n",ipaddr,iA->lastconnect,iA->lastkilled,iA->numconnects); - } //else printf("skip.(%s) ind.%d status.%d\n",ipaddr,iA->hh.itemind,iA->status); + } else printf("skip.(%s) ind.%d status.%d\n",ipaddr,iA->hh.itemind,iA->status); } else printf("cant find (%s) which should have been created\n",ipaddr); - } else printf("reject ipaddr.(%s) vs checkaddr.(%s)\n",ipaddr,checkaddr); + } else printf("%s reject ipaddr.(%s) vs checkaddr.(%s)\n",coin->symbol,ipaddr,checkaddr); } } free_queueitem(ipaddr); diff --git a/iguana/iguana_unspents.c b/iguana/iguana_unspents.c index e96c7fb13..2f15b72a7 100755 --- a/iguana/iguana_unspents.c +++ b/iguana/iguana_unspents.c @@ -1358,7 +1358,7 @@ continue; for (k=0; k<20; k++) printf("%02x",UA.rmd160[k]); bitcoin_address(coinaddr,coin->chain->pubtype,UA.rmd160,sizeof(UA.rmd160)); - printf(" [%4d] p%-5d %12.8f ind.%04x %d %s\n",UA.hdrsi,UA.pkind,dstr(UA.histbalance),ind,j,coinaddr); + //printf(" [%4d] p%-5d %12.8f ind.%04x %d %s\n",UA.hdrsi,UA.pkind,dstr(UA.histbalance),ind,j,coinaddr); } } } diff --git a/includes/iguana_defines.h b/includes/iguana_defines.h index fafd5b8b6..a76eba1c7 100755 --- a/includes/iguana_defines.h +++ b/includes/iguana_defines.h @@ -78,7 +78,7 @@ struct iguana_txdatabits { uint64_t addrind:IGUANA_LOG2MAXPEERS,filecount:10,fpo #define IGUANA_DEDICATED_THREADS #ifdef IGUANA_DEDICATED_THREADS -#define IGUANA_MAXCONNTHREADS 8 +#define IGUANA_MAXCONNTHREADS 128 #define IGUANA_MAXSENDTHREADS (IGUANA_MAXPEERS>>2) #define IGUANA_MAXRECVTHREADS (IGUANA_MAXPEERS>>2) #else