AFAICT, as of commit a0a422c,  we have 2 different logics to evict outbound peers : lagging-chain (`ConsiderEviction`) and (`CheckForStaleTipAndEvictPeers`). The former to sanitize out lazy/buggy peers who have never sent us a valid header and are always staying behind our tip, the latter triggered in case of stale tip due to block variance to seek a better chain by rotating our outbound peers if we already reach an outbound limit (`EvictExtraOutboundPeers`).

Block-relay-only peers were introduced by #15719. Contrary to outbound full-relay peers who provided us at least a useful header, they're not protected by lagging-chain eviction.

We actually have a comment inside `ProcessHeadersMessage` indicating the contrary behavior. We should either document cleanly that block-relay-only aren't protected or effectively extend the scope of protection to them.

Hinted during #19724 review, see https://github.com/bitcoin/bitcoin/pull/19724#discussion_r475144532
g_recent_confirmed_transactions->insert(ptx->GetHash());
            if (ptx->GetHash() != ptx->GetWitnessHash()) {
                g_recent_confirmed_transactions->insert(ptx->GetWitnessHash());
            }
        }
    }
}
void PeerManager::BlockDisconnected(const std::shared_ptr<const CBlock> &block, const CBlockIndex* pindex)
{
    
    
    
    
    
    
    
    
    LOCK(g_cs_recent_confirmed_transactions);
    g_recent_confirmed_transactions->reset();
}
static RecursiveMutex cs_most_recent_block;
static std::shared_ptr<const CBlock> most_recent_block GUARDED_BY(cs_most_recent_block);
static std::shared_ptr<const CBlockHeaderAndShortTxIDs> most_recent_compact_block GUARDED_BY(cs_most_recent_block);
static uint256 most_recent_block_hash GUARDED_BY(cs_most_recent_block);
static bool fWitnessesPresentInMostRecentCompactBlock GUARDED_BY(cs_most_recent_block);
/**
 * Maintain state about the best-seen block and fast-announce a compact block
 * to compatible peers.
 */
void PeerManager::NewPoWValidBlock(const CBlockIndex *pindex, const std::shared_ptr<const CBlock>& pblock) {