Skip to content
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

Subscription context with a network type #458

Open
wants to merge 24 commits into
base: master
Choose a base branch
from

Conversation

tiram88
Copy link
Collaborator

@tiram88 tiram88 commented Apr 22, 2024

Adds a network type to the subscription context and a corresponding address prefix to the address tracker.

The tracker prefix is used for validating addresses in register/unregister operations. It also allows a fully contextualized conversion of indexes to addresses.

The dependency between Tracker and the indexers CounterMap and Indexes is reversed by encapsulating a reference to the tracker in every indexer. The new architecture is much more robust. It guarantees an accurate index reference counting in the tracker, notably on indexers Clone and Drop and alleviates the need to carry a subscription context in many functions dealing with indexers.

It remained some rare cases of UtxosChangedScope mutations where a back and forth conversion of indexes to addresses could occur. This is now optimized by refactoring UtxosChangedScope into an enum accepting either addresses or indexes which removes the need for those costly and redundant conversions.

Both gRPC and wRPC clients, when configured with a subscription context, query the network type of the server they connect to and configure their context accordingly. Note that this operation may fail if the subscription context of the client has already a defined network type and the server provides a different type.

This PR addresses the technological debts intentionally left behind in #427 (see)

…`. Enforce extensive tracking of index ref count for all `IndexSet` & `CounterMap` operations, including Clone and Drop.
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