Skip to content

dash-spv: nothing bounds or withdraws a network request that no peer will answer #1233

Open

Description

@xdustinface

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

KICKING_ATTEMPTS (network/broker.rs:14) only gates the kick at network/broker.rs:204. After that, Broker::expire re-queues with no limit (network/broker.rs:213-217). The attempt count is kept on requeue and incremented on route, but never compared to a maximum. Several requests are left unanswered on purpose or by omission:

  • a MnListDiff for an unknown height (sync/masternodes/sync_manager.rs:183-188, whose comment says the broker's retry re-sends it)
  • headers that match no segment, and the ForkDetected path (sync/block_headers/manager.rs:182-198)
  • blocks no peer has, since Dash Core never sends notfound for blocks (ProcessGetBlockData, v23.1.8 net_processing.cpp:2750, :2754, :2778)

The NetworkManager trait (network/mod.rs:101-136) has no way to withdraw a single key. Only stop() clears the whole broker. Broker::not_found (network/broker.rs:153-164) re-queues without remembering which peer refused, and settle releases that peer's bytes (network/costs.rs:186-191), so the peer that just sent notfound becomes the most likely pick (network/broker.rs:258-262).

Evidence. A testnet benchmark log shows CFilters(1580862) unanswered after 9 attempts, retrying without kicking 68.67.122.40:19999, a tip request that also logged attempts 5, 6 and 7. Across the benchmark runs, CFilters reached 2 to 9 attempts and CfHeaders 2 to 3.

Fix. Add an attempt limit that hands the key back to its manager, add withdraw(RequestKey) to the network trait, and skip the peer that sent notfound when re-routing. Related: #1230 (per-request deadline).

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