Skip to content

Share managers between multiple nodes#748

Merged
dpad85 merged 6 commits intomasterfrom
currency-manager-rework
Oct 3, 2025
Merged

Share managers between multiple nodes#748
dpad85 merged 6 commits intomasterfrom
currency-manager-rework

Conversation

@dpad85
Copy link
Member

@dpad85 dpad85 commented Sep 30, 2025

This PR introduces a PhoenixGlobal object that shares various managers that used to be tied to the PhoenixBusiness object, but whose scope is actually application-wide.

Rationale : the PhoenixBusiness architecture in the phoenix-shared module made assumptions that do not work with the multiple wallets update. Specifically, any "global" flow that is not specific to a given node should be shared, and not be tied to a specific PhoenixBusiness object.

For example, we need only 1 single CurrencyManager that will share its exchange rates data between all nodes running on the app. Same is true for the mempool.space feerate estimation, or the wallet-context fetcher.

dpad85 and others added 6 commits September 29, 2025 16:34
The PhoenixBusiness object is tied to a specific wallet. It can be
destroyed, or many instances can be created. It's not suited for
routines that have application-wide scope, such as the Currency
Manager. Note that this is also true for a few other things, like
the network state monitoring, or the mempool.space fee estimation.

As such a PhoenixGlobal class has been added with the expecation
that it's created at application startup, and that it is unique.
Note that it probably could be a singleton, TBD.

The CurrencyManager logic is the same as before, though there are
some changes: the APIs objects have been moved to separate file in
a distinct package for readability. Also, the flow of watched
currencies is now stored in this Manager, and not in the
AppConfigManager.
Also rollback change to WalletPaymentsMetadata queue class: we
need to fetch the fiat exchange rate when retrieving the metadata
before inserting new payments to the database.

The monitored currencies is now a map wallet->currencies which is
easier to maintain when running multiple wallets in parallel.
@dpad85 dpad85 force-pushed the currency-manager-rework branch from 2cc7c76 to 0f83437 Compare October 1, 2025 09:13
@dpad85 dpad85 marked this pull request as ready for review October 2, 2025 11:51
@dpad85 dpad85 requested a review from robbiehanson October 2, 2025 11:51
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.

2 participants