Debugging

This commit is contained in:
jl777
2018-02-13 21:29:42 +02:00
parent 8f8b5a2ac6
commit 8683bd8d11
12 changed files with 318 additions and 118 deletions

View File

@@ -115,13 +115,14 @@ bool CheckEquihashSolution(const CBlockHeader *pblock, const CChainParams& param
return true;
}
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_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_currentheight();
CBlockIndex *komodo_chainactive(int32_t height);
int8_t komodo_minerid(int32_t height,uint8_t *pubkey33);
void komodo_index2pubkey33(uint8_t *pubkey33,CBlockIndex *pindex,int32_t height);
extern int32_t KOMODO_CHOSEN_ONE;
extern char ASSETCHAINS_SYMBOL[];
#define KOMODO_ELECTION_GAP 2000
int32_t komodo_eligiblenotary(uint8_t pubkeys[66][33],int32_t *mids,int32_t *nonzpkeysp,int32_t height);
@@ -132,15 +133,16 @@ extern std::string NOTARY_PUBKEY;
bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash, unsigned int nBits, const Consensus::Params& params)
{
extern int32_t KOMODO_REWIND;
bool fNegative,fOverflow; int32_t i,nonzpkeys=0,nonz=0,special=0,special2=0,notaryid=-1,duplicate,flag = 0, mids[66];
bool fNegative,fOverflow; int32_t i,nonzpkeys=0,nonz=0,special=0,special2=0,notaryid=-1,duplicate,flag = 0, mids[66]; uint32_t timestamp = 0;
arith_uint256 bnTarget; CBlockIndex *pindex; uint8_t pubkeys[66][33];
if ( (pindex= chainActive.Tip()) != 0 )
timestamp = (uint32_t)pindex->GetBlockTime();
bnTarget.SetCompact(nBits, &fNegative, &fOverflow);
if ( height == 0 )
height = komodo_currentheight() + 1;
special = komodo_chosennotary(&notaryid,height,pubkey33);
flag = komodo_eligiblenotary(pubkeys,mids,&nonzpkeys,height);
if ( height > 34000 ) // 0 -> non-special notary
special = komodo_chosennotary(&notaryid,height,pubkey33,timestamp);
flag = komodo_eligiblenotary(pubkeys,mids,&nonzpkeys,height,timestamp);
if ( height > 34000 && ASSETCHAINS_SYMBOL[0] == 0 ) // 0 -> non-special notary
{
for (i=0; i<33; i++)
{
@@ -149,7 +151,7 @@ bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash, unsigned in
}
if ( nonz == 0 )
return(true); // will come back via different path with pubkey set
special2 = komodo_is_special(height,pubkey33);
special2 = komodo_is_special(height,pubkey33,timestamp);
if ( notaryid >= 0 )
{
if ( height > 10000 && height < 80000 && (special != 0 || special2 > 0) )