Skip to content

fix(ibd): track eviction cooldowns by network identity - #1212

Merged
reardencode merged 2 commits into
reardencode:masterfrom
w3irdrobot:fix/onion-eviction-cooldown
Oct 25, 2026
Merged

reardencode merged 2 commits into
reardencode:masterfrom
w3irdrobot:fix/onion-eviction-cooldown

Conversation

@w3irdrobot

@w3irdrobot w3irdrobot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Problem

IBD recorded eviction cooldowns and strikes using PeerSlot.addr. Onion peers use a synthetic 0.0.0.0:<port> socket there, so different onions on port 8333 shared strike accounting while their actual identities remained eligible for redial.

Replacement and fallback checks also consulted cooldowns only for socket-address targets.

Fix

Use NetAddr consistently for cooldown and strike accounting across:

  • Stall and relative-slow eviction
  • Dial failures and peer-death handling
  • Dial exclusion, replacement checks, and cooldown fallback
  • Expiry and successful-redial clearing

Successful connections clear cooldowns without resetting strike history. IPv4/IPv6 behavior is preserved.

@rearden-grok rearden-grok Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

APPROVE

0 bugs, 0 suggestions, 2 nits

Nit: no changelog.d/ fragment. Feature pulls record the unreleased note there.

Strike-map nit is on addr_strikes.

pub addr_buckets: HashMap<usize, rbitcoin_net::peer::AddrTokenBucket>,
/// Process-local stall/relative-slow kick counts (not persisted).
pub addr_strikes: HashMap<SocketAddr, u8>,
pub addr_strikes: HashMap<NetAddr, u8>,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: addr_strikes is never removed. Cooldown expiry does not drop it, and dial failures now insert one entry per onion or I2P. Those keys outlive addrman eviction for the rest of the process.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in c09af01. Cooldown expiry now also removes strikes when an identity is absent from addrman and has no active cooldown. Retained addresses keep their strike history across expiry and successful redials. Added a regression covering onion/I2P eviction and retained IPv4/IPv6 escalation, plus the missing changelog fragment.

@reardencode reardencode left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Plz address grok's nits above

@reardencode
reardencode merged commit c691a83 into reardencode:master Oct 25, 2026
24 of 25 checks passed
@w3irdrobot
w3irdrobot deleted the fix/onion-eviction-cooldown branch October 25, 2026 22:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants