refactor: pass borrowed UtxoIndexProxy in async methods - #946
Open
the-phoenix wants to merge 1 commit into
Open
Conversation
the-phoenix
marked this pull request as draft
April 6, 2026 21:01
Make the proxy methods take &self instead of consuming the wrapper on every async call. The blocking task still gets its own Arc clone, but callers no longer need to treat the proxy as single-use.
the-phoenix
force-pushed
the
improve/utxoindex-api-cleanups
branch
from
April 6, 2026 21:04
5f69daa to
40c492d
Compare
the-phoenix
marked this pull request as ready for review
April 6, 2026 21:04
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
This PR makes the
UtxoIndexProxyasync methods borrow&selfinstead of consuming the proxy on every call.Motivation
The proxy wraps an
Arc<RwLock<dyn UtxoIndexApi>>, but its async methods previously took ownership ofselfeven though only the innerArcneeded to move into the blockingtask. That made the API more awkward than necessary for callers.
What Changed
UtxoIndexProxyasync methods to take&selfArcbefore callingspawn_blockingTesting
cargo check -p kaspa-utxoindex -p kaspa-index-processorCompatibility / Behavior Notes
No intended behavior change.
This is an API ergonomics cleanup only.