HRN resolution refinement and architectural clean-up#887
Open
chuksys wants to merge 5 commits intolightningdevkit:mainfrom
Open
HRN resolution refinement and architectural clean-up#887chuksys wants to merge 5 commits intolightningdevkit:mainfrom
chuksys wants to merge 5 commits intolightningdevkit:mainfrom
Conversation
Refactors the circular dependency between the HRNResolver and the PeerManager during the Node initialization process. Changes: - Removed the `peer_manager_hook` Mutex/Option pattern used to bridge the initialization gap. - Replaced the global initialization hook with a local deferred registration pattern using `Arc::downgrade` after the PeerManager is constructed. - Optimized `post_queue_action` by utilizing a Weak pointer upgrade instead of locking a Mutex on every call. This change improves performance for HRN resolution events and simplifies the builder logic by making the circular dependency resolution explicit and local to the builder function.
|
I've assigned @tnull as a reviewer! |
Streamlines the storage and passing of HRNResolver by holding it by value in the Node and UnifiedPayment structs. Changes: - Removed the outer Arc wrapper around HRNResolver in Node and UnifiedPayment. - Implemented Clone for HRNResolver to facilitate easy sharing of the internal Arcs. - Updated UnifiedPayment method calls to pass HRNResolver by reference instead of using .as_ref() on an outer Arc. Since HRNResolver variants already contain internal Arcs, the outer Arc was redundant and added unnecessary memory indirection.
Optimizes the DNS resolver setup by deferring log execution until an actual failure occurs. Changes: - Replaced `ok_or` with `ok_or_else` when resolving DNS server addresses. evaluation and unnecessary string formatting on successful builds. This ensures that logging overhead and string interpolation are only incurred during error states, rather than being evaluated on every successful initialization.
Updates the documentation in config.rs for better accuracy and readability. Changes: - Corrected the description of HRN resolution_config from 'Enabled' to 'Disabled' to align with the actual default value of false. - Realigned the Config defaults table to accommodate longer type names and improve Markdown rendering. These changes are strictly documentation-focused and do not alter any runtime behavior.
Cleans up the set_test_offer method by removing the underscore from the offer parameter name. Changes: - Renamed `_offer` to `offer` to reflect that the variable is actively used within the method body. - Ensures the code adheres to standard Rust naming conventions for used variables. This is a minor cleanup of the test-only API used for HRN integration testing.
7877e09 to
e29ae44
Compare
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.
Description
This is a follow-up to #630 to clean up the initial HRN resolution implementation. It focuses on improving initialization flow, reducing memory indirection, and fixing minor documentation bugs.
Changes
Initialization: Replaced the peer_manager_hook (Mutex/Option) with a deferred Weak pointer registration to resolve circular dependencies safely and efficiently.
Performance: Switched to
ok_or_elsein DNS setup to ensure error logging/string formatting only occurs on failure.Type Cleanup: Removed redundant Arc wrapping around
HRNResolverand implementedClonefor theenumto simplify passing it by value.Docs: Corrected the default value description for
resolution_configand realigned the configuration defaults table.Tests: Cleaned up variable naming in the
set_test_offerhelper.Fixes #883