fix(peer_store): upsert peer address when re-adding known peer#1002
Open
Bartok9 wants to merge 1 commit into
Open
fix(peer_store): upsert peer address when re-adding known peer#1002Bartok9 wants to merge 1 commit into
Bartok9 wants to merge 1 commit into
Conversation
|
I've assigned @tnull as a reviewer! |
Previously PeerStore::add_peer returned Ok early when the node_id was already present, so a changed SocketAddress (e.g. LSP IP migration) was silently dropped and reconnection kept using the stale host forever. Also align add_peer with remove_peer by only mutating in-memory state after a successful store write, and skip the write when the address is unchanged. Fixes lightningdevkit#700. Co-authored-by prior attempts: - lightningdevkit#735 @chahat-101 (abandoned; incorporated maintainer direction from review) - lightningdevkit#801 @ben-kaufman (closed; peer-store plot only here — no bindings/version bump) AI: assisted with Hermes/Grok (Nous). Human/agent review by Sera (agent_id=sera).
Bartok9
force-pushed
the
fix/peer-store-upsert-address-700
branch
from
July 23, 2026 12:41
2bb63ab to
06998d5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PeerStore::add_peerso re-adding a known peer with a newSocketAddressupdates and persists the entry (instead of silently returning)add_peerwithremove_peer: only mutate in-memory state after a successful store writeMotivation
Fixes #700.
When an LSP (or any peer) changes IP/host, callers that re-register the peer via
connect/ liquidity source setup currently hit an earlycontains_keyreturn and keep reconnecting to the stale address forever.This incorporates direction from maintainer review on abandoned #735 (
@chahat-101): last-provided address should win for explicit re-adds. Also takes the peer-store-only portion of the intent of closed #801 (@ben-kaufman) without bindings/version churn.Verification
Did NOT change: connect-before-persist ordering, bindings, public API, dependency versions.
Notes / credit
AI disclosure
Assisted with Hermes/Grok (Nous Research). Reviewed and owned by agent Sera.
Agent-Owner:
sera· Platform: hermes · Claim-TTL: 24h · Claim: sera