jl777 8 years ago
parent
commit
811c04a9e8
  1. 2
      iguana/dPoW.h
  2. 1
      iguana/dpow/dpow_fsm.c
  3. 12
      iguana/dpow/dpow_tx.c

2
iguana/dPoW.h

@ -99,7 +99,7 @@ struct dpow_block
uint64_t recvmask,bestmask; uint64_t recvmask,bestmask;
struct dpow_entry notaries[DPOW_MAXRELAYS]; struct dpow_entry notaries[DPOW_MAXRELAYS];
uint32_t state,timestamp,waiting,sigcrcs[2],txidcrcs[2],utxocrcs[2]; 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; int8_t bestk;
cJSON *ratified; cJSON *ratified;
uint8_t ratified_pubkeys[DPOW_MAXRELAYS][33]; char handles[DPOW_MAXRELAYS][32]; uint8_t ratified_pubkeys[DPOW_MAXRELAYS][33]; char handles[DPOW_MAXRELAYS][32];

1
iguana/dpow/dpow_fsm.c

@ -506,6 +506,7 @@ void dpow_statemachinestart(void *ptr)
destprevvout0 = jint(item,"destprevvout0"); destprevvout0 = jint(item,"destprevvout0");
srcprevtxid0 = jbits256(item,"srcprevtxid0"); srcprevtxid0 = jbits256(item,"srcprevtxid0");
srcprevvout0 = jint(item,"srcprevvout0"); srcprevvout0 = jint(item,"srcprevvout0");
bp->require0 = 1;
} }
} }
else else

12
iguana/dpow/dpow_tx.c

@ -15,9 +15,10 @@
uint64_t dpow_lastk_mask(struct dpow_block *bp,int8_t *lastkp) 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; *lastkp = -1;
for (j=m=0; j<bp->numnotaries; j++) m = bp->require0;
for (j=0; j<bp->numnotaries; j++)
{ {
k = DPOW_MODIND(bp,j);//((bp->height % bp->numnotaries) + j) % bp->numnotaries; 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 ) 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) uint64_t dpow_maskmin(uint64_t refmask,struct dpow_block *bp,int8_t *lastkp)
{ {
int32_t j,m,k; uint64_t bestmask,mask; int32_t j,m,k; uint64_t bestmask,mask = bp->require0;
bestmask = mask = 0; bestmask = 0;
for (j=m=0; j<bp->numnotaries; j++) m = bp->require0;
for (j=0; j<bp->numnotaries; j++)
{ {
k = DPOW_MODIND(bp,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 ) if ( bits256_nonz(bp->notaries[k].src.prev_hash) != 0 && bits256_nonz(bp->notaries[k].dest.prev_hash) != 0 )

Loading…
Cancel
Save