diff --git a/src/miner.cpp b/src/miner.cpp index f31d6bd7c..908fd601f 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -813,11 +813,13 @@ int32_t waitForPeers(const CChainParams &chainparams) #ifdef ENABLE_WALLET CBlockIndex *get_chainactive(int32_t height) { - LOCK(cs_main); - if ( chainActive.Tip() != 0 ) + if ( chainActive.LastTip() != 0 ) { - if ( height <= chainActive.Tip()->nHeight ) + if ( height <= chainActive.LastTip()->nHeight ) + { + LOCK(cs_main); return(chainActive[height]); + } // else fprintf(stderr,"get_chainactive height %d > active.%d\n",height,chainActive.Tip()->nHeight); } //fprintf(stderr,"get_chainactive null chainActive.Tip() height %d\n",height);