jl777 7 years ago
parent
commit
50fa89e246
  1. 14
      iguana/dpow/dpow_network.c
  2. 16
      iguana/dpow/dpow_rpc.c
  3. 2
      iguana/elected

14
iguana/dpow/dpow_network.c

@ -14,6 +14,8 @@
******************************************************************************/
extern uint16_t Notaries_port;
extern uint32_t Notaries_numseeds;
extern char *Notaries_seeds[];
struct signed_nnpacket
{
@ -26,14 +28,14 @@ struct signed_nnpacket
void dex_init(struct supernet_info *myinfo)
{
int32_t i,j,mask = 0; char *seeds[] = { "78.47.196.146", "5.9.102.210", "149.56.29.163", "191.235.80.138", "88.198.65.74", "94.102.63.226", "129.232.225.202", "104.255.64.3", "52.72.135.200", "149.56.28.84", "103.18.58.150", "221.121.144.140", "123.249.79.12", "103.18.58.146", "27.50.93.252", "176.9.0.233", "94.102.63.227", "167.114.227.223", "27.50.68.219", "192.99.233.217", "94.102.63.217", "45.64.168.216" };
int32_t i,j,mask = 0;
OS_randombytes((void *)&i,sizeof(i));
srand(i);
for (i=0; i<sizeof(myinfo->dexseed_ipaddrs)/sizeof(*myinfo->dexseed_ipaddrs); i++)
{
while ( 1 )
{
j = (rand() % (sizeof(seeds)/sizeof(*seeds)));
j = (rand() % Notaries_numseeds);
if ( i < 2 )
j = i;
if ( ((1 << j) & mask) == 0 )
@ -43,8 +45,8 @@ void dex_init(struct supernet_info *myinfo)
#ifdef NOTARY_TESTMODE
seeds[j] = NOTARY_TESTMODE;
#endif
printf("seed.[%d] <- %s\n",i,seeds[j]);
strcpy(myinfo->dexseed_ipaddrs[i],seeds[j]);
printf("seed.[%d] <- %s\n",i,Notaries_seeds[j]);
strcpy(myinfo->dexseed_ipaddrs[i],Notaries_seeds[j]);
myinfo->dexipbits[i] = (uint32_t)calc_ipbits(myinfo->dexseed_ipaddrs[i]);
}
myinfo->numdexipbits = i;
@ -2017,11 +2019,11 @@ void dpow_ipbitsadd(struct supernet_info *myinfo,struct dpow_info *dp,uint32_t *
if ( ipbits[i] != 0 )
{
expand_ipbits(ipaddr,ipbits[i]);
//printf("ADD NOTARY.(%s) %08x\n",ipaddr,ipbits[i]);
printf("ADD NOTARY.(%s) %08x\n",ipaddr,ipbits[i]);
dpow_addnotary(myinfo,dp,ipaddr);
}
} else if ( missing > 0 )
printf("IGNORE from.%d RECV numips.%d numipbits.%d matched.%d missing.%d\n",fromid,numipbits,n,matched,missing);
printf("IGNORE from.%d RECV numips.%d numipbits.%d matched.%d missing.%d maxipbits.%d\n",fromid,numipbits,n,matched,missing,maxipbits);
expand_ipbits(ipaddr,senderipbits);
dpow_addnotary(myinfo,dp,ipaddr);
expand_ipbits(ipaddr,myinfo->myaddr.myipbits);

16
iguana/dpow/dpow_rpc.c

@ -51,12 +51,17 @@ cJSON *dpow_getinfo(struct supernet_info *myinfo,struct iguana_info *coin)
}
char *Notaries_elected[64][2];
int32_t Notaries_num,Notaries_BTCminsigs = DPOW_MINSIGS,Notaries_minsigs = DPOW_MIN_ASSETCHAIN_SIGS;
int32_t Notaries_numseeds,Notaries_num,Notaries_BTCminsigs = DPOW_MINSIGS,Notaries_minsigs = DPOW_MIN_ASSETCHAIN_SIGS;
uint16_t Notaries_port = DPOW_SOCKPORT;
char *seeds[] = { "78.47.196.146", "5.9.102.210", "149.56.29.163", "191.235.80.138", "88.198.65.74", "94.102.63.226", "129.232.225.202", "104.255.64.3", "52.72.135.200", "149.56.28.84", "103.18.58.150", "221.121.144.140", "123.249.79.12", "103.18.58.146", "27.50.93.252", "176.9.0.233", "94.102.63.227", "167.114.227.223", "27.50.68.219", "192.99.233.217", "94.102.63.217", "45.64.168.216" };
char *Notaries_seeds[64];
int32_t komodo_initjson(char *fname)
{
char *fstr,*field,*hexstr; cJSON *argjson,*array,*item; long fsize; uint16_t port; int32_t i,n,num,retval = -1;
Notaries_numseeds = (int32_t)(sizeof(seeds)/sizeof(*seeds));
for (i=0; i<Notaries_numseeds; i++)
Notaries_seeds[i] = seeds[i];
if ( (fstr= OS_filestr(&fsize,fname)) != 0 )
{
if ( (argjson= cJSON_Parse(fstr)) != 0 )
@ -67,6 +72,15 @@ int32_t komodo_initjson(char *fname)
Notaries_BTCminsigs = num;
if ( (num= juint(argjson,"minsigs")) > Notaries_minsigs )
Notaries_minsigs = num;
if ( (array= jarray(&n,argjson,"seeds")) != 0 && n <= 64 )
{
for (i=0; i<n; i++)
{
Notaries_seeds[i] = clonestr(jstri(array,i));
printf("%s ",Notaries_seeds[i]);
}
printf("Notaries_numseeds.%d\n",Notaries_numseeds);
}
if ( (array= jarray(&n,argjson,"notaries")) != 0 && n <= 64 )
{
for (i=0; i<n; i++)

2
iguana/elected

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save