From 2bc822abd6b84f93a93f8a677daf9ca6dfd79fec Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 3 May 2018 14:59:30 +0300 Subject: [PATCH] Add owts[] --- iguana/dpow/dpow_network.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/iguana/dpow/dpow_network.c b/iguana/dpow/dpow_network.c index 13babbf08..57c8c23ce 100755 --- a/iguana/dpow/dpow_network.c +++ b/iguana/dpow/dpow_network.c @@ -1464,11 +1464,17 @@ void dpow_nanomsginit(struct supernet_info *myinfo,char *ipaddr) void dpow_bestconsensus(struct dpow_info *dp,struct dpow_block *bp) { - int8_t bestks[64]; int32_t wts[64],counts[64],i,j,numcrcs=0,numdiff,besti,bestmatches = 0,matches = 0; uint64_t masks[64],matchesmask,recvmask; uint32_t crcval=0; char srcaddr[64],destaddr[64]; + int8_t bestks[64]; int32_t wts[64],owts[64],counts[64],i,j,numcrcs=0,numdiff,besti,bestmatches = 0,matches = 0; uint64_t masks[64],matchesmask,recvmask; uint32_t crcval=0; char srcaddr[64],destaddr[64]; memset(wts,0,sizeof(wts)); + memset(owts,0,sizeof(owts)); for (i=0; inumnotaries; i++) - wts[i] = bitweight(bp->notaries[i].recvmask); - + { + recvmask = bp->notaries[i].recvmask; + wts[i] = bitweight(recvmask); + for (j=0; jnumnotaries; j++) + if ( ((1LL << j) & recvmask) != 0 ) + owts[j]++; + } memset(masks,0,sizeof(masks)); memset(bestks,0xff,sizeof(bestks)); memset(counts,0,sizeof(counts)); @@ -1523,7 +1529,7 @@ void dpow_bestconsensus(struct dpow_info *dp,struct dpow_block *bp) if ( bp->myind == 0 ) { for (i=0; inumnotaries; i++) - printf("%d ",wts[i]); + printf("%d:%d ",wts[i],owts[i]); printf("%s.%d set matches.%d best.%d to (%d %llx) recv.%llx\n",dp->symbol,bp->height,bp->matches,bp->bestmatches,bp->bestk,(long long)bp->bestmask,(long long)recvmask); } }