swap poller: use get_miner_active_swaps over bounded scan#165
Merged
Conversation
Replaces the hand-rolled 4-ID backward scan in resolve_recent_swap_id (and its duplicate in poll_for_swap_with_progress) with the existing get_miner_active_swaps helper. The old bound relied on a guessed window size; the helper uses the standard 50-consecutive-nones pattern already used throughout contract_client, so correctness no longer depends on picking the right magic number. Closes #150
Collaborator
Author
|
@anderdc check this out |
anderdc
approved these changes
Apr 23, 2026
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.
Closes #150.
The old
resolve_recent_swap_idscanned a fixed 4-ID window back fromnext_id-1. Correct diagnosis in #150 (and PR #161), but widening the window to 5/100/N is still guessing.Swaps it for the existing
client.get_miner_active_swaps(hotkey)helper, which uses the standard 50-consecutive-nones scan pattern fromcontract_client. Also removes a duplicate inline scan inpoll_for_swap_with_progress.Net: -5 lines, no magic number, correct regardless of swap position.