Browse Source

Iguana stats

etomic
jl777 7 years ago
parent
commit
f8684dfea4
  1. 50
      iguana/dpow/dpow_network.c
  2. 46
      iguana/dpow/dpow_rpc.c
  3. 26
      iguana/main.c

50
iguana/dpow/dpow_network.c

@ -21,56 +21,6 @@ struct signed_nnpacket
uint8_t packet[];
} PACKED;
/*
NN_CONNECT to (tcp://167.114.118.5:7775)
NN_CONNECT to (tcp://10.0.0.4:7775)
NN_CONNECT to (tcp://85.143.211.6:7775)
NN_CONNECT to (tcp://158.69.25.7:7775)
NN_CONNECT to (tcp://123.249.79.12:7775)
NN_CONNECT to (tcp://141.105.66.18:7775)
NN_CONNECT to (tcp://198.27.75.27:7775)
NN_CONNECT to (tcp://198.204.226.34:7775)
NN_CONNECT to (tcp://144.76.94.38:7775)
NN_CONNECT to (tcp://142.54.174.42:7775)
NN_CONNECT to (tcp://88.198.70.43:7775)
NN_CONNECT to (tcp://182.162.169.44:7775)
NN_CONNECT to (tcp://104.168.128.50:7775)
NN_CONNECT to (tcp://167.114.64.64:7775)
NN_CONNECT to (tcp://185.169.229.64:7775)
NN_CONNECT to (tcp://46.4.68.72:7775)
NN_CONNECT to (tcp://173.208.203.74:7775)
NN_CONNECT to (tcp://192.99.232.81:7775)
NN_CONNECT to (tcp://149.56.28.84:7775)
NN_CONNECT to (tcp://148.251.190.89:7775)
NN_CONNECT to (tcp://149.56.240.91:7775)
NN_CONNECT to (tcp://88.99.56.99:7775)
NN_CONNECT to (tcp://217.106.238.109:7775)
NN_CONNECT to (tcp://142.54.164.114:7775)
NN_CONNECT to (tcp://163.172.101.118:7775)
NN_CONNECT to (tcp://189.1.174.119:7775)
NN_CONNECT to (tcp://1.234.19.123:7775)
NN_CONNECT to (tcp://221.121.144.138:7775)
NN_CONNECT to (tcp://46.166.168.138:7775)
NN_CONNECT to (tcp://221.121.144.140:7775)
NN_CONNECT to (tcp://163.172.100.144:7775)
NN_CONNECT to (tcp://185.106.122.147:7775)
NN_CONNECT to (tcp://103.18.58.150:7775)
NN_CONNECT to (tcp://23.88.234.153:7775)
NN_CONNECT to (tcp://164.132.202.176:7775)
NN_CONNECT to (tcp://178.63.85.196:7775)
NN_CONNECT to (tcp://69.12.77.197:7775)
NN_CONNECT to (tcp://192.157.238.198:7775)
NN_CONNECT to (tcp://209.58.183.199:7775)
NN_CONNECT to (tcp://149.202.65.200:7775)
NN_CONNECT to (tcp://173.208.184.202:7775)
NN_CONNECT to (tcp://94.102.63.208:7775)
NN_CONNECT to (tcp://5.9.109.208:7775)
NN_CONNECT to (tcp://94.102.63.209:7775)
NN_CONNECT to (tcp://197.189.248.210:7775)
NN_CONNECT to (tcp://149.56.19.212:7775)
NN_CONNECT to (tcp://46.165.243.214:7775)
NN_CONNECT to (tcp://45.64.168.216:7775)
*/
void dex_init(struct supernet_info *myinfo)
{

46
iguana/dpow/dpow_rpc.c

@ -171,6 +171,52 @@ int32_t komodo_notaries(char *symbol,uint8_t pubkeys[64][33],int32_t height)
return(num);
}
void iguana_notarystats(char *fname,int32_t totals[64],int32_t dispflag)
{
FILE *fp; uint8_t pubkeys[64][33]; uint64_t signedmask; long fpos,startfpos; int32_t i,num,height,iter,prevheight;
num = komodo_notaries("KMD",pubkeys,180000);
if ( (fp= fopen(fname,"rb")) != 0 )
{
startfpos = 0;
prevheight = -1;
for (iter=0; iter<2; iter++)
{
while ( 1 )
{
fpos = ftell(fp);
if (fread(&height,1,sizeof(height),fp) == sizeof(height) && fread(&signedmask,1,sizeof(signedmask),fp) == sizeof(signedmask) )
{
if ( height < prevheight )
{
startfpos = fpos;
if ( iter == 0 )
printf("found reversed height %d vs %d\n",height,prevheight);
else printf("fatal unexpected height reversal %d vs %d\n",height,prevheight);
}
if ( iter == 1 && height >= 180000 )
{
for (i=0; i<num; i++)
if ( ((1LL << i) & signedmask) != 0 )
totals[i]++;
}
prevheight = height;
}
}
if ( iter == 0 )
fseek(fp,startfpos,SEEK_SET);
}
fclose(fp);
if ( dispflag != 0 )
{
for (i=0; i<num; i++)
{
if ( totals[i] != 0 )
printf("%s, %d\n",Notaries_elected[i][0],totals[i]);
}
}
}
}
bits256 dpow_getbestblockhash(struct supernet_info *myinfo,struct iguana_info *coin)
{
char *retstr; bits256 blockhash;

26
iguana/main.c

@ -2198,11 +2198,19 @@ void iguana_main(void *arg)
{
if ( strcmp((char *)arg,"OStests") == 0 )
do_OStests = 1;
else if ( strcmp((char *)arg,"stats") == 0 )
{
void iguana_notarystats(char *fname,int32_t totals[64],int32_t dispflag);
int32_t totals[64];
memset(totals,0,sizeof(totals));
iguana_notarystats("signedmasks",totals,1);
exit(0);
}
else if ( strcmp((char *)arg,"notary") == 0 )
{
myinfo->rpcport = IGUANA_NOTARYPORT;
myinfo->IAMNOTARY = 1;
myinfo->DEXEXPLORER = 1;
myinfo->DEXEXPLORER = 0;//1; disable as SPV is used now
}
else if ( strncmp((char *)arg,"-port=",6) == 0 )
{
@ -2262,22 +2270,6 @@ void iguana_main(void *arg)
{
basilisks_init(myinfo);
}
if ( (0) )
{
char *jsonstr = "[\"03b7621b44118017a16043f19b30cc8a4cfe068ac4e42417bae16ba460c80f3828\", \"02ebfc784a4ba768aad88d44d1045d240d47b26e248cafaf1c5169a42d7a61d344\", \"03750cf30d739cd7632f77c1c02812dd7a7181628b0558058d4755838117e05339\", \"0394f3529d2e8cc69ffa7a2b55f3761e7be978fa1896ef4c55dc9c275e77e5bf5e\", \"0243c1eeb3777af47187d542e5f8c84f0ac4b05cf5a7ad77faa8cb6d2d56db7823\", \"02bb298844175640a34e908ffdfa2839f77aba3d5edadefee16beb107826e00063\", \"02fa88e549b4b871498f892e527a5d57287916809f8cc3163f641d71c535e8df5a\", \"032f799e370f06476793a122fcd623db7804898fe5aef5572095cfee6353df34bf\", \"02c06fe5401faff4442ef87b7d1b56c2e5a214166615f9a2f2030c71b0cb067ae8\", \"038ac67ca49a8169bcc5de83fe020071095a2c3b2bc4d1c17386977329758956d5\"]";
int32_t i,n; char coinaddr[64]; uint8_t pubkey33[33]; double val = 0.1; cJSON *array;
if ( (array= cJSON_Parse(jsonstr)) != 0 )
{
n = cJSON_GetArraySize(array);
for (i=0; i<n; i++)
{
decode_hex(pubkey33,33,jstri(array,i));
bitcoin_address(coinaddr,60,pubkey33,33);
printf("./komodo-cli -ac_name=REVS sendtoaddress %s %f\n",coinaddr,val);
}
} else printf("couldnt parse.(%s)\n",jsonstr);
}
iguana_launchdaemons(myinfo);
}

Loading…
Cancel
Save