From 82f82d3f08fbd890e03c3a6827e8d424dcc6884b Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Apr 2018 13:44:33 +0300 Subject: [PATCH] Test --- src/komodo_bitcoind.h | 20 +++++++++++++++++--- src/pow.cpp | 4 ++-- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 359a417d8..fc58131b6 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -840,12 +840,26 @@ int32_t komodo_minerids(uint8_t *minerids,int32_t height,int32_t width) // depre return(-1); } -int32_t komodo_is_special(int32_t height,uint8_t pubkey33[33],uint32_t timestamp) +int32_t komodo_is_special(uint8_t pubkeys[66][33],int32_t mids[66],int32_t height,uint8_t pubkey33[33],uint32_t timestamp) { int32_t i,notaryid=0,minerid,limit,nid; //uint8_t _pubkey33[33]; if ( height >= 225000 ) komodo_chosennotary(¬aryid,height,pubkey33,timestamp); - if ( height >= 34000 && notaryid >= 0 ) + if ( height >= 700000 ) + { + if ( mids[0] >= 0 ) + { + for (i=1; i<66; i++) + { + if ( mids[i] == mids[0] ) + { + fprintf(stderr,"ht.%d repeat notaryid.%d in mids[%d]\n",height,mids[0],i); + return(-1); + } + } + } else return(0); + } + else if ( height >= 34000 && notaryid >= 0 ) { if ( height < 79693 ) limit = 64; @@ -857,7 +871,7 @@ int32_t komodo_is_special(int32_t height,uint8_t pubkey33[33],uint32_t timestamp komodo_chosennotary(&nid,height-i,pubkey33,timestamp); if ( nid == notaryid ) { - //if ( (0) && notaryid > 0 ) + if ( (0) && notaryid > 0 ) fprintf(stderr,"ht.%d notaryid.%d already mined -i.%d nid.%d\n",height,notaryid,i,nid); if ( height > 225000 ) return(-1); diff --git a/src/pow.cpp b/src/pow.cpp index 6f20ebc2f..a93a6cc95 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -117,7 +117,7 @@ bool CheckEquihashSolution(const CBlockHeader *pblock, const CChainParams& param } int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33,uint32_t timestamp); -int32_t komodo_is_special(int32_t height,uint8_t pubkey33[33],uint32_t timestamp); +int32_t komodo_is_special(uint8_t pubkeys[66][33],int32_t mids[66],int32_t height,uint8_t pubkey33[33],uint32_t timestamp); int32_t komodo_currentheight(); CBlockIndex *komodo_chainactive(int32_t height); void komodo_index2pubkey33(uint8_t *pubkey33,CBlockIndex *pindex,int32_t height); @@ -157,7 +157,7 @@ bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash, unsigned in return(true); // will come back via different path with pubkey set } flag = komodo_eligiblenotary(pubkeys,mids,&nonzpkeys,height); - special2 = komodo_is_special(height,pubkey33,timestamp); + special2 = komodo_is_special(pubkeys,mids,height,pubkey33,timestamp); //fprintf(stderr,"ht.%d notaryid.%d special.%d flag.%d special2.%d\n",height,notaryid,special,flag,special2); if ( notaryid >= 0 ) {