Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
af33f9ba5f
  1. 2
      iguana/coins/genbtc
  2. 10
      iguana/iguana777.c
  3. 1
      iguana/iguana777.h
  4. 4
      iguana/iguana_accept.c
  5. 12
      iguana/iguana_chains.c
  6. 4
      iguana/iguana_msg.c
  7. 11
      iguana/main.c

2
iguana/coins/genbtc

@ -1 +1 @@
curl --url "http://127.0.0.1:7778" --data "{\"prefetchlag\":5,\"poll\":1,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"newcoin\":\"BTC\",\"startpend\":8,\"endpend\":1,\"services\":0,\"maxpeers\":64}"
curl --url "http://127.0.0.1:7778" --data "{\"prefetchlag\":5,\"poll\":1,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"newcoin\":\"BTC\",\"startpend\":8,\"endpend\":8,\"services\":129,\"maxpeers\":512,\"RELAY\":1,\"VALIDATE\":1}"

10
iguana/iguana777.c

@ -700,8 +700,10 @@ void iguana_coinloop(void *arg)
if ( coin->started == 0 && coin->active != 0 )
{
iguana_rwiAddrind(coin,0,0,0);
//for (i=0; i<sizeof(*coin->chain); i++)
// printf("%02x",((uint8_t *)coin->chain)[i]);
printf(" netmagic.%08x init.(%s) maxpeers.%d maxrecvcache.%s services.%llx MAXMEM.%s polltimeout.%d cache.%d pend.(%d -> %d)\n",*(uint32_t *)coin->chain->netmagic,coin->symbol,coin->MAXPEERS,mbstr(str,coin->MAXRECVCACHE),(long long)coin->myservices,mbstr(str,coin->MAXMEM),coin->polltimeout,coin->enableCACHE,coin->startPEND,coin->endPEND);
iguana_coinstart(coin,coin->initialheight,coin->mapflags);
printf("init.(%s) maxpeers.%d maxrecvcache.%s services.%llx MAXMEM.%s polltimeout.%d cache.%d pend.(%d -> %d)\n",coin->symbol,coin->MAXPEERS,mbstr(str,coin->MAXRECVCACHE),(long long)coin->myservices,mbstr(str,coin->MAXMEM),coin->polltimeout,coin->enableCACHE,coin->startPEND,coin->endPEND);
coin->chain->minconfirms = coin->minconfirms;
coin->started = coin;
coin->startutc = (uint32_t)time(NULL);
@ -786,7 +788,8 @@ struct iguana_info *iguana_setcoin(char *symbol,void *launched,int32_t maxpeers,
struct iguana_chain *iguana_createchain(cJSON *json);
struct iguana_info *coin; int32_t j,m,mult,maxval,mapflags; char dirname[512]; cJSON *peers;
mapflags = IGUANA_MAPRECVDATA | maphash*IGUANA_MAPTXIDITEMS | maphash*IGUANA_MAPPKITEMS | maphash*IGUANA_MAPBLOCKITEMS | maphash*IGUANA_MAPPEERITEMS;
coin = iguana_coinadd(symbol,json);
if ( (coin= iguana_coinfind(symbol)) == 0 )
coin = iguana_coinadd(symbol,json);
if ( (coin->MAXPEERS= maxpeers) <= 0 )
coin->MAXPEERS = (strcmp(symbol,"BTC") == 0) ? 128 : 64;
if ( (coin->MAXRECVCACHE= maxrecvcache) == 0 )
@ -920,9 +923,10 @@ int32_t iguana_launchcoin(struct supernet_info *myinfo,char *symbol,cJSON *json)
{
coins[0] = (void *)((long)1);
coins[1] = coin;
printf("launch coinloop for.%s services.%llx\n",coin->symbol,(long long)services);
printf("launch coinloop for.%s services.%llx started.%p\n",coin->symbol,(long long)services,coin->started);
coin->launched = iguana_launch(coin,"iguana_coinloop",iguana_coinloop,coins,IGUANA_PERMTHREAD);
coin->active = 1;
coin->started = 0;
return(1);
}
else

1
iguana/iguana777.h

@ -1035,6 +1035,7 @@ char *bitcoin_blockhashstr(char *coinstr,char *serverport,char *userpass,int32_t
bits256 basilisk_blockhash(struct iguana_info *coin,bits256 prevhash2);
void calc_scrypthash(uint32_t *hash,void *data);
int32_t iguana_rwvarstr(int32_t rwflag,uint8_t *serialized,int32_t maxlen,char *endianedp);
bits256 bitcoin_sharedsecret(void *ctx,bits256 privkey,uint8_t *pubkey,int32_t plen);
extern int32_t HDRnet,netBLOCKS;

4
iguana/iguana_accept.c

@ -379,8 +379,8 @@ int32_t iguana_peeraddrrequest(struct iguana_info *coin,struct iguana_peer *addr
}
}
iguana_rwvarint(1,space,&x);
for (i=0; i<sendlen; i++)
printf("%02x",space[i]);
//for (i=0; i<sendlen; i++)
// printf("%02x",space[i]);
printf(" %p addrrequest: sendlen.%d x.%d\n",space,sendlen,(int32_t)x);
if ( x == 0 )
return(-1);

12
iguana/iguana_chains.c

@ -71,7 +71,7 @@ static struct iguana_chain Chains[] =
1920,1921,1,0x1e // port and rpcport vpncoin.conf
},
//[CHAIN_LTC] =
/* //[CHAIN_LTC] =
{
"Litecoin", "LTC", "Litecoin Signed Message:\n",
0, 5, 176, // PUBKEY_ADDRESS + SCRIPT_ADDRESS addrman.h, use wif2priv API on any valid wif
@ -80,7 +80,7 @@ static struct iguana_chain Chains[] =
"12a765e31ffd4059bada1e25190f6e98c99d9714d334efa41a195a7e7e04bfe2",
"010000000000000000000000000000000000000000000000000000000000000000000000d9ced4ed1130f7b7faad9be25323ffafa33232a17c3edf6cfd97bee6bafbdd97b9aa8e4ef0ff0f1ecd513f7c0101000000010000000000000000000000000000000000000000000000000000000000000000ffffffff4804ffff001d0104404e592054696d65732030352f4f63742f32303131205374657665204a6f62732c204170706c65e280997320566973696f6e6172792c2044696573206174203536ffffffff0100f2052a010000004341040184710fa689ad5023690c80f3a49c8f13f8d45b8c857fbcbc8bc4a8e4d3eb4b10f4d4604fa08dce601aaf0f470216fe1b51850b4acf21b179c45070ac7b03a9ac00000000",
9333,9334,0,0x1e // port and rpcport litecoin.conf
},
},*/
};
/*
@ -338,7 +338,10 @@ void iguana_chainparms(struct iguana_chain *chain,cJSON *argjson)
if ( (hexstr= jstr(argjson,"wifval")) != 0 && strlen(hexstr) == 2 )
decode_hex((uint8_t *)&chain->wiftype,1,hexstr);
if ( (hexstr= jstr(argjson,"netmagic")) != 0 && strlen(hexstr) == 8 )
decode_hex((uint8_t *)chain->netmagic,1,hexstr);
{
decode_hex((uint8_t *)chain->netmagic,4,hexstr);
printf("NETMAGIC.(%s) -> %08x\n",hexstr,*(uint32_t *)chain->netmagic);
}
if ( (hexstr= jstr(argjson,"unitval")) != 0 && strlen(hexstr) == 2 )
decode_hex((uint8_t *)&chain->unitval,1,hexstr);
if ( (hexstr= jstr(argjson,"alertpubkey")) != 0 && (strlen(hexstr)>>1) <= sizeof(chain->alertpubkey) )
@ -362,6 +365,9 @@ void iguana_chainparms(struct iguana_chain *chain,cJSON *argjson)
}
else nBits = 0x1e00ffff;
hash = iguana_chaingenesis(chain->symbol,chain->hashalgo,hash,genesisblock,jstr(genesis,"hashalgo"),juint(genesis,"version"),juint(genesis,"timestamp"),nBits,juint(genesis,"nonce"),jbits256(genesis,"merkle_root"));
memcpy(chain->genesis_hashdata,hash.bytes,32);
char str[65]; init_hexbytes_noT(str,chain->genesis_hashdata,32);
chain->genesis_hash = clonestr(str);
//chain->genesis_hash = clonestr(bits256_str(str,hash));
chain->genesis_hex = clonestr(genesisblock);
}

4
iguana/iguana_msg.c

@ -293,7 +293,7 @@ void iguana_gotaddr(struct iguana_info *coin,struct iguana_peer *addr,struct igu
printf("}, 14631},\n");
}
iguana_possible_peer(coin,ipport);
printf("gotaddr.(%s:%d) from (%s)\n",ipaddr,port,addr->ipaddr);
//printf("gotaddr.(%s:%d) from (%s)\n",ipaddr,port,addr->ipaddr);
}
void iguana_gotping(struct iguana_info *coin,struct iguana_peer *addr,uint64_t nonce,uint8_t *data)
@ -784,7 +784,7 @@ int32_t iguana_msgparser(struct iguana_info *coin,struct iguana_peer *addr,struc
else if ( (ishost= (strcmp(H->command,"getaddr") == 0)) || strcmp(H->command,"addr") == 0 )
{
struct iguana_msgaddress A;
printf("iguana_msgparser from (%s) parse.(%s) len.%d\n",addr->ipaddr,H->command,recvlen);
//printf("iguana_msgparser from (%s) parse.(%s) len.%d\n",addr->ipaddr,H->command,recvlen);
if ( addr != 0 )
{
if ( ishost == 0 )

11
iguana/main.c

@ -1165,6 +1165,17 @@ void iguana_appletests(struct supernet_info *myinfo)
}
if ( 1 )
{
/*int32_t i; ;bits256 hash2; uint8_t pubkey[33];
double startmillis = OS_milliseconds();
for (i=0; i<1000; i++)
hash2 = curve25519_shared(hash2,rand256(0));
printf("curve25519 elapsed %.3f for %d iterations\n",OS_milliseconds() - startmillis,i);
startmillis = OS_milliseconds();
bitcoin_pubkey33(myinfo->ctx,pubkey,hash2);
for (i=0; i<1000; i++)
bitcoin_sharedsecret(myinfo->ctx,hash2,pubkey,33);
printf("secp256k1 elapsed %.3f for %d iterations\n",OS_milliseconds() - startmillis,i);
getchar();**/
if ( 0 && (str= SuperNET_JSON(myinfo,cJSON_Parse("{\"protover\":70002,\"immediate\":\"yes\",\"userhome\":\"/Users/jimbolaptop/Library/Application Support\",\"RELAY\":1,\"VALIDATE\":1,\"portp2p\":9333,\"prefetchlag\":-1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":4,\"endpend\":4,\"services\":129,\"maxpeers\":128,\"newcoin\":\"LTC\",\"active\":1,\"numhelpers\":4,\"poll\":100}"),0,myinfo->rpcport)) != 0 )
{
free(str);

Loading…
Cancel
Save