jl777 8 years ago
parent
commit
08511688bf
  1. 6
      iguana/dpow/dpow_fsm.c
  2. 4
      iguana/dpow/dpow_network.c

6
iguana/dpow/dpow_fsm.c

@ -66,7 +66,7 @@ void dpow_entry2utxo(struct dpow_utxoentry *up,struct dpow_block *bp,struct dpow
up->destvout = ep->dest.prev_vout; up->destvout = ep->dest.prev_vout;
} }
void dpow_utxosync(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_block *bp,uint64_t recvmask,int32_t myind,bits256 srchash) /*void dpow_utxosync(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_block *bp,uint64_t recvmask,int32_t myind,bits256 srchash)
{ {
uint32_t i,j,r; int32_t len; struct dpow_utxoentry U; uint8_t utxodata[sizeof(U)+2]; uint32_t i,j,r; int32_t len; struct dpow_utxoentry U; uint8_t utxodata[sizeof(U)+2];
if ( (bp->recvmask ^ recvmask) != 0 ) if ( (bp->recvmask ^ recvmask) != 0 )
@ -94,7 +94,7 @@ void dpow_utxosync(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow
if ( (len= dpow_rwutxobuf(1,utxodata,&U,bp)) > 0 ) if ( (len= dpow_rwutxobuf(1,utxodata,&U,bp)) > 0 )
dpow_send(myinfo,dp,bp,srchash,bp->hashmsg,DPOW_UTXOCHANNEL,bp->height,utxodata,len); dpow_send(myinfo,dp,bp,srchash,bp->hashmsg,DPOW_UTXOCHANNEL,bp->height,utxodata,len);
} }
} }*/
int32_t dpow_datahandler(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_block *bp,uint8_t nn_senderind,uint32_t channel,uint32_t height,uint8_t *data,int32_t datalen) int32_t dpow_datahandler(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_block *bp,uint8_t nn_senderind,uint32_t channel,uint32_t height,uint8_t *data,int32_t datalen)
{ {
@ -358,7 +358,7 @@ void dpow_statemachinestart(void *ptr)
for (i=0; i<sizeof(srchash); i++) for (i=0; i<sizeof(srchash); i++)
srchash.bytes[i] = dp->minerkey33[i+1]; srchash.bytes[i] = dp->minerkey33[i+1];
//printf("start utxosync start.%u %u\n",starttime,(uint32_t)time(NULL)); //printf("start utxosync start.%u %u\n",starttime,(uint32_t)time(NULL));
dpow_utxosync(myinfo,dp,bp,0,myind,srchash); //dpow_utxosync(myinfo,dp,bp,0,myind,srchash);
//printf("done utxosync start.%u %u\n",starttime,(uint32_t)time(NULL)); //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 ) while ( time(NULL) < starttime+bp->duration && src != 0 && dest != 0 && bp->state != 0xffffffff )
{ {

4
iguana/dpow/dpow_network.c

@ -186,7 +186,7 @@ void dpow_ratify_update(struct supernet_info *myinfo,struct dpow_info *dp,struct
int32_t i,bestmatches = 0,matches = 0; int32_t i,bestmatches = 0,matches = 0;
//char str[65],str2[65]; //char str[65],str2[65];
//printf("senderind.%d num.%d %s %s\n",senderind,bp->numnotaries,bits256_str(str,srcutxo),bits256_str(str2,destutxo)); //printf("senderind.%d num.%d %s %s\n",senderind,bp->numnotaries,bits256_str(str,srcutxo),bits256_str(str2,destutxo));
if ( senderind >= 0 && senderind < bp->numnotaries && bits256_nonz(srcutxo) != 0 && bits256_nonz(destutxo) != 0 ) if ( bp->isratify != 0 && senderind >= 0 && senderind < bp->numnotaries && bits256_nonz(srcutxo) != 0 && bits256_nonz(destutxo) != 0 )
{ {
bp->notaries[senderind].ratifysrcutxo = srcutxo; bp->notaries[senderind].ratifysrcutxo = srcutxo;
bp->notaries[senderind].ratifysrcvout = srcvout; bp->notaries[senderind].ratifysrcvout = srcvout;
@ -252,7 +252,7 @@ void dpow_ratify_update(struct supernet_info *myinfo,struct dpow_info *dp,struct
void dpow_notarize_update(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_block *bp,uint8_t senderind,int8_t bestk,uint64_t bestmask,uint64_t recvmask,bits256 srcutxo,uint16_t srcvout,bits256 destutxo,uint16_t destvout,uint8_t siglens[2],uint8_t sigs[2][76]) void dpow_notarize_update(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_block *bp,uint8_t senderind,int8_t bestk,uint64_t bestmask,uint64_t recvmask,bits256 srcutxo,uint16_t srcvout,bits256 destutxo,uint16_t destvout,uint8_t siglens[2],uint8_t sigs[2][76])
{ {
int32_t i,bestmatches = 0,matches = 0; int32_t i,bestmatches = 0,matches = 0;
if ( bp->state != 0xffffffff && senderind >= 0 && senderind < bp->numnotaries && bits256_nonz(srcutxo) != 0 && bits256_nonz(destutxo) != 0 ) if ( bp->isratify == 0 && bp->state != 0xffffffff && senderind >= 0 && senderind < bp->numnotaries && bits256_nonz(srcutxo) != 0 && bits256_nonz(destutxo) != 0 )
{ {
bp->notaries[senderind].src.prev_hash = srcutxo; bp->notaries[senderind].src.prev_hash = srcutxo;
bp->notaries[senderind].src.prev_vout = srcvout; bp->notaries[senderind].src.prev_vout = srcvout;

Loading…
Cancel
Save