Skip to content

Commit

Permalink
Revert "Merge bitcoin#29122: test: adds outbound eviction functional …
Browse files Browse the repository at this point in the history
…tests, updates comment in ConsiderEviction"

This reverts commit 9db73d2.
  • Loading branch information
PastaPastaPasta committed Feb 17, 2025
1 parent c85063f commit cc9330c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 261 deletions.
11 changes: 4 additions & 7 deletions src/net_processing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5425,19 +5425,16 @@ void PeerManagerImpl::ConsiderEviction(CNode& pto, Peer& peer, std::chrono::seco
// unless it's invalid, in which case we should find that out and
// disconnect from them elsewhere).
if (state.pindexBestKnownBlock != nullptr && state.pindexBestKnownBlock->nChainWork >= m_chainman.ActiveChain().Tip()->nChainWork) {
// The outbound peer has sent us a block with at least as much work as our current tip, so reset the timeout if it was set
if (state.m_chain_sync.m_timeout != 0s) {
state.m_chain_sync.m_timeout = 0s;
state.m_chain_sync.m_work_header = nullptr;
state.m_chain_sync.m_sent_getheaders = false;
}
} else if (state.m_chain_sync.m_timeout == 0s || (state.m_chain_sync.m_work_header != nullptr && state.pindexBestKnownBlock != nullptr && state.pindexBestKnownBlock->nChainWork >= state.m_chain_sync.m_work_header->nChainWork)) {
// At this point we know that the outbound peer has either never sent us a block/header or they have, but its tip is behind ours
// AND
// we are noticing this for the first time (m_timeout is 0)
// OR we noticed this at some point within the last CHAIN_SYNC_TIMEOUT + HEADERS_RESPONSE_TIME seconds and set a timeout
// for them, they caught up to our tip at the time of setting the timer but not to our current one (we've also advanced).
// Either way, set a new timeout based on our current tip.
// Our best block known by this peer is behind our tip, and we're either noticing
// that for the first time, OR this peer was able to catch up to some earlier point
// where we checked against our tip.
// Either way, set a new timeout based on current tip.
state.m_chain_sync.m_timeout = time_in_seconds + CHAIN_SYNC_TIMEOUT;
state.m_chain_sync.m_work_header = m_chainman.ActiveChain().Tip();
state.m_chain_sync.m_sent_getheaders = false;
Expand Down
253 changes: 0 additions & 253 deletions test/functional/p2p_outbound_eviction.py

This file was deleted.

1 change: 0 additions & 1 deletion test/functional/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,6 @@
'p2p_leak_tx.py --v1transport',
'p2p_leak_tx.py --v2transport',
'p2p_eviction.py',
'p2p_outbound_eviction.py',
'p2p_ibd_stalling.py --v1transport',
'p2p_ibd_stalling.py --v2transport',
'p2p_net_deadlock.py --v1transport',
Expand Down

0 comments on commit cc9330c

Please sign in to comment.