jl777 8 years ago
parent
commit
9608da5355
  1. 2
      iguana/dPoW.h
  2. 6
      iguana/dpow/dpow_network.c

2
iguana/dPoW.h

@ -99,7 +99,7 @@ struct dpow_block
uint64_t destsigsmasks[DPOW_MAXRELAYS],srcsigsmasks[DPOW_MAXRELAYS];
uint64_t recvmask,bestmask,ratifybestmask,ratifyrecvmask,pendingbestmask,pendingratifybestmask,ratifysigmasks[2];
struct dpow_entry notaries[DPOW_MAXRELAYS];
uint32_t state,starttime,timestamp,waiting,sigcrcs[2],txidcrcs[2],utxocrcs[2];
uint32_t state,starttime,timestamp,waiting,sigcrcs[2],txidcrcs[2],utxocrcs[2],lastepoch;
int32_t height,numnotaries,completed,minsigs,duration,numratified,isratify,require0,scores[DPOW_MAXRELAYS];
int8_t bestk,ratifybestk,pendingbestk,pendingratifybestk;
cJSON *ratified;

6
iguana/dpow/dpow_network.c

@ -251,8 +251,12 @@ void dpow_ratify_update(struct supernet_info *myinfo,struct dpow_info *dp,struct
if ( besti >= 0 && bestks[besti] >= 0 && masks[besti] != 0 && (bp->ratifyrecvmask & masks[besti]) == masks[besti] )
bp->ratifybestmask = masks[besti], bp->ratifybestk = bestks[besti];
//printf("numdiff.%d besti.%d numbest.%d (%d %llx) vs (%d %llx)\n",numdiff,besti,best,besti>=0?bestks[besti]:-1,(long long)(besti>=0?masks[besti]:0),bestk,(long long)bestmask);
if ( bp->ratifybestmask == 0 )
if ( bp->ratifybestmask == 0 || (time(NULL) / 100) != bp->lastepoch )
{
bp->ratifybestmask = dpow_ratifybest(bp->ratifyrecvmask,bp,&bp->ratifybestk);
bp->lastepoch = (uint32_t)(time(NULL) / 100);
printf("epoch %u\n",bp->lastepoch % bp->numnotaries);
}
bp->notaries[bp->myind].ratifybestk = bp->ratifybestk;
bp->notaries[bp->myind].ratifybestmask = bp->ratifybestmask;
bp->notaries[bp->myind].ratifyrecvmask = bp->ratifyrecvmask;

Loading…
Cancel
Save