jl777 8 years ago
parent
commit
337983a4d2
  1. 40
      deprecated/obsolete.h
  2. 48
      iguana/dpow/dpow_fsm.c
  3. 6
      iguana/dpow/dpow_network.c

40
deprecated/obsolete.h

@ -20069,5 +20069,45 @@ len = 0;
}
return(len);
}
/*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];
if ( (bp->recvmask ^ recvmask) != 0 )
{
if ( ((1LL << myind) & recvmask) == 0 )
{
i = myind;
//printf("utxosync bp->%llx != %llx, myind.%d\n",(long long)bp->recvmask,(long long)recvmask,myind);
}
else
{
r = (rand() % bp->numnotaries);
for (j=0; j<bp->numnotaries; j++)
{
i = DPOW_MODIND(bp,j+r);
if ( ((1LL << i) & bp->recvmask) != 0 && ((1LL << i) & recvmask) == 0 )
break;
}
//printf("utxosync bp->%llx != %llx, random pick.%d\n",(long long)bp->recvmask,(long long)recvmask,i);
}
memset(&U,0,sizeof(U));
dpow_entry2utxo(&U,bp,&bp->notaries[i]);
//char str[65],str2[65];
//printf("send.(%s %s)\n",bits256_str(str,bp->notaries[i].dest.prev_hash),bits256_str(str2,bp->notaries[i].src.prev_hash));
if ( (len= dpow_rwutxobuf(1,utxodata,&U,bp)) > 0 )
dpow_send(myinfo,dp,bp,srchash,bp->hashmsg,DPOW_UTXOCHANNEL,bp->height,utxodata,len);
}
}*/
/*else if ( strcmp(dp->symbol,"KMD") == 0 )
{
bp->bestk = -1;
bp->bestmask = 0;
bp->height = ((dp->checkpoint.blockhash.height / 10) % (DPOW_FIRSTRATIFY/10)) * 10;
printf("new rotation ht.%d\n",bp->height);
dp->blocks[checkpoint.blockhash.height] = 0;
checkpoint.blockhash.height = dp->checkpoint.blockhash.height;
dp->blocks[checkpoint.blockhash.height] = bp;
}*/

48
iguana/dpow/dpow_fsm.c

@ -66,36 +66,6 @@ void dpow_entry2utxo(struct dpow_utxoentry *up,struct dpow_block *bp,struct dpow
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)
{
uint32_t i,j,r; int32_t len; struct dpow_utxoentry U; uint8_t utxodata[sizeof(U)+2];
if ( (bp->recvmask ^ recvmask) != 0 )
{
if ( ((1LL << myind) & recvmask) == 0 )
{
i = myind;
//printf("utxosync bp->%llx != %llx, myind.%d\n",(long long)bp->recvmask,(long long)recvmask,myind);
}
else
{
r = (rand() % bp->numnotaries);
for (j=0; j<bp->numnotaries; j++)
{
i = DPOW_MODIND(bp,j+r);
if ( ((1LL << i) & bp->recvmask) != 0 && ((1LL << i) & recvmask) == 0 )
break;
}
//printf("utxosync bp->%llx != %llx, random pick.%d\n",(long long)bp->recvmask,(long long)recvmask,i);
}
memset(&U,0,sizeof(U));
dpow_entry2utxo(&U,bp,&bp->notaries[i]);
//char str[65],str2[65];
//printf("send.(%s %s)\n",bits256_str(str,bp->notaries[i].dest.prev_hash),bits256_str(str2,bp->notaries[i].src.prev_hash));
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 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 i,src_or_dest,myind = -1; bits256 txid,srchash; struct iguana_info *coin; char str[65],str2[65];
@ -384,29 +354,11 @@ void dpow_statemachinestart(void *ptr)
printf("abort ht.%d due to new checkpoint.%d\n",checkpoint.blockhash.height,dp->checkpoint.blockhash.height);
break;
}
/*else if ( strcmp(dp->symbol,"KMD") == 0 )
{
bp->bestk = -1;
bp->bestmask = 0;
bp->height = ((dp->checkpoint.blockhash.height / 10) % (DPOW_FIRSTRATIFY/10)) * 10;
printf("new rotation ht.%d\n",bp->height);
dp->blocks[checkpoint.blockhash.height] = 0;
checkpoint.blockhash.height = dp->checkpoint.blockhash.height;
dp->blocks[checkpoint.blockhash.height] = bp;
}*/
}
if ( bp->state != 0xffffffff )
{
/*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);
else*/
{
dpow_send(myinfo,dp,bp,srchash,bp->hashmsg,0,bp->height,(void *)"ping",0);
}
}
if ( 0 && dp->cancelratify != 0 && bp->isratify != 0 )
{
printf("abort pending ratify\n");

6
iguana/dpow/dpow_network.c

@ -421,7 +421,9 @@ void dpow_send(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_blo
np->size = size;
np->datalen = datalen;
np->crc32 = crc32;
np->srchash = srchash;
for (i=0; i<32; i++)
np->srchash.bytes[i] = myinfo->minerkey33[i+1];
//np->srchash = srchash;
np->desthash = desthash;
np->channel = channel;
np->height = msgbits;
@ -510,7 +512,7 @@ void dpow_nanomsg_update(struct supernet_info *myinfo)
dpow_ipbitsadd(myinfo,dp,np->ipbits,np->numipbits,np->senderind,np->myipbits);
if ( (bp= dpow_heightfind(myinfo,dp,np->height)) != 0 )
{
if ( np->senderind >= 0 && np->senderind < bp->numnotaries )
if ( np->senderind >= 0 && np->senderind < bp->numnotaries && memcmp(bp-> notaries[np->senderind].pubkey+1,np->srchash.bytes,32) == 0 )
{
if ( bp->isratify == 0 )
dpow_nanoutxoget(myinfo,dp,bp,&np->notarize,0,np->senderind);

Loading…
Cancel
Save