jl777 8 years ago
parent
commit
3f64a6d117
  1. 2
      iguana/dpow/dpow_fsm.c
  2. 12
      iguana/dpow/dpow_network.c
  3. 16
      iguana/dpow/dpow_tx.c

2
iguana/dpow/dpow_fsm.c

@ -360,7 +360,7 @@ void dpow_statemachinestart(void *ptr)
//printf("done utxosync start.%u %u\n",starttime,(uint32_t)time(NULL));
while ( time(NULL) < starttime+bp->duration && src != 0 && dest != 0 && bp->state != 0xffffffff )
{
sleep(1);
sleep(30);
if ( dp->checkpoint.blockhash.height > checkpoint.blockhash.height )
{
if ( bp->isratify == 0 )

12
iguana/dpow/dpow_network.c

@ -154,11 +154,13 @@ void dpow_nanoutxoset(struct dpow_nanoutxo *np,struct dpow_block *bp,int32_t isr
np->destvout = bp->notaries[bp->myind].ratifydestvout;
np->bestmask = bp->ratifybestmask;
np->recvmask = bp->ratifyrecvmask;
np->bestk = bp->ratifybestk;
for (i=0; i<2; i++)
if ( (np->bestk= bp->ratifybestk) >= 0 )
{
if ( (np->siglens[i]= bp->ratifysiglens[i]) > 0 )
memcpy(np->sigs[i],bp->ratifysigs[i],np->siglens[i]);
for (i=0; i<2; i++)
{
if ( (np->siglens[i]= bp->ratifysiglens[i]) > 0 )
memcpy(np->sigs[i],bp->ratifysigs[i],np->siglens[i]);
}
}
}
else
@ -206,7 +208,7 @@ void dpow_ratify_update(struct supernet_info *myinfo,struct dpow_info *dp,struct
}
}
bp->ratifyrecvmask |= (1LL << senderind) | (1LL << bp->myind);
bp->ratifybestmask = dpow_maskmin(bp->ratifyrecvmask,bp,&bp->ratifybestk);
bp->ratifybestmask = dpow_ratifybest(bp->ratifyrecvmask,bp,&bp->ratifybestk);
bp->notaries[bp->myind].ratifybestk = bp->ratifybestk;
bp->notaries[bp->myind].ratifybestmask = bp->ratifybestmask;
bp->notaries[bp->myind].ratifyrecvmask = bp->ratifyrecvmask;

16
iguana/dpow/dpow_tx.c

@ -77,24 +77,24 @@ int32_t dpow_bestk(struct dpow_block *bp,uint64_t *maskp)
uint64_t dpow_ratifybest(uint64_t refmask,struct dpow_block *bp,int8_t *lastkp)
{
int32_t j,m,k; uint64_t bestmask,mask = bp->require0;
int32_t m,k; uint64_t bestmask,mask = bp->require0;
bestmask = 0;
*lastkp = -1;
m = bp->require0;
for (j=0; j<bp->numnotaries; j++)
if ( (m= bp->require0) != 0 )
mask = 1;
for (k=m; k<bp->numnotaries; k++)
{
k = DPOW_MODIND(bp,j);
if ( (bp->require0 != 0 && k == 0) || (bits256_nonz(bp->notaries[k].ratifysrcutxo) != 0 && bits256_nonz(bp->notaries[k].ratifydestutxo) != 0) )
//k = DPOW_MODIND(bp,j);
if ( bits256_nonz(bp->notaries[k].ratifysrcutxo) != 0 && bits256_nonz(bp->notaries[k].ratifydestutxo) != 0 )
{
mask |= (1LL << k);
if ( ++m == DPOW_M(bp) )
if ( ++m == bp->minsigs )
{
*lastkp = k;
bestmask = mask;
}
}
}
printf("req.%d m.%d %d best.(%d %llx) ",bp->require0,m,DPOW_MODIND(bp,0),*lastkp,(long long)bestmask);
return(bestmask);
}
@ -112,7 +112,7 @@ uint64_t dpow_maskmin(uint64_t refmask,struct dpow_block *bp,int8_t *lastkp)
if ( bits256_nonz(bp->notaries[k].src.prev_hash) != 0 && bits256_nonz(bp->notaries[k].dest.prev_hash) != 0 )
{
mask |= (1LL << k);
if ( ++m == DPOW_M(bp) )
if ( ++m == bp->minsigs )
{
*lastkp = k;
bestmask = mask;

Loading…
Cancel
Save