|
|
@ -686,7 +686,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][DPOW_MAXSIGLEN],uint32_t paxwdcrc) |
|
|
|
{ |
|
|
|
int32_t i,bestmatches = 0,matches = 0,paxmatches = 0,paxbestmatches = 0; |
|
|
|
bits256 srchash; int32_t i,flag,bestmatches = 0,matches = 0,paxmatches = 0,paxbestmatches = 0; |
|
|
|
if ( bp->myind < 0 ) |
|
|
|
return; |
|
|
|
if ( bp->isratify == 0 && bp->state != 0xffffffff && senderind >= 0 && senderind < bp->numnotaries && bits256_nonz(srcutxo) != 0 && bits256_nonz(destutxo) != 0 ) |
|
|
@ -704,7 +704,7 @@ void dpow_notarize_update(struct supernet_info *myinfo,struct dpow_info *dp,stru |
|
|
|
if ( bestmask != 0 ) |
|
|
|
bp->notaries[senderind].bestmask = bestmask; |
|
|
|
if ( recvmask != 0 ) |
|
|
|
bp->notaries[senderind].recvmask = recvmask; |
|
|
|
bp->notaries[senderind].recvmask |= recvmask; |
|
|
|
if ( (bp->notaries[senderind].paxwdcrc= paxwdcrc) != 0 ) |
|
|
|
{ |
|
|
|
//fprintf(stderr,"{%d %x} ",senderind,paxwdcrc);
|
|
|
@ -731,7 +731,7 @@ void dpow_notarize_update(struct supernet_info *myinfo,struct dpow_info *dp,stru |
|
|
|
{ |
|
|
|
bp->recvmask |= (1LL << senderind) | (1LL << bp->myind); |
|
|
|
bp->bestmask = dpow_maskmin(bp->recvmask,bp,&bp->bestk); |
|
|
|
//dpow_bestconsensus(bp);
|
|
|
|
dpow_bestconsensus(bp); |
|
|
|
} |
|
|
|
if ( bp->bestk >= 0 ) |
|
|
|
bp->notaries[bp->myind].bestk = bp->bestk; |
|
|
@ -741,6 +741,7 @@ void dpow_notarize_update(struct supernet_info *myinfo,struct dpow_info *dp,stru |
|
|
|
bp->notaries[bp->myind].recvmask = bp->recvmask; |
|
|
|
if ( bp->bestk >= 0 ) |
|
|
|
{ |
|
|
|
flag = -1; |
|
|
|
for (i=0; i<bp->numnotaries; i++) |
|
|
|
{ |
|
|
|
if ( bp->paxwdcrc == bp->notaries[i].paxwdcrc ) |
|
|
@ -757,9 +758,18 @@ void dpow_notarize_update(struct supernet_info *myinfo,struct dpow_info *dp,stru |
|
|
|
} //else printf("?%x ",bp->notaries[i].paxwdcrc);
|
|
|
|
} |
|
|
|
} |
|
|
|
else if ( i == senderind && ((1LL << bp->myind) & bp->bestmask) != 0 && ((1LL << i) & bp->bestmask) != 0 && ((1LL << bp->myind) & bp->notaries[i].recvmask) == 0 ) |
|
|
|
flag = senderind; |
|
|
|
if ( 0 && bp->myind <= 1 && bp->notaries[i].paxwdcrc != 0 ) |
|
|
|
printf("%d.(%x %d %llx r%llx) ",i,bp->notaries[i].paxwdcrc,bp->notaries[i].bestk,(long long)bp->notaries[i].bestmask,(long long)bp->notaries[i].recvmask); |
|
|
|
} |
|
|
|
if ( flag >= 0 ) |
|
|
|
{ |
|
|
|
//printf("flag.%d -> send\n",flag);
|
|
|
|
for (i=0; i<sizeof(srchash); i++) |
|
|
|
srchash.bytes[i] = dp->minerkey33[i+1]; |
|
|
|
dpow_send(myinfo,dp,bp,srchash,bp->hashmsg,0,bp->height,(void *)"ping",0); |
|
|
|
} |
|
|
|
if ( 0 && bp->myind <= 1 ) |
|
|
|
printf("recv.%llx best.(%d %llx) m.%d p.%d:%d b.%d\n",(long long)bp->recvmask,bp->bestk,(long long)bp->bestmask,matches,paxmatches,paxbestmatches,bestmatches); |
|
|
|
if ( bestmatches >= bp->minsigs && paxbestmatches >= bp->minsigs ) |
|
|
@ -785,7 +795,7 @@ void dpow_notarize_update(struct supernet_info *myinfo,struct dpow_info *dp,stru |
|
|
|
} |
|
|
|
} |
|
|
|
if ( (rand() % 30) == 0 ) |
|
|
|
printf("[%d] ips.%d %s NOTARIZE.%d matches.%d paxmatches.%d bestmatches.%d bestk.%d %llx recv.%llx sigmasks.(%llx %llx) senderind.%d state.%x (%x %x %x) pax.%x\n",bp->myind,dp->numipbits,dp->symbol,bp->minsigs,matches,paxmatches,bestmatches,bp->bestk,(long long)bp->bestmask,(long long)bp->recvmask,(long long)(bp->bestk>=0?bp->destsigsmasks[bp->bestk]:0),(long long)(bp->bestk>=0?bp->srcsigsmasks[bp->bestk]:0),senderind,bp->state,bp->hashmsg.uints[0],bp->desttxid.uints[0],bp->srctxid.uints[0],bp->paxwdcrc); |
|
|
|
printf("%p [%d] ips.%d %s NOTARIZE.%d matches.%d paxmatches.%d bestmatches.%d bestk.%d %llx recv.%llx sigmasks.(%llx %llx) senderind.%d state.%x (%x %x %x) pax.%x\n",bp,bp->myind,dp->numipbits,dp->symbol,bp->minsigs,matches,paxmatches,bestmatches,bp->bestk,(long long)bp->bestmask,(long long)bp->recvmask,(long long)(bp->bestk>=0?bp->destsigsmasks[bp->bestk]:0),(long long)(bp->bestk>=0?bp->srcsigsmasks[bp->bestk]:0),senderind,bp->state,bp->hashmsg.uints[0],bp->desttxid.uints[0],bp->srctxid.uints[0],bp->paxwdcrc); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -1026,9 +1036,9 @@ int32_t dpow_nanomsg_update(struct supernet_info *myinfo) |
|
|
|
|
|
|
|
void dpow_nanomsginit(struct supernet_info *myinfo,char *ipaddr) { } |
|
|
|
|
|
|
|
uint32_t dpow_send(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_block *bp,bits256 srchash,bits256 desthash,uint32_t channel,uint32_t msgbits,uint8_t *data,int32_t datalen) |
|
|
|
void dpow_send(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_block *bp,bits256 srchash,bits256 desthash,uint32_t channel,uint32_t msgbits,uint8_t *data,int32_t datalen) |
|
|
|
{ |
|
|
|
return(0); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
int32_t dpow_nanomsg_update(struct supernet_info *myinfo) { return(0); } |
|
|
|