Skip to content

fix(node): skip own node ID in configured bootstrap and persistent peers - #1660

Closed
lklimek wants to merge 2 commits into
masterfrom
fix/skip-self-in-configured-peers
Closed

lklimek wants to merge 2 commits into
masterfrom
fix/skip-self-in-configured-peers

Conversation

@lklimek

@lklimek lklimek commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator

TL;DR: A node whose seed or persistent peer list contains its own address now starts normally and logs a warning, instead of refusing to start.

User story

As a Dash Platform evonode operator, I want my node to start even when the shared seed list it receives includes my own node, so that a routine configuration refresh cannot take my evonode offline.

Scenario

Base flow

  1. The operator's tooling writes a list of seed (bootstrap) or persistent peers into the node's configuration. dashmate 5.1.0 does this from the evonode registry, so the list includes the evonodes themselves (dashmate 5.1: default seed refresh can put a node's own ID into tenderdash seeds, and Tenderdash 2.0 refuses to start ("can't add self ... to peer store") platform#6307).
  2. The node starts.

Actual behavior

When the list contains the node itself, Tenderdash stops during startup with failed to add peer "<id>@<ip>:26656": can't add self (<id>) to peer store. The container restarts and fails again in a loop, and the evonode stays offline until someone edits the configuration by hand. This was seen on a mainnet evonode.

Expected behavior

The node skips its own entry, logs one warning naming the setting and the address, and starts with the other peers. Every other way of adding the node itself as a peer is still refused, and an invalid address in either list still stops startup with a clear error, as before.

Detailed discussion

What was done

  • node/setup.go createPeerManager reads both p2p.persistent-peers and p2p.bootstrap-peers in one loop:
    • each entry is still parsed first, so a malformed address still fails startup;
    • an entry whose node ID equals the node's own ID is skipped with WARN "skipping own node ID in configured peers" (config_key, address). It is added neither to the peer store nor to PeerManagerOptions.PersistentPeers, so it takes no persistent slot and is never dialled;
    • PeerManager.Add is unchanged and still returns can't add self for PEX or any other add.
  • Same code in v1.8.2: the bug is pre-existing. After merge, this hotfix needs a forward-port to dev.
  • 1.8.x backport: not done here. Platform/dashmate 4.2.x and 5.0.x pin Tenderdash 1.8 with static seed lists, so self only appears through manual configuration. The registry-based seed refresh from platform#6307 ships with dashmate 5.1 / Tenderdash 2.0. A 1.8.x backport makes sense only if a supported 1.8.x deployment hits it.

Testing

  • New TestCreatePeerManagerSkipsConfiguredSelf (bootstrap and persistent sub-tests): self appears twice next to a valid peer, once under another address with the ID in upper case. Startup succeeds; only the other peer is stored and dialled, with the persistent score only for persistent-peers; there are exactly two WARN lines naming the key and address; and a direct Add of self is still refused. It fails without the fix: can't add self for bootstrap, and the persistent self entry exceeding the connection limit.
  • New TestCreatePeerManagerRejectsMalformedConfiguredPeer: an invalid address still fails startup for both keys.
  • go test -p 2 -race -count=1 -run '^(TestCreatePeerManager(SkipsConfiguredSelf|RejectsMalformedConfiguredPeer)|TestPeerManager_Dialed_Self)$' ./node ./internal/p2p: pass.
  • make lint LINT_BASE=origin/master: 0 issues; gofmt clean.
  • An independent cross-provider review (Gemini) approved it; its only test-coverage note is addressed in the second commit.

Out of scope / known limitations

  • The same non-self peer listed twice in persistent-peers is counted twice against the connection limit. This is pre-existing; a follow-up can deduplicate it.
  • With p2p.allowlist-only = true and only the node's own address configured, the node starts isolated instead of failing fast, because the allowlist still includes self. This is pre-existing and fail-closed; a follow-up can address it.

Breaking changes

None.

Prior work

Attribution

Implemented with Codex (GPT-6.2-Sol), and reviewed by Claude and Gemini.

🤖 Co-authored by Claudius the Magnificent AI Agent

🤖 Generated with Claude Code

lklimek and others added 2 commits November 26, 2026 21:25
A node whose bootstrap-peers or persistent-peers list contains its own
node ID failed to start with "can't add self ... to peer store". Shared
seed lists (dashmate's stock list includes the evonodes themselves) put
every listed evonode into a crash loop. Skip such entries with a WARN
after address validation; the peer store still refuses self on any
other add, and malformed addresses still fail startup.

Co-Authored-By: GPT-6.2-Sol (Codex) <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@lklimek lklimek added this to the v2.0 milestone Nov 26, 2026
@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@lklimek
lklimek marked this pull request as ready for review November 26, 2026 21:57
@lklimek
lklimek marked this pull request as draft November 26, 2026 21:57
@thepastaclaw

Copy link
Copy Markdown

🕓 Review not started yet because this PR is a draft.

  • Request normal review — click when the PR is ready for review.
  • Request priority review — click to move this review to the front of the queue.

Commit 6fdd3a0. Normal review starts when eligible; priority review starts as soon as a slot is available.

@lklimek

lklimek commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator Author

won't fix - we fix it in dashpay/platform#6349 , tenderdash behavior is correct.

@lklimek lklimek closed this Nov 27, 2026
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