Browse Source

Merge pull request #185 from jl777/dev

test
win-cross
jl777 8 years ago
committed by GitHub
parent
commit
3df274e086
  1. 2
      iguana/dPoW.h
  2. 6
      iguana/dpow/dpow_network.c
  3. 2
      iguana/dpow/dpow_tx.c

2
iguana/dPoW.h

@ -51,6 +51,8 @@
#define PUB_SOCK 7773
#define REP_SOCK 7772
#define DPOW_EPOCHDURATION 600
struct dpow_coinentry
{
bits256 prev_hash;

6
iguana/dpow/dpow_network.c

@ -902,12 +902,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 || (time(NULL) / 100) != bp->lastepoch )
if ( bp->ratifybestmask == 0 || (time(NULL) / DPOW_EPOCHDURATION) != bp->lastepoch )
{
bp->ratifybestmask = dpow_ratifybest(bp->ratifyrecvmask,bp,&bp->ratifybestk);
if ( (time(NULL) / 100) != bp->lastepoch )
if ( (time(NULL) / DPOW_EPOCHDURATION) != bp->lastepoch )
{
bp->lastepoch = (uint32_t)(time(NULL) / 100);
bp->lastepoch = (uint32_t)(time(NULL) / DPOW_EPOCHDURATION);
printf("epoch %u\n",bp->lastepoch % bp->numnotaries);
sleep(2 + (rand() % 7));
}

2
iguana/dpow/dpow_tx.c

@ -82,7 +82,7 @@ uint64_t dpow_ratifybest(uint64_t refmask,struct dpow_block *bp,int8_t *lastkp)
*lastkp = -1;
for (m=j=0; j<bp->numnotaries; j++)
{
k = (j + ((uint32_t)time(NULL) / 100)) % bp->numnotaries;//DPOW_MODIND(bp,j);
k = (j + ((uint32_t)time(NULL) / DPOW_EPOCHDURATION)) % bp->numnotaries;//DPOW_MODIND(bp,j);
if ( bp->require0 != 0 && k == 0 )
continue;
if ( bits256_nonz(bp->notaries[k].ratifysrcutxo) != 0 && bits256_nonz(bp->notaries[k].ratifydestutxo) != 0 )

Loading…
Cancel
Save