diff --git a/iguana/dPoW.h b/iguana/dPoW.h index 78dd90d18..f7e48de22 100755 --- a/iguana/dPoW.h +++ b/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; diff --git a/iguana/dpow/dpow_network.c b/iguana/dpow/dpow_network.c index a10278185..5808ceb72 100755 --- a/iguana/dpow/dpow_network.c +++ b/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;