Browse Source

Change *DPOWS[]

patch-3
jl777 7 years ago
parent
commit
5d95c1636d
  1. 6
      basilisk/basilisk.c
  2. 2
      iguana/dpow/dpow_fsm.c
  3. 4
      iguana/dpow/dpow_network.c
  4. 2
      iguana/iguana777.h
  5. 26
      iguana/iguana_notary.c

6
basilisk/basilisk.c

@ -947,17 +947,17 @@ void basilisks_loop(void *arg)
//fprintf(stderr,"E ");
if ( myinfo->numdpows == 1 )
{
iguana_dPoWupdate(myinfo,&myinfo->DPOWS[0]);
iguana_dPoWupdate(myinfo,myinfo->DPOWS[0]);
endmilli = startmilli + 100;
}
else if ( myinfo->numdpows > 1 )
{
dp = &myinfo->DPOWS[counter % myinfo->numdpows];
dp = myinfo->DPOWS[counter % myinfo->numdpows];
iguana_dPoWupdate(myinfo,dp);
//if ( (counter % myinfo->numdpows) != 0 )
{
//fprintf(stderr,"F ");
iguana_dPoWupdate(myinfo,&myinfo->DPOWS[0]);
iguana_dPoWupdate(myinfo,myinfo->DPOWS[0]);
}
endmilli = startmilli + 30;
}

2
iguana/dpow/dpow_fsm.c

@ -519,7 +519,7 @@ void dpow_statemachinestart(void *ptr)
{
if ( bp->isratify == 0 )
{
if ( myinfo->DPOWS[0].ratifying != 0 )
if ( myinfo->DPOWS[0]->ratifying != 0 )
{
printf("break due to already ratifying\n");
break;

4
iguana/dpow/dpow_network.c

@ -2066,9 +2066,9 @@ int32_t dpow_nanomsg_update(struct supernet_info *myinfo)
dp = 0;
for (i=0; i<myinfo->numdpows; i++)
{
if ( strcmp(np->symbol,myinfo->DPOWS[i].symbol) == 0 )
if ( strcmp(np->symbol,myinfo->DPOWS[i]->symbol) == 0 )
{
dp = &myinfo->DPOWS[i];
dp = myinfo->DPOWS[i];
break;
}
}

2
iguana/iguana777.h

@ -167,7 +167,7 @@ struct supernet_info
uint8_t *pingbuf;
struct basilisk_request DEXaccept;
FILE *dexfp;
struct dpow_info *DPOWS; int32_t maxdpows,numdpows,dpowsock,dexsock,pubsock,repsock,subsock,reqsock;
struct dpow_info *DPOWS[8192]; int32_t numdpows,dpowsock,dexsock,pubsock,repsock,subsock,reqsock;
struct delayedPoW_info dPoW;
struct basilisk_spend *spends; int32_t numspends;
char bindaddr[64];

26
iguana/iguana_notary.c

@ -298,12 +298,10 @@ void dpow_addresses()
THREE_STRINGS_AND_DOUBLE(iguana,dpow,symbol,dest,pubkey,freq)
{
char *retstr,srcaddr[64],destaddr[64]; struct iguana_info *src,*destcoin; cJSON *ismine; int32_t i,srcvalid,destvalid; struct dpow_info *dp;
if ( myinfo->numdpows == myinfo->maxdpows )
{
myinfo->maxdpows++;
myinfo->DPOWS = realloc(myinfo->DPOWS,sizeof(*myinfo->DPOWS) * myinfo->maxdpows);
}
dp = &myinfo->DPOWS[myinfo->numdpows];
if ( (dp= myinfo->DPOWS[myinfo->numdpows]) == 0 )
myinfo->DPOWS[myinfo->numdpows] = calloc(1,sizeof(*dp));
if ( (dp= myinfo->DPOWS[myinfo->numdpows]) == 0 )
return(clonestr("{\"error\":\"dPoW cant allocate memory\"}"));
memset(dp,0,sizeof(*dp));
destvalid = srcvalid = 0;
if ( myinfo->NOTARY.RELAYID < 0 )
@ -339,7 +337,7 @@ THREE_STRINGS_AND_DOUBLE(iguana,dpow,symbol,dest,pubkey,freq)
if ( myinfo->numdpows > 1 )
{
for (i=1; i<myinfo->numdpows; i++)
if ( strcmp(symbol,myinfo->DPOWS[i].symbol) == 0 )
if ( strcmp(symbol,myinfo->DPOWS[i]->symbol) == 0 )
{
dp->symbol[0] = 0;
return(clonestr("{\"error\":\"cant dPoW same coin again\"}"));
@ -490,7 +488,7 @@ STRING_ARG(dpow,pending,fiat)
base[i] = 0;
for (i=0; i<myinfo->numdpows; i++)
{
dp = &myinfo->DPOWS[i];
dp = myinfo->DPOWS[i];
if ( strcmp(dp->symbol,base) == 0 )
return(jprint(dpow_withdraws_pending(dp),1));
}
@ -870,7 +868,7 @@ STRING_ARG(dpow,active,maskhex)
n = komodo_notaries("KMD",pubkeys,current);
if ( maskhex == 0 || maskhex[0] == 0 )
{
mask = myinfo->DPOWS[0].lastrecvmask;
mask = myinfo->DPOWS[0]->lastrecvmask;
for (i=0; i<n; i++)
{
if ( ((1LL << i) & mask) != 0 )
@ -911,7 +909,7 @@ STRING_ARG(dpow,active,maskhex)
ZERO_ARGS(dpow,cancelratify)
{
myinfo->DPOWS[0].cancelratify = 1;
myinfo->DPOWS[0]->cancelratify = 1;
return(clonestr("{\"result\":\"queued dpow cancel ratify\"}"));
}
@ -926,18 +924,18 @@ TWOINTS_AND_ARRAY(dpow,ratify,minsigs,timestamp,ratified)
ptrs[0] = (void *)myinfo;
if ( (source= jstr(json,"source")) == 0 )
source = "KMD";
ptrs[1] = (void *)&myinfo->DPOWS[0];
ptrs[1] = (void *)myinfo->DPOWS[0];
for (i=0; i<myinfo->numdpows; i++)
if ( strcmp(myinfo->DPOWS[0].symbol,source) == 0 )
if ( strcmp(myinfo->DPOWS[0]->symbol,source) == 0 )
{
ptrs[1] = (void *)&myinfo->DPOWS[i];
ptrs[1] = (void *)myinfo->DPOWS[i];
break;
}
ptrs[2] = (void *)(long)minsigs;
ptrs[3] = (void *)DPOW_RATIFYDURATION;
ptrs[4] = (void *)jprint(ratified,0);
memcpy(&ptrs[5],&checkpoint,sizeof(checkpoint));
myinfo->DPOWS[0].cancelratify = 0;
myinfo->DPOWS[0]->cancelratify = 0;
if ( OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)dpow_statemachinestart,(void *)ptrs) != 0 )
{
}

Loading…
Cancel
Save