diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index cf591d0c7..428233a1b 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -725,13 +725,13 @@ uint32_t komodo_heightstamp(int32_t height) void komodo_pindex_init(CBlockIndex *pindex,int32_t height) { int32_t i,num; uint8_t pubkeys[64][33]; CBlock block; - printf("pindex.%d komodo_pindex_init notary.%d from height.%d\n",pindex->nHeight,pindex->notaryid,height); if ( pindex->notaryid >= 0 && (pindex->pubkey33[0] == 2 || pindex->pubkey33[0] == 3) ) return; + printf("pindex.%d komodo_pindex_init notary.%d from height.%d\n",pindex->nHeight,pindex->notaryid,height); pindex->notaryid = -1; - if ( pindex->pubkey33[0] != 2 && pindex->pubkey33[0] != 3 ) + if ( pindex->pubkey33[0] != 2 && pindex->pubkey33[0] != 3 && pindex->pubkey33[0] != 0xff ) { - memset(pindex->pubkey33,0,33); + memset(pindex->pubkey33,0xff,33); if ( komodo_blockload(block,pindex) == 0 ) { komodo_block2pubkey33(pindex->pubkey33,block); diff --git a/src/main.cpp b/src/main.cpp index 7880373ec..83c320ccb 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4091,7 +4091,7 @@ CBlockIndex * InsertBlockIndex(uint256 hash) return pindexNew; } -void komodo_pindex_init(CBlockIndex *pindex,int32_t height); +//void komodo_pindex_init(CBlockIndex *pindex,int32_t height); bool static LoadBlockIndexDB() { @@ -4108,7 +4108,7 @@ bool static LoadBlockIndexDB() { CBlockIndex* pindex = item.second; vSortedByHeight.push_back(make_pair(pindex->nHeight, pindex)); - komodo_pindex_init(pindex,(int32_t)pindex->nHeight); + //komodo_pindex_init(pindex,(int32_t)pindex->nHeight); } sort(vSortedByHeight.begin(), vSortedByHeight.end()); BOOST_FOREACH(const PAIRTYPE(int, CBlockIndex*)& item, vSortedByHeight) @@ -4157,7 +4157,7 @@ bool static LoadBlockIndexDB() pindex->BuildSkip(); if (pindex->IsValid(BLOCK_VALID_TREE) && (pindexBestHeader == NULL || CBlockIndexWorkComparator()(pindexBestHeader, pindex))) pindexBestHeader = pindex; - komodo_pindex_init(pindex,(int32_t)pindex->nHeight); + //komodo_pindex_init(pindex,(int32_t)pindex->nHeight); } // Load block file info @@ -4186,7 +4186,7 @@ bool static LoadBlockIndexDB() if (pindex->nStatus & BLOCK_HAVE_DATA) { setBlkDataFiles.insert(pindex->nFile); } - komodo_pindex_init(pindex,(int32_t)pindex->nHeight); + //komodo_pindex_init(pindex,(int32_t)pindex->nHeight); } for (std::set::iterator it = setBlkDataFiles.begin(); it != setBlkDataFiles.end(); it++) { @@ -4222,7 +4222,7 @@ bool static LoadBlockIndexDB() if (pindex->pprev) { pindex->pprev->hashAnchorEnd = pindex->hashAnchor; } - komodo_pindex_init(pindex,(int32_t)pindex->nHeight); + //komodo_pindex_init(pindex,(int32_t)pindex->nHeight); } // Load pointer to end of best chain diff --git a/src/pow.cpp b/src/pow.cpp index 5c38ac994..2882360d0 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -145,6 +145,8 @@ bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash, unsigned in } if ( height > 34000 && ASSETCHAINS_SYMBOL[0] == 0 ) // 0 -> non-special notary { + if ( (pindex= komodo_chainactive(height)) != 0 ) + komodo_pindex_init(pindex,height); special = komodo_chosennotary(¬aryid,height,pubkey33,timestamp); for (i=0; i<33; i++) {