Skip to content

dash-spv: peer discovery stops trying new addresses once enough rejected peers are stored #1240

Done

Description

@xdustinface

All paths are under dash-spv/src/ at 8dde9d0c (dev after #902).

PeerDiscoverer::get (network/discovery.rs:98-104) returns stored probes first, sorted by lag, and samples fresh addresses only for the remainder. A probe rejected for lag 0 or lag at or above bad_lag goes straight back into probed (network/manager.rs:861, stash_backups at :778-784) with its backoff cleared by bans.dialed (:846). Probed entries never age (eviction only above MAX_PROBED), and best_lag_ms only falls (fetch_min, :854), so a rejected peer never becomes acceptable. Once want rejected hosts are stored, every 2s fill round re-handshakes them and never tries a new address. next_candidates (network/manager.rs:765-775) also samples first and filters live and banned addresses afterwards, which drops probed entries without replacement.

Evidence. A throwaway unit test with 200 fixed peers and want=4, recording each returned peer as bad (alternating lag 0 and 5000), then 1000 rounds of get(4):

fresh addresses over 1000 rounds=0

Fix. Back off rejected probes instead of clearing their backoff, age probed entries, and always mix at least one fresh address into each round.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions