From c142de7e72fa4361ac40ece0c4f1fa73da2ea278 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 2 Feb 2017 16:01:41 +0200 Subject: [PATCH] test --- src/komodo_bitcoind.h | 14 +++++++++----- src/miner.cpp | 4 ++-- src/pow.cpp | 6 +++--- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index e921ef7b4..74ba12833 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -608,12 +608,16 @@ void komodo_connectpindex(CBlockIndex *pindex) int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height); int32_t komodo_electednotary(uint8_t *pubkey33,int32_t height); -int8_t komodo_minerid(int32_t height) +int8_t komodo_minerid(int32_t height,uint8_t *pubkey33) { - int32_t num,i; CBlockIndex *pindex; uint8_t pubkey33[33],pubkeys[64][33]; + int32_t num,i; CBlockIndex *pindex; uint8_t _pubkey33[33],pubkeys[64][33]; if ( (pindex= chainActive[height]) != 0 ) { - komodo_index2pubkey33(pubkey33,pindex,height); + if ( pubkey33 == 0 ) + { + pubkey33 = _pubkey33; + komodo_index2pubkey33(pubkey33,pindex,height); + } if ( (num= komodo_notaries(pubkeys,height)) > 0 ) { for (i=0; inHeight-i)); + fprintf(stderr,"%d ",komodo_minerid(chainActive.Tip()->nHeight-i,0)); fprintf(stderr," minerids.special %d from ht.%d\n",komodo_is_special(chainActive.Tip()->nHeight+1,NOTARY_PUBKEY33),chainActive.Tip()->nHeight); } return CreateNewBlock(scriptPubKey); diff --git a/src/pow.cpp b/src/pow.cpp index 8b31836f9..1602ddf8f 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -107,7 +107,7 @@ bool CheckEquihashSolution(const CBlockHeader *pblock, const CChainParams& param int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33); int32_t komodo_is_special(int32_t height,uint8_t pubkey33[33]); int32_t komodo_currentheight(); -int8_t komodo_minerid(int32_t height); +int8_t komodo_minerid(int32_t height,uint8_t *pubkey33); extern int32_t KOMODO_CHOSEN_ONE; #define KOMODO_ELECTION_GAP 2000 @@ -120,9 +120,9 @@ bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash, unsigned in bnTarget.SetCompact(nBits, &fNegative, &fOverflow); if ( height == 0 ) height = komodo_currentheight() + 1; + special = komodo_chosennotary(¬aryid,height,pubkey33); if ( height > 34000 ) // 0 -> non-special notary { - special = komodo_chosennotary(¬aryid,height,pubkey33); for (i=0; i<33; i++) { if ( pubkey33[i] != 0 ) @@ -168,7 +168,7 @@ bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash, unsigned in printf("%02x",pubkey33[i]); printf(" <- pubkey\n"); for (i=0; i<66; i++) - printf("%d ",komodo_minerid(height-i)); + printf("%d ",komodo_minerid(height-i,pubkey33)); printf(" minerids from ht.%d\n",height); if ( height < 90000 || (height > 110000 && KOMODO_REWIND == 0) ) return error("CheckProofOfWork(): hash doesn't match nBits");