Browse Source

dpow_recvdata

pass-iguana-arg
jl777 7 years ago
parent
commit
fb3e358d22
  1. 3
      iguana/dPoW.h
  2. 21
      iguana/dpow/dpow_network.c

3
iguana/dPoW.h

@ -105,12 +105,15 @@ struct dpow_checkpoint
bits256 miner; uint32_t blocktime,timestamp;
};
struct dpow_recvdata { uint64_t recvmask,bestmask; int8_t bestk; };
struct dpow_block
{
bits256 hashmsg,desttxid,srctxid,beacon,commit,MoM;
struct iguana_info *srccoin,*destcoin; char *opret_symbol;
uint64_t destsigsmasks[DPOW_MAXRELAYS],srcsigsmasks[DPOW_MAXRELAYS];
uint64_t recvmask,bestmask,ratifybestmask,ratifyrecvmask,pendingbestmask,pendingratifybestmask,ratifysigmasks[2];
struct dpow_recvdata recv[64];
struct dpow_entry notaries[DPOW_MAXRELAYS];
uint32_t MoMdepth,state,starttime,timestamp,waiting,sigcrcs[2],txidcrcs[2],utxocrcs[2],lastepoch,paxwdcrc,lastnanosend;
int32_t rawratifiedlens[2],height,numnotaries,numerrors,completed,minsigs,duration,numratified,isratify,require0,scores[DPOW_MAXRELAYS];

21
iguana/dpow/dpow_network.c

@ -1507,13 +1507,14 @@ void dpow_bestconsensus(struct dpow_block *bp)
bp->bestmatches = best;
bp->notaries[bp->myind].bestmask = bp->bestmask = masks[besti];
bp->notaries[bp->myind].bestk = bp->bestk = bestks[besti];
printf("set best.%d to (%d %llx) recv.%llx\n",best,bp->bestk,(long long)bp->bestmask,(long long)recvmask);
if ( bp->myind == 0 )
printf("%s.%d set best.%d to (%d %llx) recv.%llx\n",dp->symbol,bp->height,best,bp->bestk,(long long)bp->bestmask,(long long)recvmask);
}
bp->recvmask |= recvmask;
if ( bp->bestmask == 0 )//|| (time(NULL) / 180) != bp->lastepoch )
{
bp->bestmask = dpow_notarybestk(bp->recvmask,bp,&bp->bestk);
if ( 0 && (time(NULL) / 180) != bp->lastepoch )
if ( 0 && (time(NULL) / 180) != bp->lastepoch ) // diverges too fast
{
bp->lastepoch = (uint32_t)(time(NULL) / 180);
printf("epoch %u\n",bp->lastepoch % bp->numnotaries);
@ -1955,7 +1956,21 @@ void dpow_nanoutxoget(struct supernet_info *myinfo,struct dpow_info *dp,struct d
{
dpow_notarize_update(myinfo,dp,bp,senderind,(int8_t)np->bestk,np->bestmask,np->recvmask,np->srcutxo,np->srcvout,np->destutxo,np->destvout,np->siglens,np->sigs,np->paxwdcrc);
if ( bp->myind == 0 )
printf("%s.%d lag.[%d] RECV.%d %llx (%d %llx) %llx/%llx\n",dp->symbol,bp->height,(int32_t)(time(NULL)-channel),senderind,(long long)np->recvmask,(int8_t)np->bestk,(long long)np->bestmask,(long long)np->srcutxo.txid,(long long)np->destutxo.txid);
{
int32_t i,matches = 0;
if ( np->bestk >= 0 )
{
bp->recv[senderind].recvmask = np->recvmask;
bp->recv[senderind].bestk = np->bestk;
bp->recv[senderind].bestmask = np->bestmask;
for (i=0; i<bp->numnotaries; i++)
{
if ( bp->recv[i].recvmask == np->recvmask && bp->recv[i].bestmask == np->bestmask && bp->recv[i].bestk == np->bestk )
matches++;
}
}
printf("%s.%d lag.[%2d] RECV.%d %llx (%2d %llx) %llx/%llx\n",dp->symbol,bp->height,(int32_t)(time(NULL)-channel),senderind,(long long)np->recvmask,(int8_t)np->bestk,(long long)np->bestmask,(long long)np->srcutxo.txid,(long long)np->destutxo.txid,matches);
}
}
//dpow_bestmask_update(myinfo,dp,bp,nn_senderind,nn_bestk,nn_bestmask,nn_recvmask);
}

Loading…
Cancel
Save