Skip to content

fix(kad-dht): only echo PUT_VALUE response on success#3502

Merged
tabcat merged 2 commits into
libp2p:mainfrom
tabcat:fix/kad-dht-put-value-no-echo-on-failure
May 12, 2026
Merged

fix(kad-dht): only echo PUT_VALUE response on success#3502
tabcat merged 2 commits into
libp2p:mainfrom
tabcat:fix/kad-dht-put-value-no-echo-on-failure

Conversation

@tabcat
Copy link
Copy Markdown
Member

@tabcat tabcat commented May 12, 2026

Description

The PUT_VALUE handler echoed the request back regardless of whether the record was stored. Per the spec and go-libp2p, the response should only be echoed on successful validation and storage. The handler now throws on failure; RPC.handleMessage already catches that to skip the write and increment the error metric.

Change checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation if necessary (this includes comments as well)
  • I have added tests that prove my fix is effective or that my feature works

Throw on failure so RPC.handleMessage skips the response write and
increments the error metric, matching the spec and go-libp2p.
@tabcat tabcat marked this pull request as ready for review May 12, 2026 23:22
@tabcat tabcat requested a review from a team as a code owner May 12, 2026 23:22
@tabcat tabcat merged commit 5692f3f into libp2p:main May 12, 2026
46 of 48 checks passed
@tabcat tabcat mentioned this pull request May 13, 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.

1 participant