Skip to content

feat(ckbtc): Add a get_utxos_cache to reduce latency of update_balance calls #4788

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 9 commits into
base: paulliu/ckbtc-cleanup-types
Choose a base branch
from

Conversation

ninegua
Copy link
Member

@ninegua ninegua commented Apr 11, 2025

XC-314: ckBTC: Cache update_balance results

The call to the bitcoin canister's get_utxos method takes up the majority time of a update_balance call.
Sometimes a client may call update_balance repeatedly, which adds to the workload of the ckBTC minter canister.
The result of get_utxos would remain unchanged until the bitcoin canister receives a new block, which makes it a good candidate for caching.

This PR implements an internal get_utxos_cache that will reuse previous call results (if available and not expired) without making new get_utxos calls. Entries are expired based on a pre-configured get_utxos_cache_expiration setting.

@ninegua ninegua requested a review from a team as a code owner April 11, 2025 13:39
@github-actions github-actions bot added the feat label Apr 11, 2025
@ninegua ninegua marked this pull request as draft April 11, 2025 13:39
@ninegua ninegua removed the request for review from a team April 11, 2025 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant