From 3b76f27e46433b9f671e8d48683737590d5dc4b6 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 2 Feb 2017 16:48:23 +0200 Subject: [PATCH] test --- src/pow.cpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/pow.cpp b/src/pow.cpp index 3f13e3ad3..8b5e653e6 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -126,6 +126,18 @@ bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash, unsigned in //for (i=0; i<33; i++) // printf("%02x",pubkey33[i]); //printf(" <- ht.%d\n",height); + memset(mids,-1,sizeof(mids)); + for (i=duplicate=0; i<66; i++) + { + if ( (pindex= komodo_chainactive(height-i)) == 0 ) + break; + komodo_index2pubkey33(pubkey33,pindex,height-i); + mids[i] = komodo_minerid(height-i,pubkey33); + if ( i > 0 && mids[i] == mids[0] ) + duplicate++; + } + if ( i == 66 && duplicate == 0 ) + flag = 1; if ( height > 34000 ) // 0 -> non-special notary { for (i=0; i<33; i++) @@ -152,17 +164,6 @@ bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash, unsigned in flag = 1; else if ( height >= 108000 && special2 > 0 ) flag = ((height % KOMODO_ELECTION_GAP) > 64 || (height % KOMODO_ELECTION_GAP) == 0); - for (i=duplicate=0; i<66; i++) - { - if ( (pindex= komodo_chainactive(height-i)) == 0 ) - break; - komodo_index2pubkey33(pubkey33,pindex,height-i); - mids[i] = komodo_minerid(height-i,pubkey33); - if ( i > 0 && mids[i] == mids[0] ) - duplicate++; - } - if ( i == 66 && duplicate == 0 ) - flag = 1; if ( flag != 0 ) bnTarget.SetCompact(KOMODO_MINDIFF_NBITS,&fNegative,&fOverflow); }