Skip to content

smite: use BOLT 9 feature bitfield primitives - #192

Open
NishantBansal2003 wants to merge 10 commits into
lnfuzz:masterfrom
NishantBansal2003:bolt-feature
Open

smite: use BOLT 9 feature bitfield primitives#192
NishantBansal2003 wants to merge 10 commits into
lnfuzz:masterfrom
NishantBansal2003:bolt-feature

Conversation

@NishantBansal2003

@NishantBansal2003 NishantBansal2003 commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Depends-on: #185

Adds BOLT 9 feature primitives, which are useful in places where we need to query different features/bits in negotiated features, channel_type, etc, to proceed further. This will also be useful in the future when we add dual-fund support, and is already useful when working on the accept_channel oracle, where we need to query supported features/channel_type

This PR also aggregates all the existing feature-related utilities into a single Features struct. I've only added the features currently used by smite, we can add more as needed in the future.

Currently, I've only updated the places that actually need to query Features. I haven't changed wire messages that still use Vec<u8> for features, to avoid changing a lot of code without any immediate benefit. I think we can use features.rs as a utility whenever we need to query or manipulate Features, while continuing to use Vec<u8> for wire messages where we don't need to inspect the feature bits

Required when moving fee checks to accept_channel oracle where we
wouldn't need to construct the whole channel state just to compute
the cost.

Signed-off-by: Nishant Bansal <nishant.bansal.282003@gmail.com>
Define `AcceptChannelOracle` and migrate existing `accept_channel`
validation into it, consolidating BOLT 2 v1 channel establishment
checks:

- verify `temporary_channel_id` maps to a sent `open_channel`
- validate funding amounts and channel type presence
- check the opener can afford the proposed commitment feerate
- detect reused `temporary_channel_id`s before `funding_created`

The oracle brings together validation that was previously spread
across `record_recv_accept_channel()`, `verify_funding_signed()`
and implicit checks.

Signed-off-by: Nishant Bansal <nishant.bansal.282003@gmail.com>
Signed-off-by: Nishant Bansal <nishant.bansal.282003@gmail.com>
Signed-off-by: Nishant Bansal <nishant.bansal.282003@gmail.com>
Signed-off-by: Nishant Bansal <nishant.bansal.282003@gmail.com>
Signed-off-by: Nishant Bansal <nishant.bansal.282003@gmail.com>
Signed-off-by: Nishant Bansal <nishant.bansal.282003@gmail.com>
Signed-off-by: Nishant Bansal <nishant.bansal.282003@gmail.com>
Signed-off-by: Nishant Bansal <nishant.bansal.282003@gmail.com>
Signed-off-by: Nishant Bansal <nishant.bansal.282003@gmail.com>
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