diff --git a/iguana/dPoW.h b/iguana/dPoW.h index 2f0736c9a..a43ce93b8 100755 --- a/iguana/dPoW.h +++ b/iguana/dPoW.h @@ -99,7 +99,7 @@ struct dpow_block uint64_t recvmask,bestmask; struct dpow_entry notaries[DPOW_MAXRELAYS]; uint32_t state,timestamp,waiting,sigcrcs[2],txidcrcs[2],utxocrcs[2]; - int32_t height,numnotaries,completed,minsigs,duration,numratified,isratify; + int32_t height,numnotaries,completed,minsigs,duration,numratified,isratify,require0; int8_t bestk; cJSON *ratified; uint8_t ratified_pubkeys[DPOW_MAXRELAYS][33]; char handles[DPOW_MAXRELAYS][32]; diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index 2293c35e7..6580ad2fe 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -506,6 +506,7 @@ void dpow_statemachinestart(void *ptr) destprevvout0 = jint(item,"destprevvout0"); srcprevtxid0 = jbits256(item,"srcprevtxid0"); srcprevvout0 = jint(item,"srcprevvout0"); + bp->require0 = 1; } } else diff --git a/iguana/dpow/dpow_tx.c b/iguana/dpow/dpow_tx.c index 905419af2..82c593600 100755 --- a/iguana/dpow/dpow_tx.c +++ b/iguana/dpow/dpow_tx.c @@ -15,9 +15,10 @@ uint64_t dpow_lastk_mask(struct dpow_block *bp,int8_t *lastkp) { - int32_t j,m,k; uint64_t mask = 0; + int32_t j,m,k; uint64_t mask = bp->require0; *lastkp = -1; - for (j=m=0; jnumnotaries; j++) + m = bp->require0; + for (j=0; jnumnotaries; j++) { k = DPOW_MODIND(bp,j);//((bp->height % bp->numnotaries) + j) % bp->numnotaries; if ( bits256_nonz(bp->notaries[k].src.prev_hash) != 0 && bits256_nonz(bp->notaries[k].dest.prev_hash) != 0 ) @@ -47,9 +48,10 @@ int32_t dpow_bestk(struct dpow_block *bp,uint64_t *maskp) uint64_t dpow_maskmin(uint64_t refmask,struct dpow_block *bp,int8_t *lastkp) { - int32_t j,m,k; uint64_t bestmask,mask; - bestmask = mask = 0; - for (j=m=0; jnumnotaries; j++) + int32_t j,m,k; uint64_t bestmask,mask = bp->require0; + bestmask = 0; + m = bp->require0; + for (j=0; jnumnotaries; j++) { k = DPOW_MODIND(bp,j); if ( bits256_nonz(bp->notaries[k].src.prev_hash) != 0 && bits256_nonz(bp->notaries[k].dest.prev_hash) != 0 )