feature: allow custom feature bits already set by default#10888
feature: allow custom feature bits already set by default#10888Lrifton92 wants to merge 2 commits into
Conversation
When a custom feature bit configured via protocol.custom-init or protocol.custom-nodeann is already advertised in lnd's default feature vector, newManager returned a "feature bit: X already set" error and lnd failed to start. Re-advertising an already-set bit yields an identical feature vector, so this is harmless. Treat an already-set custom bit as a no-op instead of a fatal error. Genuine conflicts between the optional and required variants of a feature are still rejected by SafeSet.
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses an issue where lnd would fail to start if a user configured a custom feature bit that was already included in the default feature vector. By allowing these redundant configurations to be ignored, the system remains robust while preventing unnecessary startup aborts. Highlights
New Features🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
|
Added the release note and contributor entry in c5b26b8 ( |
There was a problem hiding this comment.
Code Review
This pull request modifies the feature manager to treat duplicate custom feature bits that are already advertised by default as a no-op instead of failing startup with an error. It also adds a corresponding unit test TestManagerCustomFeatureAlreadyDefault to verify this behavior. There are no review comments, so I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
PR Severity: HIGH (feature/* - Feature bit management). Files: feature/manager.go [HIGH], docs/release-notes/release-notes-0.22.0.md [LOW], feature/manager_internal_test.go [LOW/excluded]. Scope: 2 non-test files, 17 lines - no bump triggered. <!-- pr-severity-bot --> |
Change Description
Fixes #10883.
When a custom feature bit configured via
protocol.custom-initorprotocol.custom-nodeannis already advertised in lnd's default feature vector,newManagerreturned a fatalfeature bit: X already seterror and lnd failed to start:For example, bit
39isOnionMessagesOptional, which lnd already advertises by default. A config such as:does not change the effective feature vector at all, yet it prevented startup.
Fix
Re-advertising an already-set bit yields an identical feature vector, so it is harmless. This treats an already-set custom bit as a no-op (
continue) instead of a fatal error. Genuine conflicts between the optional and required variants of a feature are still rejected bySafeSetimmediately below, so the safety property is preserved.Testing
Added
TestManagerCustomFeatureAlreadyDefault, which configures a custom feature bit that is already set by default and asserts that:newManagerno longer errors, andgofmt,go vet ./feature/clean. Tested on go1.26.4.Steps to Test
protocol.custom-init=39andprotocol.custom-nodeann=39inlnd.conf.feature bit: 39 already set; after it, lnd starts normally and the feature vector is unchanged.Pull Request Checklist