Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
d2d5427d0d
  1. 22
      README.md
  2. 4
      iguana/SuperNET.c
  3. 2
      iguana/genbtc
  4. 4
      iguana/iguana777.h
  5. 15
      iguana/iguana_init.c
  6. 5
      iguana/iguana_json.c
  7. 4
      iguana/iguana_peers.c
  8. 2
      iguana/iguana_ramchain.c
  9. 2
      iguana/main.c

22
README.md

@ -106,3 +106,25 @@ iguana can be invoked with a command line argument. if it is a name of a file, i
"exchanges" -> { "name":"<name of exchange>", ... }
"apikey", "apisecret", "userid", "tradepassword" these are as expected
"pollgap" -> gap between each access to exchange for getting prices
**********
user feedback:
A Note on Installation from pebwindkraft at bitco.in
=======================
Though I had xcode installed, aclocal didn’t work. I installed homebrew, and then:
# brew install autoconf
# brew install automake
# brew install gmp
2.) libsecp256
it complained, that libsecp256 was not there in includes, so I linked it.
Loretta:/Users/volker/SuperNET/includes # ln -s ../osx/libsecp256k1 .
3.) I had to change ulimit
During the syncing, I have many, many messages like this:
>>
>> cant create.(tmp/BTC/252000/.tmpmarker) errno.24 Too many open files
>> cant create.(tmp/BTC/18000/.tmpmarker) errno.24 Too many open files
>>
Loretta:/Users/volker/SuperNET # ulimit -n 2048

4
iguana/SuperNET.c

@ -678,7 +678,7 @@ char *SuperNET_JSON(struct supernet_info *myinfo,cJSON *json,char *remoteaddr,ui
//printf("SuperNET_JSON.(%s) remote.(%s)\n",jprint(json,0),remoteaddr!=0?remoteaddr:"");
destflag = SuperNET_destination(myinfo,&destipbits,&category,&subhash,&maxdelay,json,remoteaddr);
//printf("destflag.%d\n",destflag);
if ( method != 0 && (hexmsg= jstr(json,"hexmsg")) == 0 && strcmp(method,"bitcoinrpc") != 0 && (message= jstr(json,"message")) == 0 )
if ( method != 0 && (hexmsg= jstr(json,"hexmsg")) == 0 && strcmp(agent,"bitcoinrpc") != 0 && (message= jstr(json,"message")) == 0 )
{
jsonstr = jprint(json,0);
hexlen = (int32_t)strlen(jsonstr);
@ -702,7 +702,7 @@ char *SuperNET_JSON(struct supernet_info *myinfo,cJSON *json,char *remoteaddr,ui
}
if ( (destflag & SUPERNET_ISMINE) != 0 && agent != 0 && method != 0 )
{
if ( newflag == 0 && hexmsg != 0 && SuperNET_hexmsgfind(myinfo,category,subhash,hexmsg,0) < 0 )
if ( strcmp(agent,"bitcoinrpc") != 0 && newflag == 0 && hexmsg != 0 && SuperNET_hexmsgfind(myinfo,category,subhash,hexmsg,0) < 0 )
SuperNET_hexmsgadd(myinfo,category,subhash,hexmsg,tai_now(),remoteaddr);
if ( (retstr= SuperNET_processJSON(myinfo,json,remoteaddr,port)) != 0 )
{

2
iguana/genbtc

@ -1 +1 @@
curl --url "http://127.0.0.1:7778" --data "{\"prefetchlag\":15,\"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\":1,\"services\":0,\"maxpeers\":64}"

4
iguana/iguana777.h

@ -46,7 +46,7 @@ typedef int32_t (*blockhashfunc)(uint8_t *blockhashp,uint8_t *serialized,int32_t
#define IGUANA_PENDINGREQUESTS 64
#define IGUANA_MINPENDBUNDLES 4
#define IGUANA_MAXPENDBUNDLES 64
#define IGUANA_RPCPORT 7778
#define IGUANA_RPCPORT 7779
#define IGUANA_MAXRAMCHAINSIZE ((uint64_t)1024L * 1024L * 1024L * 16)
#define IGUANA_MAPHASHTABLES 1
@ -495,7 +495,7 @@ struct iguana_info
uint32_t recvtime,hdrstime,backstoptime,lastbundletime,numreqsent,numbundlesQ,lastbundleitime,lastdisp,RTgenesis,RTstarti,idletime,stucktime,stuckmonitor,maxstuck,lastreqtime,RThdrstime;
double bandwidth,maxbandwidth,backstopmillis; bits256 backstophash2; int64_t spaceused;
int32_t initialheight,mapflags,minconfirms,numrecv,bindsock,isRT,backstop,blocksrecv,merging,polltimeout,numreqtxids,allhashes; bits256 reqtxids[64];
void *launched,*started;
void *launched,*started,*rpcloop;
uint64_t bloomsearches,bloomhits,bloomfalse,collisions;
uint8_t blockspace[IGUANA_MAXPACKETSIZE + 8192]; struct OS_memspace blockMEM;
struct iguana_blocks blocks; bits256 APIblockhash,APItxid; char *APIblockstr;

15
iguana/iguana_init.c

@ -451,7 +451,7 @@ void iguana_coinpurge(struct iguana_info *coin)
struct iguana_info *iguana_coinstart(struct iguana_info *coin,int32_t initialheight,int32_t mapflags)
{
FILE *fp; char fname[512],*symbol; int32_t iter; long fpos; bits256 lastbundle;
FILE *fp; char fname[512],*symbol; int32_t iter; long fpos; bits256 lastbundle; struct supernet_info *myinfo = SuperNET_MYINFO(0);
coin->sleeptime = 10000;
symbol = coin->symbol;
if ( iguana_peerslotinit(coin,&coin->internaladdr,IGUANA_MAXPEERS,calc_ipbits("127.0.0.1:7777")) < 0 )
@ -466,7 +466,7 @@ struct iguana_info *iguana_coinstart(struct iguana_info *coin,int32_t initialhei
coin->longestchain = 1;
memset(&coin->blocks.hwmchain,0,sizeof(coin->blocks.hwmchain));
coin->blocks.hwmchain.height = 0;
printf("MYSERVICES.%llx\n",(long long)coin->myservices);
printf("%s MYSERVICES.%llx\n",coin->symbol,(long long)coin->myservices);
if ( (coin->myservices & NODE_NETWORK) != 0 && coin->peers.acceptloop == 0 && coin->peers.localaddr == 0 )
{
coin->peers.acceptloop = malloc(sizeof(pthread_t));
@ -477,6 +477,17 @@ struct iguana_info *iguana_coinstart(struct iguana_info *coin,int32_t initialhei
printf("error launching accept thread for port.%u\n",coin->chain->portp2p);
}
}
if ( coin->rpcloop == 0 )
{
myinfo->rpcport = coin->chain->rpcport;
coin->rpcloop = malloc(sizeof(pthread_t));
if ( OS_thread_create(coin->rpcloop,NULL,(void *)iguana_rpcloop,(void *)myinfo) != 0 )
{
free(coin->rpcloop);
coin->rpcloop = 0;
printf("error launching rpcloop for %s port.%u\n",coin->symbol,coin->chain->rpcport);
}
}
//coin->firstblock = coin->blocks.parsedblocks + 1;
iguana_genesis(coin,coin->chain);
memset(&lastbundle,0,sizeof(lastbundle));

5
iguana/iguana_json.c

@ -979,8 +979,9 @@ char *SuperNET_parser(struct supernet_info *myinfo,char *agentstr,char *method,c
//#undef IGUANA_ARGS
#include "../includes/iguana_apiundefs.h"
return(clonestr("{\"error\":\"illegal bitcoinrpc method or missing coin\"}"));
char errstr[512];
sprintf(errstr,"{\"error\":\"unsupported call\",\"agent\":\"%s\",\"method\":\"%s\"}",agentstr,method);
return(clonestr(errstr));
}

4
iguana/iguana_peers.c

@ -33,7 +33,7 @@ struct iguana_iAddr *_iguana_hashset(struct iguana_info *coin,uint32_t ipbits,in
ptr = iguana_memalloc(mem,allocsize,1);
else ptr = mycalloc('t',1,allocsize);
if ( ptr == 0 )
printf("fatal alloc error in hashset\n"), exit(-1);
printf("fatal alloc errorA in hashset\n"), exit(-1);
//printf("ptr.%p allocsize.%d key.%p keylen.%d itemind.%d\n",ptr,allocsize,key,keylen,itemind);
ptr->hh.itemind = itemind;
ptr->ipbits = ipbits;
@ -128,7 +128,7 @@ uint32_t iguana_rwiAddrind(struct iguana_info *coin,int32_t rwflag,struct iguana
{
ptr = mycalloc('t',1,sizeof(*ptr));
if ( ptr == 0 )
printf("fatal alloc error in hashset\n"), exit(-1);
printf("fatal alloc errorB in hashset\n"), exit(-1);
ptr->hh.itemind = m;
ptr->ipbits = tmp.ipbits;
HASH_ADD(hh,coin->iAddrs,ipbits,sizeof(ipbits),ptr);

2
iguana/iguana_ramchain.c

@ -52,7 +52,7 @@ struct iguana_kvitem *iguana_hashsetPT(struct iguana_ramchain *ramchain,int32_t
printf("alloc.%d\n",allocsize);
}
if ( ptr == 0 )
printf("fatal alloc error in hashset\n"), exit(-1);
printf("fatal alloc errorC in hashset\n"), exit(-1);
if ( 0 && ramchain->expanded && selector == 'T' )
printf("hashmem.%p selector.%c added.(%s) itemind.%x ptr.%p\n",ramchain->hashmem,selector,str,itemind,ptr);
if ( selector == 'T' )

2
iguana/main.c

@ -210,7 +210,7 @@ char *SuperNET_jsonstr(struct supernet_info *myinfo,char *jsonstr,char *remotead
if ( (json= cJSON_Parse(jsonstr)) != 0 )
{
method = jstr(json,"method");
if ( (agent= jstr(json,"agent")) != 0 && method != 0 )
if ( (agent= jstr(json,"agent")) != 0 && method != 0 && jobj(json,"params") == 0 )
retstr = SuperNET_parser(myinfo,agent,method,json,remoteaddr);
else if ( method != 0 && is_bitcoinrpc(myinfo,method,remoteaddr) >= 0 )
retstr = iguana_bitcoinRPC(myinfo,method,json,remoteaddr,port);

Loading…
Cancel
Save