jl777 8 years ago
parent
commit
beea98a756
  1. 25
      iguana/dpow/dpow_fsm.c
  2. 5
      iguana/dpow/dpow_tx.c

25
iguana/dpow/dpow_fsm.c

@ -255,6 +255,8 @@ void dpow_statemachinestart(void *ptr)
}
}
}
if ( bp->isratify == 0 )
return;
bp->bestk = -1;
dp->blocks[checkpoint.blockhash.height] = bp;
bp->beacon = rand256(0);
@ -377,28 +379,15 @@ void dpow_statemachinestart(void *ptr)
dp->blocks[checkpoint.blockhash.height] = 0;
checkpoint.blockhash.height = dp->checkpoint.blockhash.height;
dp->blocks[checkpoint.blockhash.height] = bp;
/*for (i=0; i<64; i++)
{
bp->notaries[i].recvmask = 0;
bp->notaries[i].bestk = -1;
}
memset(bp->destsigsmasks,0,sizeof(bp->destsigsmasks));
memset(bp->notaries[myind].masks,0,sizeof(bp->notaries[myind].masks));*/
}
}
if ( bp->state != 0xffffffff )
{
//printf("dp->ht.%d ht.%d DEST.%08x %s\n",dp->checkpoint.blockhash.height,checkpoint.blockhash.height,bp->state,bits256_str(str,srchash));
//if ( bp->isratify == 0 )
// bp->state = dpow_statemachineiterate(myinfo,dp,dest,bp,myind,1);
//else
{
int32_t len; struct dpow_utxoentry U; uint8_t utxodata[sizeof(U)+2];
memset(&U,0,sizeof(U));
dpow_entry2utxo(&U,bp,&bp->notaries[myind]);
if ( (len= dpow_rwutxobuf(1,utxodata,&U,bp)) > 0 )
dpow_send(myinfo,dp,bp,srchash,bp->hashmsg,DPOW_UTXOCHANNEL,bp->height,utxodata,len);
}
int32_t len; struct dpow_utxoentry U; uint8_t utxodata[sizeof(U)+2];
memset(&U,0,sizeof(U));
dpow_entry2utxo(&U,bp,&bp->notaries[myind]);
if ( (len= dpow_rwutxobuf(1,utxodata,&U,bp)) > 0 )
dpow_send(myinfo,dp,bp,srchash,bp->hashmsg,DPOW_UTXOCHANNEL,bp->height,utxodata,len);
}
if ( 0 && dp->cancelratify != 0 && bp->isratify != 0 )
{

5
iguana/dpow/dpow_tx.c

@ -423,8 +423,8 @@ int32_t dpow_signedtxgen(struct supernet_info *myinfo,struct dpow_info *dp,struc
return(-1);
for (j=0; j<sizeof(srchash); j++)
srchash.bytes[j] = dp->minerkey33[j+1];
printf("signedtxgen src_or_dest.%d (%d %llx)\n",src_or_dest,bestk,(long long)bestmask);
if ( (vins= dpow_vins(coin,bp,bestk,bestmask,1,src_or_dest,bp->numratified)) != 0 )
printf("signedtxgen src_or_dest.%d (%d %llx) useratified.%d\n",src_or_dest,bestk,(long long)bestmask,useratified);
if ( (vins= dpow_vins(coin,bp,bestk,bestmask,1,src_or_dest,useratified)) != 0 )
{
txid = dpow_notarytx(rawtx,&numsigs,coin->chain->isPoS,bp,bestk,bestmask,0,src_or_dest,bp->numratified!=0?bp->ratified_pubkeys:0,useratified);
if ( bits256_nonz(txid) != 0 && rawtx[0] != 0 ) // send tx to share utxo set
@ -449,6 +449,7 @@ int32_t dpow_signedtxgen(struct supernet_info *myinfo,struct dpow_info *dp,struc
bp->ratifysiglens[src_or_dest] = (int32_t)strlen(sigstr) >> 1;
decode_hex(bp->ratifysigs[src_or_dest],bp->ratifysiglens[src_or_dest],sigstr);
bp->ratifysigmasks[src_or_dest] |= (1LL << bp->myind);
printf("RATIFYSIG[%d] <- set notaryid.%d\n",src_or_dest,bp->myind);
}
}
}

Loading…
Cancel
Save