Repository navigation
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
erskingardner
marked this pull request as ready for review
October 14, 2026 12:28
With subscription verification enabled, a single filter with a `limit` counts the stored events received before EOSE, and rejects (or bans the relay for) any event beyond the limit. Restoring a subscription after a reconnect sends its REQ again, so the relay starts a new stored-events query. `update_subscription` kept the previous EOSE flag and event count, though: - if the connection dropped before EOSE, the count continued from the previous session, so a relay resending its stored events went over the limit and could be banned with `ban_relay_on_mismatch`; - if EOSE had been received, the limit check was skipped for the new query. Reset both when the subscription is marked as subscribed again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
yukibtc
force-pushed
the
sdk/reset-limit-state-on-resubscribe
branch
from
October 15, 2026 09:27
a898ea7 to
7cd86a4
Compare
yukibtc
approved these changes
Oct 15, 2026
3 tasks done
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.
Description
When subscription verification is on (
verify_subscriptionsorban_relay_on_mismatch), the SDK counts the stored events a subscription receives before EOSE if it has a single filter with alimit. Any event past the limit is rejected, and withban_relay_on_mismatchthe relay is banned.Problem. When a subscription is restored after a reconnect, its REQ is sent again, so the relay starts a new stored-events query.
update_subscription(.., true)kept the previousreceived_eoseflag andreceived_eventscount, which causes two problems:ban_relay_on_mismatchit is banned.Fix. Reset both fields when the subscription is marked as subscribed again. This is the same reset that
update_auto_closing_subscriptionalready does for auto-closing subscriptions.Notes to the reviewers
handle_event_msgdirectly, one for each direction. Both fail onmasterand pass with this change.queue_msg). Whichever PR merges second should reset these fields there too. I'm happy to add that to whichever one is still open.Checklist
CHANGELOG.md(if applicable)🤖 Generated with Claude Code