Fail on get_chainactive before lock if checks fail
This commit is contained in:
@@ -813,11 +813,13 @@ int32_t waitForPeers(const CChainParams &chainparams)
|
|||||||
#ifdef ENABLE_WALLET
|
#ifdef ENABLE_WALLET
|
||||||
CBlockIndex *get_chainactive(int32_t height)
|
CBlockIndex *get_chainactive(int32_t height)
|
||||||
{
|
{
|
||||||
LOCK(cs_main);
|
if ( chainActive.LastTip() != 0 )
|
||||||
if ( chainActive.Tip() != 0 )
|
|
||||||
{
|
{
|
||||||
if ( height <= chainActive.Tip()->nHeight )
|
if ( height <= chainActive.LastTip()->nHeight )
|
||||||
|
{
|
||||||
|
LOCK(cs_main);
|
||||||
return(chainActive[height]);
|
return(chainActive[height]);
|
||||||
|
}
|
||||||
// else fprintf(stderr,"get_chainactive height %d > active.%d\n",height,chainActive.Tip()->nHeight);
|
// 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);
|
//fprintf(stderr,"get_chainactive null chainActive.Tip() height %d\n",height);
|
||||||
|
|||||||
Reference in New Issue
Block a user