jl777 7 years ago
parent
commit
83f492d63b
  1. 2
      iguana/dPoW.h
  2. 16
      iguana/dpow/dpow_network.c
  3. 5
      iguana/dpow/dpow_rpc.c
  4. 2
      iguana/elected

2
iguana/dPoW.h

@ -47,7 +47,7 @@
#define DPOW_MAXSIGLEN 128
#define DEX_VERSION 0x0105
#define DPOW_SOCK 7775
#define DPOW_SOCKPORT 7775
#define DEX_SOCK 7774
#define PUB_SOCK 7773
#define REP_SOCK 7772

16
iguana/dpow/dpow_network.c

@ -1292,7 +1292,7 @@ int32_t dpow_addnotary(struct supernet_info *myinfo,struct dpow_info *dp,char *i
if ( myinfo->IAMNOTARY == 0 )
return(-1);
portable_mutex_lock(&myinfo->notarymutex);
if ( myinfo->dpowsock >= 0 && myinfo->dexsock >= 0 )
if ( myinfo->dpowsock >= 0 )//&& myinfo->dexsock >= 0 )
{
ipbits = (uint32_t)calc_ipbits(ipaddr);
for (iter=0; iter<2; iter++)
@ -1315,9 +1315,9 @@ int32_t dpow_addnotary(struct supernet_info *myinfo,struct dpow_info *dp,char *i
ptr[n] = ipbits;
if ( iter == 0 && strcmp(ipaddr,myinfo->ipaddr) != 0 )
{
retval = nn_connect(myinfo->dpowsock,nanomsg_tcpname(0,str,ipaddr,DPOW_SOCK));
retval = nn_connect(myinfo->dpowsock,nanomsg_tcpname(0,str,ipaddr,Notaries_port));
printf("NN_CONNECT to (%s)\n",str);
retval = nn_connect(myinfo->dexsock,nanomsg_tcpname(0,str,ipaddr,DEX_SOCK));
//retval = nn_connect(myinfo->dexsock,nanomsg_tcpname(0,str,ipaddr,DEX_SOCK));
}
n++;
qsort(ptr,n,sizeof(uint32_t),_increasing_ipbits);
@ -1353,13 +1353,13 @@ void dpow_nanomsginit(struct supernet_info *myinfo,char *ipaddr)
pubsock = myinfo->pubsock;
if ( dpowsock < 0 && (dpowsock= nn_socket(AF_SP,NN_BUS)) >= 0 )
{
if ( nn_bind(dpowsock,nanomsg_tcpname(myinfo,str,myinfo->ipaddr,DPOW_SOCK)) < 0 )
if ( nn_bind(dpowsock,nanomsg_tcpname(myinfo,str,myinfo->ipaddr,Notaries_port)) < 0 )
{
printf("error binding to dpowsock (%s)\n",nanomsg_tcpname(myinfo,str,myinfo->ipaddr,DPOW_SOCK));
printf("error binding to dpowsock (%s)\n",nanomsg_tcpname(myinfo,str,myinfo->ipaddr,Notaries_port));
nn_close(dpowsock);
dpowsock = -1;
}
else
else if ( 0 )
{
printf("NN_BIND to %s\n",str);
if ( dexsock < 0 && (dexsock= nn_socket(AF_SP,NN_BUS)) >= 0 )
@ -2093,7 +2093,7 @@ int32_t dpow_nanomsg_update(struct supernet_info *myinfo)
} else flags |= 1;
if ( freeptr != 0 )
nn_freemsg(freeptr), np = 0, freeptr = 0;
if ( myinfo->dexsock >= 0 ) // from servers
if ( 0 && myinfo->dexsock >= 0 ) // from servers
{
freeptr = 0;
if ( (flags & 2) == 0 && (size= signed_nn_recv(&freeptr,myinfo,myinfo->notaries,myinfo->numnotaries,myinfo->dexsock,&dexp)) > 0 )
@ -2111,7 +2111,7 @@ int32_t dpow_nanomsg_update(struct supernet_info *myinfo)
if ( freeptr != 0 )
nn_freemsg(freeptr), dexp = 0, freeptr = 0;
}
if ( myinfo->repsock >= 0 ) // from clients
if ( 0 && myinfo->repsock >= 0 ) // from clients
{
dexp = 0;
if ( (flags & 4) == 0 && (size= nn_recv(myinfo->repsock,&dexp,NN_MSG,0)) > 0 )

5
iguana/dpow/dpow_rpc.c

@ -52,15 +52,18 @@ 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;
uint16_t Notary_port = DPOW_SOCKPORT;
int32_t komodo_initjson(char *fname)
{
char *fstr,*field,*hexstr; cJSON *argjson,*array,*item; long fsize; int32_t i,n,num,retval = -1;
char *fstr,*field,*hexstr; cJSON *argjson,*array,*item; long fsize; uint16_t port; int32_t i,n,num,retval = -1;
if ( (fstr= OS_filestr(&fsize,fname)) != 0 )
{
printf("%s.(%s)\n",fname,fstr);
if ( (argjson= cJSON_Parse(fstr)) != 0 )
{
if ( (port= juint(argjson,"port")) != 0 )
Notary_port = port;
if ( (num= juint(argjson,"BTCminsigs")) > Notaries_BTCminsigs )
Notaries_BTCminsigs = num;
if ( (num= juint(argjson,"minsigs")) > Notaries_minsigs )

2
iguana/elected

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